question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

github.workspace and runner.workspace are incorrect inside container jobs

See original GitHub issue

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:

  1. 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"
  1. Check the value in the container job for ${{ github.workspace }} and $GITHUB_WORKSPACE which are not the same
  2. 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/testContainers

Runner 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.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:38
  • Comments:18 (2 by maintainers)

github_iconTop GitHub Comments

10reactions
fhammerlcommented, Aug 22, 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-workspace

5reactions
JulianGrocommented, May 10, 2023

One thing to note is that ${{runner.workspace}} inside the run part of the step, yields different results than ${{runner.workspace}} being inside the working-directory of a step.

In my case the working-directory will spit out a /__w/REPOSITORY/, while run will spit out a /home/ubuntu/actions-runner/_work/REPOSITORY/.

Read more comments on GitHub >

github_iconTop Results From Across the Web

allow overriding workdir for container jobs · Issue #878
In container jobs it makes no sense to mount the external directory, as all the job steps are executed within the container anyway....
Read more >
Containerized action workspace directories seems to be ...
I expected to be able to use the original workspace /home/runner/work/my-repo-name/my-repo-name directory string in custom situations. Runner ...
Read more >
GITHUB_WORKSPACE and github.workspace are different ...
I'm facing the same issue using containers. $ echo ${{ github.workspace }} /home/runner/work/<REPO_NAME>/<REPO_NAME> $ echo $GITHUB_WORKSPACE ...
Read more >
Overwriting $HOME causes container to behave differently ...
After container instantiation, the tool then looks back to ${HOME} to find it's dependencies. However, the GitHub Action Runner has overridden ...
Read more >
wrong directory is mounted in container workspace #5902
Steps: · Run VSCode and Use Open Folder in Container command to open reproduce\ChildDir\GrandChildDir . · Check container's /workspaces/ directory ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found