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

RUNNER_TEMP not mounted in docker based actions #1984

Open
jnystad opened this issue Jul 7, 2022 · 13 comments
Open

RUNNER_TEMP not mounted in docker based actions #1984

jnystad opened this issue Jul 7, 2022 · 13 comments
Assignees
Labels
bug Something isn't working Runner Bug Bug fix scope to the runner

Comments

@jnystad
Copy link

jnystad commented Jul 7, 2022

Env var RUNNER_TEMP points to /home/runner/work/_temp but this directory is not mounted on docker based actions. Contents from previous job steps that are output to this directory is therefore not available. An example is Azure/aks-set-context which stores the resulting kubeconfig in kubeconfig_[timestamp] directly under RUNNER_TEMP. This kubeconfig is therefore not available in docker actions.

Steps to reproduce the behavior:

  1. Use Azure/aks-set-context
  2. Use a docker action relying on kubeconfig

Expected behavior
Docker action should have the RUNNER_TEMP directory mounted at the same path.

Runner Version and Platform

Current runner version: '2.294.0'
Operating System
Ubuntu
20.04.4
LTS

What's not working?

"kubectl" config use-context my-context
W0707 12:34:48.857696 29 loader.go:221] Config not found: /home/runner/work/_temp/kubeconfig_1657197285854

@jnystad jnystad added the bug Something isn't working label Jul 7, 2022
@nikola-jokic
Copy link
Contributor

Hi @jnystad,

Thank you for submitting this issue! The feature flag for translating paths is currently off. There was an issue with translating paths for some actions, so we turned off the feature flag until we figure out the best way to translate those inputs. After we finalize the fix, I think that this issue will be resolved ☺️

@nikola-jokic nikola-jokic added the Runner Bug Bug fix scope to the runner label Jul 7, 2022
@nikola-jokic nikola-jokic self-assigned this Jul 7, 2022
@jnystad
Copy link
Author

jnystad commented Jul 7, 2022

Perhaps, but I fail to see the _temp root directory mapped or mounted anywhere. Also, docker actions mount ${RUNNER_TEMP}/_github_home as /github/home, while $HOME in other actions are /home/runner. This is also not mapped, as far as I can tell.

Is this intentional? I'm sure what Azure does may not be recommended, but if it's expected to work across docker and non-docker actions, it should probably be consistent.

@chancez
Copy link

chancez commented Mar 1, 2023

I also have the problem that a javascript action I'm using writes into /home/runnner/.config but my own docker based action doesn't mount that at all. Even if it was mounted somewhere else and the location was exported as a different env-var that would help.

@gerwinjansen
Copy link

I would like to transfer a test result file from one workflow step to another. I found ${{ runner.temp }} in the Github documentation.

The test result publisher is a docker-based action. I combined this with the above example:

- name: Publish test results
  uses: EnricoMi/publish-unit-test-result-action@v2
  if: always()
  id: test-results
  with:
    files: "${{ runner.temp }}/TestResults/*.trx"

But it results in Warning: Could not find any files for /opt/actions-runner/_work/_temp/TestResults/*.trx

When I replace ${{ runner.temp }} with ${{ github.workspace }} in both test runner and publisher, it works.
So the official documentation seems broken for docker-based actions...

@nikola-jokic: what is the status of the translating paths issue? Do you have a link to the issue so I can watch it?

@nikola-jokic
Copy link
Contributor

nikola-jokic commented Jul 13, 2023

Hey @gerwinjansen,

If the github.workspace works and the runner.temp doesn't, I assume the translation is correct. Can you please provide an example workflow, so I can reproduce the issue?

The PR for translation is: #2517, but it is merged and part of the latest release

@gerwinjansen
Copy link

Hi @nikola-jokic,

Here is the reproduce: https://github.com/gerwinjansen/runner-temp-not-mounted-on-docker-based-action
The workflow steps:

- name: Run unit tests
  run: cp ${{ github.workspace }}/example.trx ${{ runner.temp }}/example.trx

- name: Publish test results
  uses: EnricoMi/publish-unit-test-result-action@v2
  with:
    files: "${{ runner.temp }}/example.trx"

And the relevant console output

Run cp /home/runner/work/runner-temp-not-mounted-on-docker-based-action/runner-temp-not-mounted-on-docker-based-action/example.trx /home/runner/work/_temp/example.trx

[command]/usr/bin/docker run --name ghcri...... <removed for brevity>
  -e "RUNNER_TEMP"
  -v "/var/run/docker.sock":"/var/run/docker.sock"
  -v "/home/runner/work/_temp/_github_home":"/github/home"
  -v "/home/runner/work/_temp/_github_workflow":"/github/workflow"
  -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands"
  -v "/home/runner/work/runner-temp-not-mounted-on-docker-based-action/runner-temp-not-mounted-on-docker-based-action":"/github/workspace"

##[warning]Could not find any files for /home/runner/work/_temp/example.trx

Looks like the volume mount for runner.temp is missing.

@nwalfield
Copy link

As a workaround for this, I copy the files that I need to /home/runner/work/_temp/_github_home, which is mounted as /github/home in the docker container.

@gerwinjansen
Copy link

@nikola-jokic : did the reproduction above help you analyze the issue?

@backdround
Copy link

As a workaround for now, use:

  • /home/runner/work/_temp/_github_home in your steps
  • /github/home in the docker container

⚠️ Warning: If you are using docker for your job then use /github/home everywhere!

Thanks @nwalfield

@gerwinjansen
Copy link

@nikola-jokic : did the reproduction above help you analyze the issue?

@artificial-aidan
Copy link

artificial-aidan commented Nov 15, 2023

As a workaround for now, use:

  • /runner/_work/_temp/_github_home in your steps
  • /github/home in the docker container

⚠️ Warning: If you are using docker for your job then use /github/home everywhere!

Thanks @nwalfield

Small correction.

I also had to make the _github_home directory. But maybe that's because it was a hosted runner?

@artificial-aidan
Copy link

It seems to just be a problem with runner.temp not being mounted into the container.

Simple action:

      - uses: docker://ubuntu:latest
        with:
          entrypoint: /bin/bash
          args: -c "echo /github/home/ && ls -al /github/home/"

Command that runs:

/usr/local/bin/docker run --name ubuntulatest_8f7ed3 --label 865e75 --workdir /github/workspace --rm -e "CI_REG" -e "GH_REG" -e "DOCKER_REG" -e "DOCKER_BUILDKIT" -e "IMG_NAME" -e "DOCKER_METADATA_OUTPUT_VERSION" -e "DOCKER_METADATA_OUTPUT_TAGS" -e "DOCKER_METADATA_OUTPUT_LABELS" -e "DOCKER_METADATA_OUTPUT_JSON" -e "DOCKER_METADATA_OUTPUT_BAKE_FILE" -e "INPUT_ENTRYPOINT" -e "INPUT_ARGS" -e "HOME" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_REPOSITORY_OWNER_ID" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_REPOSITORY_ID" -e "GITHUB_ACTOR_ID" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKFLOW_REF" -e "GITHUB_WORKFLOW_SHA" -e "GITHUB_WORKSPACE" -e "GITHUB_EVENT_PATH" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "GITHUB_STATE" -e "GITHUB_OUTPUT" -e "GITHUB_ACTION" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_ENVIRONMENT" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e "ACTIONS_RESULTS_URL" -e GITHUB_ACTIONS=true -e CI=true --entrypoint "/bin/bash" -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/runner/_work/_temp/_github_home":"/github/home" -v "/runner/_work/_temp/_github_workflow":"/github/workflow" -v "/runner/_work/_temp/_runner_file_commands":"/github/file_commands" -v "/runner/_work/***/***":"/github/workspace" ubuntu:latest -c "echo /github/home/ && ls -al /github/home/"

Temp folder isn't mounted.

@tuxillo
Copy link

tuxillo commented Dec 11, 2024

Should we still use the workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Runner Bug Bug fix scope to the runner
Projects
None yet
Development

No branches or pull requests

8 participants