mirror of
https://github.com/nektos/act.git
synced 2026-04-26 09:25:54 +03:00
[GH-ISSUE #1785] act fails to update cached action clones #868
Labels
No labels
area/action
area/cli
area/docs
area/image
area/runner
area/workflow
backlog
confirmed/not-planned
kind/bug
kind/discussion
kind/external
kind/feature-request
kind/question
meta/duplicate
meta/invalid
meta/need-more-info
meta/resolved
meta/wontfix
meta/workaround
needs-work
pull-request
review/not-planned
size/M
size/XL
size/XXL
stale
stale-exempt
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/act#868
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jsoref on GitHub (May 3, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/1785
Bug report info
Command used with act
Describe issue
act's cache of actions has two
HEADitems, aHEADand arefs/heads/HEAD, they're disconnected from each other and when act runs it doesn't updateHEADto the latest value of the remote'sHEAD.Link to GitHub repository
https://github.com/check-spelling/scimax
Workflow content
Relevant log output
% cd ~/.cache/act/github-codeql-action-upload-sarif@v2
jsoref@jsoref-mbp github-codeql-action-upload-sarif@v2 % git ls-remote origin|grep HEAD
8ca5570701137b67af3d8ae3d6452f4cee6579da HEAD
jsoref@jsoref-mbp github-codeql-action-upload-sarif@v2 % git ls-remote .|grep HEAD
f31a31c052207cc13b328d6295c5b728bb49568c HEAD
8ca5570701137b67af3d8ae3d6452f4cee6579da refs/heads/HEAD
Additional information
This message appears in a number of tickets, but hasn't been characterized and I've been mostly ignoring it for a long time.
@Sewer56 commented on GitHub (Jul 14, 2023):
I'm also a victim. In some cases, e.g. force pushes, you'll also need to manually fix HEAD; or... if you're lazy, just do the unforgivable act of deleting the cache.
@ChristopherHX commented on GitHub (Jul 14, 2023):
From a stale private maintainer discussion, I think fixing the cache requires a rewrite.
My idea would be to create one bare git clone per repository. (not per repository + path + revision)
Use go-git to extract files from git, then we could just store an inmemory sha of the action version for a specfic job and don't have to worry about an altered checkout.
I assume go-git will handle everything else for us with a bare git repo.
Just an idea, how an interaface could look like
An exchangeable interface for action/workflow cloning would be great in my opinion, so we could keep the old logic and add new ones.
We could use GetTarArchive to copy the action to the container and to read files like action.yml or workflows.
With ResolveVersion we could lock the version we want from a repository, another call shouldn't alter the state of the content.
This interface could also be implemented as a tar archive downloader without using git, this would allow to mimic how actions/runner downloads actions.
If you like this approuch I might implement it this Summer.
@github-actions[bot] commented on GitHub (Jan 13, 2024):
Issue is stale and will be closed in 14 days unless there is new activity
@Sewer56 commented on GitHub (Jan 13, 2024):
no
@ChristopherHX commented on GitHub (Jan 13, 2024):
BTW my PR's regarding the new action cache seem to have no chance for approval. Even if it added behind a flag (
--use-new-action-cacheto enable) .https://github.com/nektos/act/pull/1954#issuecomment-1881683739
Since I'm not an owner I cannot do anything here.
@ChristopherHX commented on GitHub (Jan 13, 2024):
Nor do I know if that fixes the issue described here, because I couldn't manage to reproduce it either way.
@ChristopherHX commented on GitHub (Jan 27, 2024):
Does
act --use-new-action-cachestill have this issue? It's a feature flag included in the next release.I need feedback, because the
new-action-cacheshould be tested carefully before it becomes the new default. If it doesn't help, then it might be a good idea to remove it again.What I could test myself would be
Using the feature flag act doesn't
No feedback => no resolution and the feature flag will be kept off for a longer period or removed.
@jsoref commented on GitHub (Jan 28, 2024):
With a caveat about having to work around not supporting docker contexts as mentioned in https://github.com/nektos/act/issues/2077#issuecomment-1913435653
Here's
act version 0.2.57which doesn't appear to include--use-new-action-cache:Here's a local build as of https://github.com/nektos/act/pull/2169/commits/ea367dc9f6ee91999f7307a74e8f67be5f86731f:
Offhand, I think the answer is that it does change the behavior.
@ChristopherHX commented on GitHub (Jan 28, 2024):
Is this a bug of the feature flag that an action.yml/action.yaml/Dockerfile cannot be found?
At least this error needs to be improved
Your checkspelling action is a pretty complex construct, it also failed easily for me while using actions/runner + a custom Actions backend server.
@jsoref commented on GitHub (Jan 28, 2024):
I recently switched from using actions/download-artifact to using
gh ...to retrieve the artifact -- the actions/download-artifact action is awful.@jsoref commented on GitHub (Jan 28, 2024):
Specifically I upgraded to the actions/upload-artifact@v4 which does new magic -- everyone will be updating to it soon because they're actively destroying actions/upload-artifact@v3 support...
@jsoref commented on GitHub (Jan 28, 2024):
fwiw, That message is bizarre. I can't find an obvious source for it. And I don't have the energy to wade through print breakpoints hunting for it.
But, yes, it appears to somehow be a regression caused by the feature flag -- running the same binary w/o the flag does not trigger that output.
@jsoref commented on GitHub (Jan 28, 2024):
Is because my workflow involves renaming
origintocheck-spellingand adding ajsorefremote -- I only re-add a remoteoriginpointing toupstreamwhen I start syncing with upstream (which apparently didn't happen forscimax).offhand, I suspect
file does not existis foruses: action/cache/restore@v4and similar -- i.e. any time there's a path within the repository.Anyway, the reason it isn't fatal to check-spelling is that I only use non toplevel actions for
actions/cache/restore,actions/cache/save, andgithub/codeql-action/upload-sarif(well, along with an alternate version of the same).fwiw, if i use a fine-grained pat that gives access to contents:read and give that to github_token, I can use v0.0.22/prerelease and things kinda work (well, I'm pretty sure I'm getting a lousy cached version for
prerelease).@ChristopherHX commented on GitHub (Jan 28, 2024):
Thanks for pointing this out. I confirm the subpath got lost while reading the action.yml file for subactions.
The log should annotate the error with the action name and revision it tried to read from + all paths it tried.
@ChristopherHX commented on GitHub (Jan 28, 2024):
Yes using another ref in the old action cache will result in it's own clone of the action, which might be in a different stale version.
I'm fixing the error message in https://github.com/nektos/act/pull/2171 and the bug in https://github.com/nektos/act/pull/2170.
The error not found error is most likely coming from https://github.com/github/codeql-action, because this is the only subpath action without a root
action.ymlfile that has been read by error.@github-actions[bot] commented on GitHub (Jul 27, 2024):
Issue is stale and will be closed in 14 days unless there is new activity