docker / build-push-action

GitHub Action to build and push Docker images with Buildx
https://github.com/marketplace/actions/build-and-push-docker-images
Apache License 2.0
4.42k stars 561 forks source link

Failure to push when using multi-node context and `iidfile` #386

Closed Silex closed 2 years ago

Silex commented 3 years ago

Hello,

I found out that using this action triggers https://github.com/docker/buildx/issues/177, but what's surprising is that it seems to happen solely because of the iidfile argument

Here is the base of my action (the setup if you want):

jobs:
  docker:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      # (skip SSH setup)

      - name: Login to DockerHub
        uses: docker/login-action@v1
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Set up Docker Buildx
        id: buildx
        uses: docker/setup-buildx-action@v1

      - name: Add arm64 builder
        run: |
          docker buildx create --append --name ${{ steps.buildx.outputs.name }} ssh://root@${{ secrets.DOCKER_ARM_HOST }}
          docker buildx inspect --bootstrap ${{ steps.buildx.outputs.name }}

So at this point all is fine, the builders are ready to build & push the image.

What I found out is that this works:

      - name: Build OK
        run: |
          docker buildx build \
                 --platform="linux/amd64,linux/arm64" \
                 --pull \
                 --push \
                 --cache-from="silex/nix:latest" \
                 --cache-to="type=inline" \
                 --tag="silex/nix:latest" \
                 .

While this doesn't:

      - name: Build FAIL
        uses: docker/build-push-action@v2
        with:
          platforms: linux/amd64,linux/arm64
          pull: true
          push: true
          cache-from: '"silex/nix:latest"'
          cache-to: '"type=inline"'
          tags: '"silex/nix:latest"'
          context: .

The later calls /usr/bin/docker buildx build --tag silex/nix:latest --platform linux/amd64,linux/arm64 --iidfile /tmp/docker-build-push-thK9oA/iidfile --cache-from silex/nix:latest --cache-to type=inline --pull --push . and to me it's the same command as the one that is working except the iidfile argument.

The problem is the same as https://github.com/docker/buildx/issues/177, namely that only the manifest gets pushed:

2021-06-14T09:38:19.5871149Z #18 exporting to image
2021-06-14T09:38:19.5872494Z #18 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
2021-06-14T09:38:21.5384252Z #18 pushing layers 2.6s done
2021-06-14T09:38:21.5385698Z #18 pushing manifest for docker.io/***/nix
2021-06-14T09:38:21.8387450Z #18 pushing manifest for docker.io/***/nix 0.3s done
2021-06-14T09:38:21.8388416Z #18 DONE 2.9s
2021-06-14T09:38:21.8388876Z 
2021-06-14T09:38:21.8389597Z #20 exporting cache
2021-06-14T09:38:21.8390916Z #20 sha256:2700d4ef94dee473593c5c614b55b2dedcca7893909811a8f2b48291a1f581e4
2021-06-14T09:38:21.8392475Z #20 preparing build cache for export done
2021-06-14T09:38:21.8393319Z #20 DONE 0.0s
2021-06-14T09:38:56.9225722Z 
2021-06-14T09:38:56.9226882Z #18 exporting to image
2021-06-14T09:38:56.9228229Z #18 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
2021-06-14T09:38:56.9229651Z #18 exporting layers done
2021-06-14T09:38:56.9231264Z #18 exporting manifest sha256:6c8d5eb5a2509694fa82ea3b5eb91c32cd514269cc2b43ab8ba61b388f2e0ab7 0.0s done
2021-06-14T09:38:56.9233493Z #18 exporting config sha256:8180eb6196b4665a9e576a5d3b8ec44c7e10678533da557c1118b17c134c00f9 0.0s done
2021-06-14T09:38:56.9235768Z #18 exporting manifest list sha256:4c770cac7a186c7fe6f04b1d7f9fe1bf58327f2d2afe4e661a1f649f1443d7b5 0.0s done
2021-06-14T09:38:57.0734712Z #18 ...
2021-06-14T09:38:57.0735207Z 
2021-06-14T09:38:57.0737680Z #21 [auth] ***/nix:pull,push token for registry-1.docker.io
2021-06-14T09:38:57.0739430Z #21 sha256:b88a8a2bc5c887effc1ee722da463bd73e7ec889cdbb12ed68f607fb08ca7b09
2021-06-14T09:38:57.0740948Z #21 DONE 0.0s
2021-06-14T09:38:57.0741366Z 
2021-06-14T09:38:57.0742098Z #18 exporting to image
2021-06-14T09:38:57.0743456Z #18 sha256:e8c613e07b0b7ff33893b694f7759a10d42e180f2b4dc349fb57dc6b71dcab00
2021-06-14T09:38:57.0744808Z #18 pushing layers
2021-06-14T09:39:00.0756994Z #18 pushing layers 3.0s done
2021-06-14T09:39:00.0758576Z #18 pushing manifest for docker.io/***/nix
2021-06-14T09:39:00.3325520Z #18 pushing manifest for docker.io/***/nix 0.3s done
2021-06-14T09:39:00.3326352Z #18 DONE 3.5s
2021-06-14T09:39:00.3326711Z 
2021-06-14T09:39:00.3327391Z #20 exporting cache
2021-06-14T09:39:00.3328494Z #20 sha256:2700d4ef94dee473593c5c614b55b2dedcca7893909811a8f2b48291a1f581e4
2021-06-14T09:39:00.3329737Z #20 preparing build cache for export done
2021-06-14T09:39:00.3330472Z #20 DONE 0.0s
2021-06-14T09:39:00.3330845Z 
2021-06-14T09:39:00.3331642Z #22 merging manifest list ***/nix:latest
2021-06-14T09:39:00.3333081Z #22 sha256:d689a835a4adb23bb58496352ebd6f1cca3006d0630092032b0953eb125d5f35
2021-06-14T09:39:00.5019694Z #22 DONE 0.2s

So, is there a way to disable iidfile?

crazy-max commented 3 years ago

Might be linked to this piece of code. WDYT @tonistiigi?

Silex commented 3 years ago

@tonistiigi: friendly ping 😉

crazy-max commented 2 years ago

fixed in https://github.com/docker/buildx/pull/826