evryfs/github-actions-runner-operator

Can't run Jobs with JS & Docker Actions if they are interdependent

Closed this issue · 8 comments

If in my workflow, there are 2 types of Actions:

  • Javascript (which run directly on the runner pod, e.g. actions/checkout@v2)
  • Docker (which run using DinD on the docker pod, e.g. docker/build-push-action@v1.1.0)

And if these 2 Actions are interdependent, then I will get an error.

For example, the workflow that I have is more or less like this:

name: Build and push Docker image

on:
  push:
    branches:
      - master

jobs:
  build-push:
    name: build-push
    runs-on: self-hosted
    steps:
      - uses: actions/checkout@v2

      - name: Build and push Docker images
        uses: docker/build-push-action@v1.1.0
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}
          repository: your-repo/your-image
          tags: latest

the docker/build-push-action@v1.1.0 will fail because it cannot find the Dockerfiles that have been cloned by actions/checkout@v2. This error does not occur if using the hosted runner.

does this happen because of the runner and docker run in different containers? I use the manifest from the example here.

Is there a solution to this problem?

btw, thanks for this amazing operator 🍻

There are some known problems in this area:
actions/runner#406 and actions/runner#486 and I guess that is why: actions/runner#367 is not resolved either.
Also see actions/runner#560

What version of the runner are you using (not the operator, but the runner pods it spawns) - I
am for instance able to build docker images inside of the operator pod, and these Dockerfiles add files from the filesystem inside of the pod.

What version of the runner are you using (not the operator, but the runner pods it spawns)

the container uses this image, so I think the runner version is 2.263.0

Try tag 2.263.0-1 or higher (there was a new version yesterday). We changed the home-dir to match when running non-containerised, that could influence it. It is a bit strange that I can build docker-images but not you, but that might be because a context is sent to the docker daemon, while in your case it might be relying on bind-mounting something which is done from the host where docker runs.

updated to version2.267.0, but still getting the same error path or Dockerfile not found
actions-1
Screen Shot 2020-06-24 at 18 41 25

What happens if you build the image outside of the action and just use it to push?

@zackijack: BTW - what CNI are you using? calico? I wonder if this is the problem: projectcalico/calico#2334