Skip to content
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

Incorrect context paths in conteiner #965

Closed
rosik opened this issue Feb 4, 2021 · 4 comments
Closed

Incorrect context paths in conteiner #965

rosik opened this issue Feb 4, 2021 · 4 comments
Assignees
Labels
bug Something isn't working needs-investigation

Comments

@rosik
Copy link

rosik commented Feb 4, 2021

Describe the bug

The context is filled wrong when a job runs inside container:

  • ${{ runner.temp }}
  • ${{ runner.tool_cache }}
  • ${{ github.action_path }}

All these variables report a path without respect to the docker environment.

To Reproduce

Here is the repo with a reproducer: https://github.com/rosik/ga-test-public/

jobs:
  bug-in-container:
    runs-on: ubuntu-20.04
    container:
      image: centos:7
    steps:
      - uses: actions/checkout@v2
      - uses: ./.github/actions/repro # prints ${{ github.action_path }}

      - run: echo runner.temp = ${{ runner.temp }}
      - run: ls -al ${{ runner.temp }} || true

      - run: echo runner.tool_cache = ${{ runner.tool_cache }}
      - run: ls -al ${{ runner.tool_cache }} || true

Actual output

image

Expected behavior

From logs, we can see the docker container is created as

 /usr/bin/docker create
 --name f5a8984beffb4a899f1f2715bfce01bf_centos7_c77d38
 --label 442333
 --workdir /__w/ga-test-public/ga-test-public
 --network github_network_7a20e69633be4acaaa53ae9145c97812 
 -e "HOME=/github/home"
 -e GITHUB_ACTIONS=true
 -e CI=true
 -v "/var/run/docker.sock":"/var/run/docker.sock"
 -v "/home/runner/work":"/__w"
 -v "/home/runner/runners/2.276.1/externals":"/__e":ro
 -v "/home/runner/work/_temp":"/__w/_temp"
 -v "/home/runner/work/_actions":"/__w/_actions"
 -v "/opt/hostedtoolcache":"/__t"
 -v "/home/runner/work/_temp/_github_home":"/github/home"
 -v "/home/runner/work/_temp/_github_workflow":"/github/workflow"
 --entrypoint "tail" centos:7 "-f" "/dev/null"

So I expect variables to be:

  • runner.temp == "/__w/_temp"
  • runner.tool_cache == "/__t"
  • github.action_path == "/__w/ga-test-public/ga-test-public/./.github/actions/repro"

Runner Version and Platform

Current runner version: '2.276.1'
Operating System
  Ubuntu
  20.04.2
  LTS
Virtual Environment
  Environment: ubuntu-20.04
  Version: 20210131.1
  Included Software: https://github.com/actions/virtual-environments/blob/ubuntu20/20210131.1/images/linux/Ubuntu2004-README.md
@rosik rosik added the bug Something isn't working label Feb 4, 2021
@rosik
Copy link
Author

rosik commented Feb 4, 2021

Extends #716

jcfr added a commit to jcfr/Slicer that referenced this issue Dec 1, 2021
This commit copies the package to GITHUB_WORKSPACE instead of RUNNER_TEMP. This
is required to workaround issue discussed in actions/runner#965 (Incorrect context
paths in container)

It also adds a step for uploading the generated Slicer package as an
artifact with a retention time of 1 day.
jcfr added a commit to Slicer/Slicer that referenced this issue Dec 1, 2021
This commit copies the package to GITHUB_WORKSPACE instead of RUNNER_TEMP. This
is required to workaround issue discussed in actions/runner#965 (Incorrect context
paths in container)

It also adds a step for uploading the generated Slicer package as an
artifact with a retention time of 1 day.
@nikola-jokic nikola-jokic self-assigned this Mar 25, 2022
@nikola-jokic
Copy link
Contributor

Hi @rosik,

There is a PR fixing this issue, and as you noted. I will close this issue now but thank you for providing a repro repository. I am leaving a screenshot as a preview to prove that the fix is working as intended. Thank you for submitting it. I would normally wait for the PR to be merged, but since we have a previous issue stating this, and you already mentioned it, it seems alright to me to close this one. We can find it easily if something is wrong.
image

Please, if you see any issue with this screenshot that I haven't seen, don't hesitate to notify me 😊

@rosik
Copy link
Author

rosik commented Apr 4, 2022

Yea, this is fine. And thanks for the fix!

@ncfavier
Copy link

It seems like runner.temp is handled inconsistently with containers, see actions/upload-pages-artifact#20 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs-investigation
Projects
None yet
Development

No branches or pull requests

4 participants