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

Project directory is not mount inside act container #555

Closed
rockandska opened this issue Mar 6, 2021 · 3 comments
Closed

Project directory is not mount inside act container #555

rockandska opened this issue Mar 6, 2021 · 3 comments
Labels
kind/bug Something isn't working

Comments

@rockandska
Copy link
Contributor

Act version

act version 0.2.20

Description

Since the act container mount the host docker socket instead of using DinD, tests who use docker and mount project dir as itself (docker run -v $(pwd):$(pwd) example-tests) fail because /github/workspace doesn't exist on the host side.

Expected behaviour

$ act 2> /dev/null
[Tests/docker-test] 🚀  Start image=nektos/act-environments-ubuntu:18.04
[Tests/docker-test]   🐳  docker run image=nektos/act-environments-ubuntu:18.04 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Tests/docker-test]   🐳  docker cp src=/tmp/act-test/. dst=/github/workspace
[Tests/docker-test] ⭐  Run actions/checkout@v2
[Tests/docker-test]   ✅  Success - actions/checkout@v2
[Tests/docker-test] ⭐  Run show workflow
| name: Tests
| on: [push, pull_request]
| jobs:
|   docker-test:
|     runs-on: ubuntu-18.04
|     steps:
|       - uses: actions/checkout@v2
|       - name: show workflow
|         run: cat $(pwd)/.github/workflows/test.yml
|       - name: show workflow in docker
|         run: docker run -v $(pwd):$(pwd) bash:3.2.57 cat $(pwd)/.github/workflows/test.yml
[Tests/docker-test]   ✅  Success - show workflow
[Tests/docker-test] ⭐  Run show workflow in docker
| name: Tests
| on: [push, pull_request]
| jobs:
|   docker-test:
|     runs-on: ubuntu-18.04
|     steps:
|       - uses: actions/checkout@v2
|       - name: show workflow
|         run: cat $(pwd)/.github/workflows/test.yml
|       - name: show workflow in docker
|         run: docker run -v $(pwd):$(pwd) bash:3.2.57 cat $(pwd)/.github/workflows/test.yml
[Tests/docker-test]   ✅  Success - show workflow in docker

Actual behaviour

$ act 2> /dev/null
[Tests/docker-test] 🚀  Start image=nektos/act-environments-ubuntu:18.04
[Tests/docker-test]   🐳  docker run image=nektos/act-environments-ubuntu:18.04 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Tests/docker-test]   🐳  docker cp src=/tmp/act-test/. dst=/github/workspace
[Tests/docker-test] ⭐  Run actions/checkout@v2
[Tests/docker-test]   ✅  Success - actions/checkout@v2
[Tests/docker-test] ⭐  Run show workflow
| name: Tests
| on: [push, pull_request]
| jobs:
|   docker-test:
|     runs-on: ubuntu-18.04
|     steps:
|       - uses: actions/checkout@v2
|       - name: show workflow
|         run: cat $(pwd)/.github/workflows/test.yml
|       - name: show workflow in docker
|         run: docker run -v $(pwd):$(pwd) bash:3.2.57 cat $(pwd)/.github/workflows/test.yml
[Tests/docker-test]   ✅  Success - show workflow
[Tests/docker-test] ⭐  Run show workflow in docker
| cat: can't open '/github/workspace/.github/workflows/test.yml': No such file or directory
[Tests/docker-test]   ❌  Failure - show workflow in docker

Workflow and/or repository

workflow
name: Tests
on: [push, pull_request]
jobs:
  docker-test:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: show workflow
        run: cat $(pwd)/.github/workflows/test.yml
      - name: show workflow in docker
        run: docker run -v $(pwd):$(pwd) bash:3.2.57 cat $(pwd)/.github/workflows/test.yml

Steps to reproduce

$ mkdir -p /tmp/act-test/.github/workflows
$ cd !$
$ cat > test.yml
name: Tests
on: [push, pull_request]
jobs:
  docker-test:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - name: show workflow
        run: cat $(pwd)/.github/workflows/test.yml
      - name: show workflow in docker
        run: docker run -v $(pwd):$(pwd) bash:3.2.57 cat $(pwd)/.github/workflows/test.yml
$ cd ../..
$ git init
$ act

act output

Log
DEBU[0000] Loading environment from /tmp/act-test/.env  
DEBU[0000] Loading secrets from /tmp/act-test/.secrets  
DEBU[0000] Loading workflows from '/tmp/act-test/.github/workflows' 
DEBU[0000] Reading workflow '/tmp/act-test/.github/workflows/test.yml' 
DEBU[0000] Planning event: push                         
DEBU[0000] Loading slug from git directory '/tmp/act-test/.git' 
DEBU[0000] Loading revision from git directory '/tmp/act-test/.git' 
DEBU[0000] context env => map[ACT:true]                 
[Tests/docker-test] 🚀  Start image=nektos/act-environments-ubuntu:18.04
DEBU[0000] Loading slug from git directory '/tmp/act-test/.git' 
DEBU[0000] Loading revision from git directory '/tmp/act-test/.git' 
[Tests/docker-test]   🐳  docker pull nektos/act-environments-ubuntu:18.04
DEBU[0001] Image exists? true                           
[Tests/docker-test] Removed container: c51071c27b89ab25f74ddfb370a91cdd86f1886d83f7776f0cb6586822585995
[Tests/docker-test]   🐳  docker volume rm act-Tests-docker-test
[Tests/docker-test]   🐳  docker create image=nektos/act-environments-ubuntu:18.04 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Tests/docker-test] Created container name=act-Tests-docker-test id=3d5c9b92465dce3c38e0cd7d5488ab08d063691efc2d2db657f4893d53a2225d from image nektos/act-environments-ubuntu:18.04
[Tests/docker-test] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_TEMP=/tmp]
[Tests/docker-test]   🐳  docker run image=nektos/act-environments-ubuntu:18.04 entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Tests/docker-test] Starting container: 3d5c9b92465dce3c38e0cd7d5488ab08d063691efc2d2db657f4893d53a2225d
[Tests/docker-test] Started container: 3d5c9b92465dce3c38e0cd7d5488ab08d063691efc2d2db657f4893d53a2225d
[Tests/docker-test]   🐳  docker cp src=/tmp/act-test/. dst=/github/workspace
[Tests/docker-test] Exec command '[mkdir -p /github/workspace]'
DEBU[0002] Writing tarball /tmp/act819143712 from /tmp/act-test/. 
DEBU[0002] Stripping prefix:/tmp/act-test/ src:/tmp/act-test/. 
[Tests/docker-test] Extracting content from '/tmp/act819143712' to '/github/workspace'
DEBU[0002] Writing entry to tarball workflow/event.json len:2 
DEBU[0002] Writing entry to tarball workflow/envs.txt len:0 
DEBU[0002] Writing entry to tarball home/.act len:0     
[Tests/docker-test] Extracting content to '/github/'
DEBU[0002] Loading slug from git directory '/tmp/act-test/.git' 
DEBU[0002] Loading revision from git directory '/tmp/act-test/.git' 
DEBU[0003] Loading slug from git directory '/tmp/act-test/.git' 
DEBU[0003] Loading revision from git directory '/tmp/act-test/.git' 
DEBU[0003] context env => map[ACT:true]                 
DEBU[0003] context env => map[ACT:true CI:true GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_ENV:/github/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_REF: GITHUB_REPOSITORY: GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA: GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home] 
DEBU[0003] setupEnv: map[ACT:true CI:true GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_ENV:/github/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_REF: GITHUB_REPOSITORY: GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA: GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home] 
[Tests/docker-test] ⭐  Run actions/checkout@v2
DEBU[0003] Loading slug from git directory '/tmp/act-test/.git' 
DEBU[0003] Loading revision from git directory '/tmp/act-test/.git' 
[Tests/docker-test] Skipping actions/checkout
[Tests/docker-test]   ✅  Success - actions/checkout@v2
DEBU[0003] Loading slug from git directory '/tmp/act-test/.git' 
DEBU[0003] Loading revision from git directory '/tmp/act-test/.git' 
DEBU[0003] Loading slug from git directory '/tmp/act-test/.git' 
DEBU[0003] Loading revision from git directory '/tmp/act-test/.git' 
DEBU[0003] context env => map[ACT:true]                 
DEBU[0003] context env => map[ACT:true CI:true GITHUB_ACTION:1 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_ENV:/github/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_REF: GITHUB_REPOSITORY: GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA: GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home] 
DEBU[0003] setupEnv: map[ACT:true CI:true GITHUB_ACTION:1 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_ENV:/github/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_REF: GITHUB_REPOSITORY: GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA: GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home] 
[Tests/docker-test] ⭐  Run show workflow
DEBU[0003] Wrote command 'cat $(pwd)/.github/workflows/test.yml' to 'workflow/1' 
DEBU[0003] Writing entry to tarball workflow/1 len:37   
[Tests/docker-test] Extracting content to '/github/'
[Tests/docker-test] Exec command '[bash --noprofile --norc -eo pipefail /github/workflow/1]'
| name: Tests
| on: [push, pull_request]
| jobs:
|   docker-test:
|     runs-on: ubuntu-18.04
|     steps:
|       - uses: actions/checkout@v2
|       - name: show workflow
|         run: cat $(pwd)/.github/workflows/test.yml
|       - name: show workflow in docker
|         run: docker run -v $(pwd):$(pwd) bash:3.2.57 cat $(pwd)/.github/workflows/test.yml
[Tests/docker-test]   ✅  Success - show workflow
DEBU[0003] Loading slug from git directory '/tmp/act-test/.git' 
DEBU[0003] Loading revision from git directory '/tmp/act-test/.git' 
DEBU[0004] Loading slug from git directory '/tmp/act-test/.git' 
DEBU[0004] Loading revision from git directory '/tmp/act-test/.git' 
DEBU[0004] context env => map[ACT:true]                 
DEBU[0004] context env => map[ACT:true CI:true GITHUB_ACTION:2 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_ENV:/github/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_REF: GITHUB_REPOSITORY: GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA: GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home] 
DEBU[0004] setupEnv: map[ACT:true CI:true GITHUB_ACTION:2 GITHUB_ACTIONS:true GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_ENV:/github/workflow/envs.txt GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/github/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_REF: GITHUB_REPOSITORY: GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA: GITHUB_TOKEN: GITHUB_WORKFLOW:Tests GITHUB_WORKSPACE:/github/workspace HOME:/github/home] 
[Tests/docker-test] ⭐  Run show workflow in docker
DEBU[0004] Wrote command 'docker run -v $(pwd):$(pwd) bash:3.2.57 cat $(pwd)/.github/workflows/test.yml' to 'workflow/2' 
DEBU[0004] Writing entry to tarball workflow/2 len:77   
[Tests/docker-test] Extracting content to '/github/'
[Tests/docker-test] Exec command '[bash --noprofile --norc -eo pipefail /github/workflow/2]'
| cat: can't open '/github/workspace/.github/workflows/test.yml': No such file or directory
[Tests/docker-test]   ❌  Failure - show workflow in docker
DEBU[0005] exit with `FAILURE`: 1                       
Error: exit with `FAILURE`: 1

Suggestions

Mount the project dir in act container too
docker run -v $(pwd):$(pwd) -v $(pwd):/github/worksdpace nektos/act-environments-ubuntu:18.04

@rockandska rockandska added the kind/bug Something isn't working label Mar 6, 2021
@catthehacker
Copy link
Member

Duplicate #551, #410

@catthehacker
Copy link
Member

@rockandska I guess that this issue is fixed as #567 has been merged?

@rockandska
Copy link
Contributor Author

Sorry @catthehacker , did not link this issue with the PR.

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

No branches or pull requests

2 participants