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

Docker env HOME passed into container gets overridden by the runner #1525

Closed
ntindle opened this issue Dec 2, 2021 · 2 comments
Closed

Docker env HOME passed into container gets overridden by the runner #1525

ntindle opened this issue Dec 2, 2021 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@ntindle
Copy link

ntindle commented Dec 2, 2021

Describe the bug
If the HOME environment variable is passed into a container, it is not respected.

This seems to be due to line 176 of src/Runner.Worker/Handlers/ContainerActionHandler.cs and line 261 of src/Runner.Worker/ContainerOperationProvider.cs

To Reproduce
Steps to reproduce the behavior:

  1. Setup an action with the following (sorry it uses our container, it is just what I had on hand)
name: build
on: pull_request

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      options: --entrypoint /bin/bash --user 0 -e "HOME=/root"
      image: ghcr.io/algorithm-archivists/aaa-langs:latest
    defaults:
      run:
        shell: bash --rcfile /root/.bashrc -eo pipefail {0} 
    steps:
      - name: Redefine what home is
        run: | 
          printenv
          export HOME=/root
          printenv

Note: specifying the env on the step, container, or job all result in degraded experiences of some sort due to the steps trying to load a docker config file from /github/home

Expected behavior
I would expect my version of HOME to override any preconfigured HOME variables that GitHub set.

Runner Version and Platform

GitHub Hosted Linux running a container

What's not working?

Please include error messages and screenshots.

See below for detailed output, but the HOME variable isn't being respected as a parameter to the docker options, it is instead being passed twice

/usr/bin/docker create --name c80303d90bfb4944910c3865606bf91f_ghcrioalgorithmarchivistsaaalangslatest_bf6020 --label 905b62 --workdir /__w/algorithm-archive/algorithm-archive --network github_network_b65b55475c064fe78e99de40111f6602 --entrypoint /bin/bash --user 0 -e "HOME=/root" -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.285.0/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" ghcr.io/algorithm-archivists/aaa-langs:latest "-f" "/dev/null"

Note the -e "HOME=/root" -e "HOME=/github/home"

Job Log Output

Three things were run in the script:

  • printenv
  • export HOME=/root
  • printenv
Run printenv
  printenv
  export HOME=/root
  printenv
  shell: bash --rcfile /root/.bashrc -eo pipefail {0}
GITHUB_WORKSPACE=/__w/algorithm-archive/algorithm-archive
HOSTNAME=e62d9841ca3e
GITHUB_PATH=/__w/_temp/_runner_file_commands/add_path_a10e7d4f-6dc7-482a-82e4-6bd59b5e65db
GITHUB_ACTION=__run
GITHUB_RUN_NUMBER=411
RUNNER_NAME=Hosted Agent
GITHUB_REF_TYPE=branch
***
GITHUB_ACTIONS=true
GITHUB_SHA=92b7608ab492cabc3b8e4817029c8ea8b15e5bbe
GITHUB_REF=refs/pull/959/merge
RUNNER_OS=Linux
GITHUB_REF_PROTECTED=false
HOME=/github/home
GITHUB_API_URL=https://api.github.com
RUNNER_ARCH=X64
RUNNER_TEMP=/__w/_temp
GITHUB_ENV=/__w/_temp/_runner_file_commands/set_env_a10e7d4f-6dc7-482a-82e4-6bd59b5e65db
GITHUB_EVENT_PATH=/github/workflow/event.json
GITHUB_EVENT_NAME=pull_request
GITHUB_RUN_ID=1529159072
GITHUB_ACTOR=ntindle
GITHUB_RUN_ATTEMPT=1
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
DLANG_VERSION=2.097.2
GITHUB_SERVER_URL=https://github.com
SHLVL=1
RUNNER_TOOL_CACHE=/__t
GITHUB_REF_NAME=959/merge
GITHUB_JOB=build
GITHUB_REPOSITORY=algorithm-archivists/algorithm-archive
GITHUB_RETENTION_DAYS=90
RUNNER_WORKSPACE=/__w/algorithm-archive
GITHUB_ACTION_REPOSITORY=
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:~/dlang/dmd-2.097.2/linux/bin64/:/usr/local/go/bin:~/kotlin/kotlinc/bin:~/lolcode/build:~/emojicode:~/factor/factor:~/swift/usr/bin:~/whitespace:~/elm:~/vlang/v
GITHUB_BASE_REF=main
CI=true
GITHUB_REPOSITORY_OWNER=algorithm-archivists
GITHUB_HEAD_REF=use-container-scons
GITHUB_ACTION_REF=
GITHUB_WORKFLOW=build
_=/usr/bin/printenv

GITHUB_WORKSPACE=/__w/algorithm-archive/algorithm-archive
HOSTNAME=e62d9841ca3e
GITHUB_PATH=/__w/_temp/_runner_file_commands/add_path_a10e7d4f-6dc7-482a-82e4-6bd59b5e65db
GITHUB_ACTION=__run
GITHUB_RUN_NUMBER=411
RUNNER_NAME=Hosted Agent
GITHUB_REF_TYPE=branch
***
GITHUB_ACTIONS=true
GITHUB_SHA=92b7608ab492cabc3b8e4817029c8ea8b15e5bbe
GITHUB_REF=refs/pull/959/merge
RUNNER_OS=Linux
GITHUB_REF_PROTECTED=false
HOME=/root
GITHUB_API_URL=https://api.github.com
RUNNER_ARCH=X64
RUNNER_TEMP=/__w/_temp
GITHUB_ENV=/__w/_temp/_runner_file_commands/set_env_a10e7d4f-6dc7-482a-82e4-6bd59b5e65db
GITHUB_EVENT_PATH=/github/workflow/event.json
GITHUB_EVENT_NAME=pull_request
GITHUB_RUN_ID=1529159072
GITHUB_ACTOR=ntindle
GITHUB_RUN_ATTEMPT=1
GITHUB_GRAPHQL_URL=https://api.github.com/graphql
DLANG_VERSION=2.097.2
GITHUB_SERVER_URL=https://github.com
SHLVL=1
RUNNER_TOOL_CACHE=/__t
GITHUB_REF_NAME=959/merge
GITHUB_JOB=build
GITHUB_REPOSITORY=algorithm-archivists/algorithm-archive
GITHUB_RETENTION_DAYS=90
RUNNER_WORKSPACE=/__w/algorithm-archive
GITHUB_ACTION_REPOSITORY=
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:~/dlang/dmd-2.097.2/linux/bin64/:/usr/local/go/bin:~/kotlin/kotlinc/bin:~/lolcode/build:~/emojicode:~/factor/factor:~/swift/usr/bin:~/whitespace:~/elm:~/vlang/v
GITHUB_BASE_REF=main
CI=true
GITHUB_REPOSITORY_OWNER=algorithm-archivists
GITHUB_HEAD_REF=use-container-scons
GITHUB_ACTION_REF=
GITHUB_WORKFLOW=build
_=/usr/bin/printenv

Runner and Worker's Diagnostic Logs

N/A?

@ntindle ntindle added the bug Something isn't working label Dec 2, 2021
ntindle added a commit to algorithm-archivists/algorithm-archive that referenced this issue Dec 2, 2021
this keeps tech debt in place. Consult actions/runner#1525 for fixes
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Dec 16, 2021
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: umarcor <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Dec 16, 2021
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: umarcor <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Dec 16, 2021
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: umarcor <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Dec 16, 2021
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: umarcor <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Dec 16, 2021
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: umarcor <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Dec 21, 2021
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: umarcor <[email protected]>
@andreineculau
Copy link

duplicate #863

@ruvceskistefan
Copy link
Contributor

Hi @ntindle,
Thanks for reported issue! Since the reported issue is a duplicate, I'll close this issue.
Thanks @andreineculau, I'm posting a link to the already opened issue here as well: #863

@ruvceskistefan ruvceskistefan self-assigned this Feb 7, 2022
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 8, 2022
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 9, 2022
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 9, 2022
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 9, 2022
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 16, 2022
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 20, 2022
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 21, 2022
…h in each job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 21, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 21, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 21, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 22, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Feb 23, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Mar 1, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Mar 15, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Mar 24, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Apr 7, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue May 16, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Jun 1, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Jun 1, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Aug 3, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Aug 3, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Aug 3, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Aug 3, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Aug 3, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Aug 3, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Aug 3, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
umarcor added a commit to umarcor/f4pga-examples that referenced this issue Aug 3, 2022
* Use GitHub Packages
* Use container in a step, instead of a container job

F4PGA_INSTALL_DIR changed to an absolute location due to actions/runner#1525

Signed-off-by: Unai Martinez-Corral <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants