Repository navigation
Description
Describe the bug
github.Workspace and runner.Workspace don't point to container valid paths when executing inside a container job.
The values are also inconsistent with the values for env variables GITHUB_WORKSPACE and RUNNER_WORKSPACE (both contain a valid path.
To Reproduce
Steps to reproduce the behavior:
- Create a workflow with the following jobs
jobs:
runner:
runs-on: ubuntu-latest
steps:
- name: dump
run: |
echo 'github.workspace === ${{ github.workspace }}'
echo "GITHUB_WORKSPACE === $GITHUB_WORKSPACE"
echo 'runner.workspace === ${{ runner.workspace }}'
echo "RUNNER_WORKSPACE === $RUNNER_WORKSPACE"
container:
runs-on: ubuntu-latest
container:
image: node:14.16
steps:
- name: dump
run: |
echo 'github.workspace === ${{ github.workspace }}'
echo "GITHUB_WORKSPACE === $GITHUB_WORKSPACE"
echo 'runner.workspace === ${{ runner.workspace }}'
echo "RUNNER_WORKSPACE === $RUNNER_WORKSPACE"- Check the value in the container job for ${{ github.workspace }} and $GITHUB_WORKSPACE which are not the same
- Check the value in the container job for ${{ runner.workspace }} and $RUNNER_WORKSPACE which are not the same
Expected behavior
On the container job github.workspaceand runner.workspace should point to a path in the directory /__w
Runner Version and Platform
Version of your runner? 2.295.0
OS of the machine running the runner? ubuntu 20.04.4 (ubuntu-latest)
What's not working?
The values for github.workspace and runner.workspace are incorrect in the container job (and inconsistent with respective env variables)
Job Log Output
If applicable, include the relevant part of the job / step log output here. All sensitive information should already be masked out, but please double-check before pasting here.
Output of container dump step in the container job
github.workspace === /home/runner/work/testContainers/testContainers
GITHUB_WORKSPACE === /__w/testContainers/testContainers
runner.workspace === /home/runner/work/testContainers
RUNNER_WORKSPACE === /__w/testContainersRunner and Worker's Diagnostic Logs
If applicable, add relevant diagnostic log information. Logs are located in the runner's _diag folder. The runner logs are prefixed with Runner_ and the worker logs are prefixed with Worker_. Each job run correlates to a worker log. All sensitive information should already be masked out, but please double-check before pasting here.
Activity
fhammerl commentedon Aug 17, 2022
Hi @tspascoal,
Thanks for reporting this issue. We've investigated this issue before and are working on resolving it 👍
2022-08-22 Update: Correctly translating github.workspace causes some regressions, considering introducing
github.host-workspacenqb commentedon Sep 21, 2022
Hello @fhammerl,
Did you make any progress on this issue ?
use relative paths to avoid incorrect contaxt values in containers (a…
wesbrownfavor commentedon Oct 17, 2022
Has anyone figured out a workaround for this?
$GITHUB_WORKSPACE FTW
DmitriyBobrovskiy commentedon Nov 9, 2022
We've started experiencing same issues since we moved to running jobs inside containers and what was the most interesting is the fact that we used in all cases
${{ github.workspace }}variable. Our pipeline looked like this:And
$outputFolderlooked like this/__w/<project_name>/<project_name>/<env.ARTIFACT>/src/SomeProject.But still in
Publish artifactsstep we were getting error:Then we changed workflow to this to overcome this problem and it started working:
Now paths in both steps look similar:
/__w/<project_name>/<project_name>/<env.ARTIFACT>/src.So in short we saved
$GITHUB_WORKSPACEto environment variables and started using it instead of${{ github.workspace }}. Maybe we don't even need to save it and can just use it out of the box, didn't try this.Change to ${{ env.GITHUB_WORKSPACE }}
woutersf commentedon Dec 21, 2022
I started using Artifacts.
In the first Job 1: push file to Artifact
In the second Job, download the file in order to use it.
After all other tasks: Delete the artifact, we dont want to keep it outside of the job run
The infra people at our organisation wanted the workers to be ephermeral and not link in storage.
The "workaround" with the arifacts actually works quite well.
Actions need to be merged to test, so isolate testing them into a bes…
Actions need to be merged to test, so isolate testing them into a bes…
Actions need to be merged to test, so isolate testing them into a bes…
79 remaining items
CI: Fix release packaging inside the Linux container job
alexrecuenco-hf commentedon Aug 21, 2026
This is a bug in the runner-container-hooks I believe, it transfers the entire environment from the parent job
The workaround I found to work best is to set the environment variables in
envand use them inside the job (which is also better)This would make the action work for both container mode and non-container mode in my testing.
It requires the upstream actions to change to make themselves compatible and work around this bug
Try GITHUB_WORKSPACE to work around actions/runner#2058
Try GITHUB_WORKSPACE to work around actions/runner#2058
ci(gazer): drop redundant container options: --user 1000:1000
ci(gazer): run job containers as root, drop to appuser per command (R14)
Upload the Playwright report from the path the container actually has
Upload the Playwright report from the path the container actually has
Upload the Playwright report from the path the container actually has
Upload the Playwright report from the path the container actually has
Upload the Playwright report from the path the container actually has
Browser tests never run: the system-dep retry cannot win (#1243)
Fix clang-format CI job (#5598)
Fix CUDA CI nvcc_wrapper path inside container
ci(python): Set CARGO_TARGET_DIR from the shell in the container job