mirror of
https://github.com/nektos/act.git
synced 2026-04-26 01:15:51 +03:00
[GH-ISSUE #896] Issue: Docker env PATH lost #533
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#533
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 @jayvdb on GitHub (Nov 21, 2021).
Original GitHub issue: https://github.com/nektos/act/issues/896
Originally assigned to: @catthehacker on GitHub.
System information
act: mediumactversion: master and 0.2.24Expected behaviour
I am running https://github.com/returntocorp/semgrep-action locally using
act, and its Dockerfile envPATHaddition of/root/.local/binis being disregarded, so that it can not find commands that are available when running the docker image directly.https://github.com/returntocorp/semgrep-action/issues/428 covers my initial analysis, showing that the PATH doesnt contain the necessary component, and oddly includes
/usr/games:/usr/local/games:/snap/bin- I cant find where those come from.Actual behaviour
The PATH is wrong.
Workflow and/or repository
https://github.com/jayvdb/dns-cache/blob/master/.github/workflows/semgrep.yml
Note this is the default semgrep GitHub action yml, and I've verified this problem occurs on several repos.
Steps to reproduce
act -j semgrepactoutputLog
@jayvdb commented on GitHub (Nov 30, 2021):
This also effects https://github.com/SonarSource/sonarcloud-github-action
I tried https://github.com/catthehacker/act-fork/tree/vNext for semgrep and sonarcloud; both not working.
@nascit commented on GitHub (Jan 26, 2022):
I have the exact same issue. Has anyone found a workaround?
@jayvdb commented on GitHub (Jan 26, 2022):
My workaround is to add a layer which puts symlinks in /usr/bin
@CarloDePieri commented on GitHub (May 22, 2022):
This affects even SonarSource/sonarqube-scan-action.
I wanted to report that the workaround proposed by @jayvdb works in this case, too (sonarqube-scan-action patched fork).
@mottet commented on GitHub (Jan 10, 2023):
A simple workaround is to manually set the PATH in the env parameter of the step.
For sonarqube-scan-action:
You can find the expected PATH in env by inspecting the image with the command
docker inspect --format='{{json .Config.Env}}' IMAGE@vHanda commented on GitHub (Feb 8, 2023):
For others:
nodeinside the container as the PATH was incorrect.act -vto enable verbose modeexport PATH="VALUE_COPIED"Ideally, one should be setting the entire environment as it was left by the job, but that's a bit more work.
@ChristopherHX commented on GitHub (Feb 8, 2023):
@vHanda I assume this issue has been fixed with https://github.com/nektos/act/pull/1503
Could you try to use the master branch of act and test if you are still facing issues?
Test binaries of the master branch can be found here: https://github.com/nektos/act/actions/runs/4126476541
@scottjasso commented on GitHub (Apr 18, 2023):
@ChristopherHX this is still an issue for me on 0.2.44.
Just running an action that prints $PATH gives:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binWhereas in the runner image, $PATH is something like:
/usr/local/custom/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binThis prevents me from running any commands that are preinstalled in my image.
@ChristopherHX commented on GitHub (Apr 18, 2023):
@scottjasso
I don't know how you came to the conclusion can you help me to understand your specfic problem?
Running this docker action (Dockerfile action)
OUTPUTS
Remember only environment variables defined by
ENV KEY VALUEin a Dockerfile are loaded. I removed the code to load/etc/environment.@scottjasso commented on GitHub (Apr 18, 2023):
Ahh, I see. Our PATH is set in
/etc/environment, not via docker ENV.@glimchb commented on GitHub (Jul 10, 2024):
@ChristopherHX can i add to a path from act cmdline via —env ?