Skip to content

Prepending PATH breaks the container environment if the image does not have PATH env #3210

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ueokande opened this issue Mar 16, 2024 · 2 comments
Labels
bug Something isn't working Stale

Comments

@ueokande
Copy link

Describe the bug

I have encountered an issue with using a openSUSE container. The job fails as it cannot execute any commands after prepending PATH by $GITHUB_PATH.

To Reproduce

Here is a minimal manifest to reproduce the issue:

my-job:
  runs-on: ubuntu-latest
  container: opensuse/leap
  steps:
    - run: id
    - run: echo "/tmp/.bin" >> $GITHUB_PATH
    - run: id

The job runs successfully for the Debian container (container: debian), but with the openSUSE container (container: opensuse/leap), it fails with the following error message:

OCI runtime exec failed: exec failed: unable to start container process: exec: "sh": executable file not found in $PATH: unknown

Expected behavior

Any commands after prepending PATH should run successfully.

Runner Version and Platform

It can reproduce the current GitHub-hosted runners.

  • Runner version: '2.314.1'
  • Runner's OS: Ubuntu 22.04.4 LTS (GitHub hosted runners ubuntu-latest)
  • Runner: ubuntu-22.04 20240310.1.0
  • Container: The latest openSUSE official image (opensuse/leap)

What's not working?

The GitHub Actions agent prepends the user-configured PATH in the $GITHUB_PATH with the container's PATH. The agent retrieves the current PATH by docker inspect (ref.). If the docker container has a PATH configuration, the agent joins the configured PATH in the $GITHUB_PATH with the container's PATH, and pass by the -e option on the docker exec command (ref). If the docker image doesn't have a PATH configuration, the agent pass just -e PATH=/tmp/.bin option. This causes an error because sh does not exist in the passed PATH.

We can see that the openSUSE container image does not have the PATH configuration according to the output of the command docker image inspect.

$ docker inspect debian --format "{{range .Config.Env}}{{println .}}{{end}}"
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
$ docker inspect opensuse/leap --format "{{range .Config.Env}}{{println .}}{{end}}"
(no output)

The job output:

Screenshot 2024-03-16 at 09-37-22 make minimal · ueokande_actions-add-path@6e88c6a

Copy link
Contributor

This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 15 days.

@github-actions github-actions bot added the Stale label Mar 17, 2025
Copy link
Contributor

github-actions bot commented Apr 7, 2025

This issue was closed because it has been stalled for 15 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

1 participant