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.1k stars 525 forks source link

400 Bad Request #1111

Closed ikaaasra closed 2 weeks ago

ikaaasra commented 1 month ago

Contributing guidelines

I've found a bug, and:

Description

docker/setup-buildx-action#20 exporting to image
docker/setup-buildx-action#20 exporting manifest sha256:35e18d8d4307852968643876c6b989f9b84fddacba4ca295188f25c7a26ffca5 done
docker/setup-buildx-action#20 exporting config sha256:794f12649df6de63a6738f3869bdabb14fd52fe2764e5d2aff3588628e6a0e33 done
docker/setup-buildx-action#20 exporting attestation manifest sha256:c6dca146f2990a48b1f8aae54b5748eeae0b6813f5edab5cf9b5ae8f8e81d1d1 done
docker/setup-buildx-action#20 exporting manifest list sha256:37b4dd0d4c6c614b1206ce37e51e26d26d99b20a49e15329797d74ffc766508c done
docker/setup-buildx-action#20 pushing layers 0.1s done
docker/setup-buildx-action#20 ERROR: failed to push ghcr.io/tenant:0.0.0: unexpected status from HEAD request to https://ghcr.io/v2/tenant/blobs/sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8: 400 Bad Request
------
 > exporting to image:
------
ERROR: failed to solve: failed to push ghcr.io/tenant:0.0.0: unexpected status from HEAD request to https://ghcr.io/v2/tenant/blobs/sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8: 400 Bad Request
Error: buildx failed with: ERROR: failed to solve: failed to push ghcr.io/tenant:0.0.0: unexpected status from HEAD request to https://ghcr.io/v2/tenant/blobs/sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8: 400 Bad Request

YAML workflow

- name: Set up QEMU
        uses: docker/setup-qemu-action@v3

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

      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          registry: ${{ vars.DOCKERHUB_REGISTRY }}
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_PASSWORD }}
ikaaasra commented 1 month ago

hello ... why before it is work but now it is not work

crazy-max commented 1 month ago
docker/setup-buildx-action#20 exporting to image
docker/setup-buildx-action#20 exporting manifest sha256:35e18d8d4307852968643876c6b989f9b84fddacba4ca295188f25c7a26ffca5 done
docker/setup-buildx-action#20 exporting config sha256:794f12649df6de63a6738f3869bdabb14fd52fe2764e5d2aff3588628e6a0e33 done
docker/setup-buildx-action#20 exporting attestation manifest sha256:c6dca146f2990a48b1f8aae54b5748eeae0b6813f5edab5cf9b5ae8f8e81d1d1 done
docker/setup-buildx-action#20 exporting manifest list sha256:37b4dd0d4c6c614b1206ce37e51e26d26d99b20a49e15329797d74ffc766508c done
docker/setup-buildx-action#20 pushing layers 0.1s done
docker/setup-buildx-action#20 ERROR: failed to push ghcr.io/tenant:0.0.0: unexpected status from HEAD request to https://ghcr.io/v2/tenant/blobs/sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8: 400 Bad Request
------
 > exporting to image:
------
ERROR: failed to solve: failed to push ghcr.io/tenant:0.0.0: unexpected status from HEAD request to https://ghcr.io/v2/tenant/blobs/sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8: 400 Bad Request
Error: buildx failed with: ERROR: failed to solve: failed to push ghcr.io/tenant:0.0.0: unexpected status from HEAD request to https://ghcr.io/v2/tenant/blobs/sha256:4abcf20661432fb2d719aaf90656f55c287f8ca915dc1c92ec14ff61e67fbaf8: 400 Bad Request

Looks like you open an issue on the wrong repo. Seems build related (either build-push-action or bake-action). Can you post the full workflow so I can move the issue to the right place?

ikaaasra commented 1 month ago

@crazy-max


  deploy:
    needs:
      - build
    if: github.event_name != 'pull_request'
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./packages/${{github.workflow}}
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3

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

      - name: Login to Docker Hub
        uses: docker/login-action@v3
        with:
          registry: ${{ vars.DOCKERHUB_REGISTRY }}
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_PASSWORD }}

      - name: Docker meta
        id: meta
        uses: docker/metadata-action@v5
        with:
          images: ${{ vars.DOCKERHUB_REGISTRY }}/${{github.workflow}}
          tags: |
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern={{version}}

      - name: Build and Push
        uses: docker/build-push-action@v5
        with:
          context: "{{defaultContext}}:packages/${{github.workflow}}"
          file: ./dockerfile
          push: ${{ github.event_name != 'pull_request' }}
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
crazy-max commented 1 month ago

Looking at the logs it tries to push ghcr.io/tenant:0.0.0 which doesn't sounds right as it's missing the repo name. Hence why you got a 400. Do you have a link to your repository if public or can you show full logs of the job?