mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #2024] 'MODULE_NOT_FOUND' resulting from configuration of working directory when using host environment #971
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#971
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 @colonelpanic8 on GitHub (Sep 24, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/2024
Bug report info
I filed this issue against the gitea act_runner (https://gitea.com/gitea/act_runner/issues/361), but having read some more code, I believe that the issue lies in the way that act is configured.
I've done some digging and I believe I (sort of) understand why the problem is happening, but I can't say I fully understand the design of the host environment, or what is supposed to be happening.
Here is a gist of the output i see from the gitea runner:
https://gist.github.com/colonelpanic8/37ff6b474e9c6475d599ee2e8de5accd
The most important line from this is:
Now, note that when the actual checkout command is executed, it seems we are looking for it here:
/var/lib/private/gitea-runner/nix/.cache/act/5b246fa22da6d129/hostexecutor/.cache/act/5b246fa22da6d129/act/actions/actions-checkout@v2/dist/index.js
when this file actually exists
/var/lib/gitea-runner/nix/.cache/act/182e52eeaf6a06cd/act/actions/actions-checkout@v2/dist/index.js
So the mystery, is basically, why is there an additional:
hostexecutor/.cache/act/5b246fa22da6d129/
in the middle of the path here?
I belive, I sort of understand what is going on, but again, I don't fully understand the design of act, so I'm not sure what the right way to fix this is. Anyway, let me elaborate:
The log line that gives us information about paths occurs here:
github.com/nektos/act@c241ecda31/pkg/runner/action.go (L151)We can see that this results in a call for the action here:
github.com/nektos/act@c241ecda31/pkg/runner/action.go (L163)After a few jumps, you can see that results in this call:
github.com/nektos/act@c241ecda31/pkg/container/host_environment.go (L284)which, given that we set the working directory to empty, will set the working directory to the HostEnvironment's Path, here:
github.com/nektos/act@c241ecda31/pkg/container/host_environment.go (L294)this field is initialized here:
github.com/nektos/act@c241ecda31/pkg/runner/run_context.go (L180)which we can see joins miscpath to that path "hostexecutor"
so pretty clearly, this is where we are getting this extra piece of path.
I'm just really confused about how this codepath could ever work. There is never any way the action stuff is going to be copied to a path with this hostexecutor thing in there.
I feel like maybethis maybeCopyToActionDir (
github.com/nektos/act@c241ecda31/pkg/runner/action.go (L155)) is sort of meant to take care of this, but if you look at all the relevant variables, its pretty clear that this is not going to happen.It seems like maybe the solution might be to appropriately set the working directory here:
github.com/nektos/act@c241ecda31/pkg/runner/action.go (L163)Describe issue
ffMain
Link to GitHub repository
No response
Workflow content
Relevant log output
Additional information
No response
@colonelpanic8 commented on GitHub (Sep 24, 2023):
Honestly, the easiest thing to do, might simply be to make sure that:
getContainerActionPaths
is returning an appropriate path for the host environment:
github.com/nektos/act@c241ecda31/pkg/runner/action.go (L413)@ChristopherHX commented on GitHub (Sep 24, 2023):
Sounds like a problem in gitea/act.
/act/actionsis not present here and not all maintainer of the fork fully understand what they change.The path is correct in act e.g.
act -P mylabel=-self-hostedwill behaveYou cannot configure it in any meaningful ways in nektos/act, must be part of gitea/act
@colonelpanic8 commented on GitHub (Sep 24, 2023):
Can you elaborate on why you think this?
Did you look at all the links that I posted?
It could happen to work in act, because act happens to set up certain directories to agree. That doesn't mean that the code is necessarily correct.
In particular, can you explain how this:
github.com/nektos/act@c241ecda31/pkg/runner/run_context.go (L180)makes any sense at all?
@ChristopherHX commented on GitHub (Sep 24, 2023):
@colonelpanic8 commented on GitHub (Sep 24, 2023):
In particular, this does not make any sense to me:
When we get the container actions path:
github.com/nektos/act@c241ecda31/pkg/runner/action.go (L422)we will ultimately set it to the result of a call to here:
github.com/nektos/act@c241ecda31/pkg/container/host_environment.go (L396)This is initialized here:
github.com/nektos/act@c241ecda31/pkg/runner/run_context.go (L176)and will be quite a different directory than what is used as the default working directory, which is here:
github.com/nektos/act@c241ecda31/pkg/runner/run_context.go (L180)@colonelpanic8 commented on GitHub (Sep 24, 2023):
sure, but then the way the working directory is set here:
github.com/nektos/act@c241ecda31/pkg/container/host_environment.go (L287)isn't going to work with the way we are trying to call the remote action here:
github.com/nektos/act@c241ecda31/pkg/runner/action.go (L163)I mean to me, its crystal clear why this is failing in my case.
@ChristopherHX commented on GitHub (Sep 24, 2023):
remote actions like checkout should not be copied to the default working directory. (actpath is /var/run/act for docker backend)
Doing so will override files of your repository.
Keep in mind that node shall be called with an absolute path, while your log shows a relative path and that cannot work
I use this code since Summer 2021 and it works without such issue.
Please look at the source code used by act_runner, it's not the same
@ChristopherHX commented on GitHub (Sep 24, 2023):
I can imagine that your
HOMEenv var is absent, my github-act-runner warns you about this and applies a hotfix@colonelpanic8 commented on GitHub (Sep 24, 2023):
well there we do at least agree. I still think something is obviously fundamentally wrong with this code, because its clearly written as though its possible to use relative paths!
very sloppy coding all around if you ask me.
@ChristopherHX commented on GitHub (Sep 25, 2023):
Non careful review by other members / missing test cases in a feature PR, you cannot expect old code to work with relative paths while it was impossible in the past.
The value was based on HOME, XDG_CACHE_HOME, filepath.Abs(".") and os.TempDir(). At this time a relative path was not expected.
Bug caused by
github.com/nektos/act@74c27db4dd(Look at the reviewer, I'm not listed)I prefer to use actions/runner with Gitea Actions (made a tool to allow that), act is too buggy
@ChristopherHX commented on GitHub (Sep 25, 2023):
Please follow the issue template, because you didn't provde how to reproduce this in nektos/act.
The following breaks
At the time hostenvironment has been added, you couldn't use a relative path.
@github-actions[bot] commented on GitHub (Mar 24, 2024):
Issue is stale and will be closed in 14 days unless there is new activity