mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #451] Should not inherit container PATH from host PATH #316
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#316
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 @andersk on GitHub (Dec 17, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/451
On NixOS, running
act, say in theactrepository itself, eventually gives this error:This is because
PATHon NixOS does not have the usual/binand/usr/bindirectories. Runningenv PATH=/bin:/usr/bin actsucceeds, at least for this step. Adding arun: printenvstep confirms that anything I put in the hostPATHis inherited in the containerPATH.CI tests are supposed to be entirely self-contained, so they should not inherit any environment variables from the host, including
PATH.@andersk commented on GitHub (Dec 17, 2020):
Looks like this happens here:
github.com/nektos/act@e47a2395a5/pkg/runner/step_context.go (L96)@msxdan commented on GitHub (Dec 27, 2020):
....←[34m|←[0m dotnet-install: Installation finished successfully.←[34m[Bit CI/Build on Windows] ←[0m ⚙ ::add-path:: /github/home/.dotnet←[34m[Bit CI/Build on Windows] ←[0m ⚙ ::set-env:: DOTNET_ROOT=/github/home/.dotnet←[34m|←[0m /github/home/.dotnet:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin←[34m[Bit CI/Build on Windows] ←[0m ❓ ##[add-matcher]/actions/actions-setup-dotnet@v1/.github/csc.json←[34m[Bit CI/Build on Windows] ←[0m ✅ Success - Install .NET Core←[34m[Bit CI/Build on Windows] ←[0m⭐ Run Install Dependencies←[34m|←[0m OCI runtime exec failed: exec failed: container_linux.go:370: starting container process caused: exec: "bash": executable file not found in $PATH: unknown←[34m[Bit CI/Build on Windows] ←[0m ❌ Failure - Install DependenciesError: exit withFAILURE: 126Kinda anoying on Windows, is there any fix?
@catthehacker commented on GitHub (Dec 31, 2020):
Currently the only workaround I can think of for that is to use hardcoded default
$PATH(which is applied here: https://github.com/CatTheHacker/act/tree/env-path-fix) inactor define$PATHyourself in your workflow.Permanent fix would have to attach to destination container, extract the
$PATHunder user scope that will run the command and apply it for next command run.os.PathListSeparatoralso should not be used, since it if used on Windows running Linux container,$PATHwill be separated with;instead of:and vice versa.github.com/nektos/act@3f3de6e0b1/pkg/runner/step_context.go (L95-L98)@nickray commented on GitHub (Jan 5, 2021):
This surprising error occurs also on Arch Linux (and the same hack
env PATH=/bin:/usr/bin actfixes, but why should host PATH have anything to do with the container?)@catthehacker commented on GitHub (Jan 5, 2021):
Because it's a bit tricky to obtain
PATHfrom container/image. Much easier (and breaking) solution was to copyPATHfrom host.@andersk commented on GitHub (Jan 5, 2021):
It can be found in
docker image inspect. (I assume there’s some equivalent in the Go API.)@catthehacker commented on GitHub (Jan 5, 2021):
@andersk It's a start, but it should not rely on
PATHin image manifest. The correct way to obtainPATHis to execute login shell as a user that will run command and grabPATHfromenv.I have yet to find a nice clean way to do that in
act.@hellt commented on GitHub (Jan 6, 2021):
happened to me on Centos linux as well
the workaround worked