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.09k stars 526 forks source link

Build summary feature doesn't work with GitHub Enterprise Server #1154

Open ponkio-o opened 6 days ago

ponkio-o commented 6 days ago

Contributing guidelines

I've found a bug, and:

Description

Build Summary introduced in v6.0.0 doesn't work with GHES v3.11.7.

My guess is that it is because the artifact v2 library used internally does not support GHES.

@actions/artifact v2+, upload-artifact@v4+, and download-artifact@v4+ are not currently supported on GHES yet. The previous version of this package can be found at this tag and on npm.

Expected behaviour

Correctly working build summary.

Actual behaviour

The following error message on Post Build and push step.

Warning: Failed to get backend IDs: The provided JWT token is invalid and/or missing claims

Repository URL

No response

Workflow run URL

No response

YAML workflow

name: build test

on:
  pull_request:

env:
  ACTIONS_STEP_DEBUG: true

jobs:
  checkout:
    runs-on:
      group: mygroup
      labels: instance-medium
    steps:
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3.0.0
        id: buildx
        with:
          driver: remote
          endpoint: tcp://127.0.0.1:1234
      - name: Create simple Dockerfile
        run: |
          echo -e "FROM busybox\nRUN echo foobar > /hello.txt\nRUN cat /hello.txt" > Dockerfile
      - name: Build and push
        uses: docker/build-push-action@v6.1.0
        with:
          builder: ${{ steps.buildx.outputs.name }}
          push: false
          load: true
          context: "."
          tags: build-test
          cache-from: type=gha
          cache-to: type=gha,mode=max
      - name: Test
        run: |
          docker run --rm build-test
      - name: List docker images
        run: docker images
      - name: Test container action
        uses: actions/hello-world-docker-action@main
        with:
          who-to-greet: "Mona the Octocat"

Workflow logs

Post job cleanup.
Generating build summary
  exporting build record to /_work/test-my-ecs-43Kn2kkJfG1Eb/_temp/docker-actions-toolkit-Jl9ozK/export
  /usr/bin/mkfifo /_work/test-my-ecs-43Kn2kkJfG1Eb/_temp/docker-actions-toolkit-Jl9ozK/buildx-in-78BHfW.fifo
  /usr/bin/mkfifo /_work/test-my-ecs-43Kn2kkJfG1Eb/_temp/docker-actions-toolkit-Jl9ozK/buildx-out-ufKka9.fifo
  docker buildx --builder builder-fe924839-4148-4c33-97ad-128ab332049b dial-stdio
  docker run --rm -i -v /home/runner/.docker/buildx/refs:/buildx-refs -v /_work/test-my-ecs-43Kn2kkJfG1Eb/_temp/docker-actions-toolkit-Jl9ozK/export:/out docker.io/dockereng/export-build:latest --ref-state-dir=/buildx-refs --node=builder-fe924839-4148-4c33-97ad-128ab332049b/builder-fe924839-4148-4c33-97ad-128ab332049b0 --ref=n70x36273vnv08m7yqecabwos --uid=1000 --gid=121
  Unable to find image 'dockereng/export-build:latest' locally
  latest: Pulling from dockereng/export-build
  bb431e31f450: Pulling fs layer
  03f1761d02d6: Pulling fs layer
  03f1761d02d6: Verifying Checksum
  03f1761d02d6: Download complete
  bb431e31f450: Verifying Checksum
  bb431e31f450: Download complete
  bb431e31f450: Pull complete
  03f1761d02d6: Pull complete
  Digest: sha256:3dfedea3148487c108965dede834f22e81528fc5b2f3989e4b8ecec2f8fe10ae
  Status: Downloaded newer image for dockereng/export-build:latest
  Parsing /_work/test-my-ecs-43Kn2kkJfG1Eb/_temp/docker-actions-toolkit-Jl9ozK/export/summary.json
  Build record exported to /_work/test-my-ecs-43Kn2kkJfG1Eb/_temp/docker-actions-toolkit-Jl9ozK/export/my~actions-sandbox~N70X36.dockerbuild (17 KB)
  Warning: Failed to get backend IDs: The provided JWT token is invalid and/or missing claims
Removing temp folder /_work/test-my-ecs-43Kn2kkJfG1Eb/_temp/docker-actions-toolkit-YvYQtJ
Post cache
  State not set

BuildKit logs

No response

Additional info

GitHub Enterprise Server: v3.11.7 actions/runner: v2.317.0

crazy-max commented 6 days ago

Build Summary introduced in v6.0.0 doesn't work with GHES v3.11.7.

My guess is that it is because the artifact v2 library used internally does not support GHES.

@actions/artifact v2+, upload-artifact@v4+, and download-artifact@v4+ are not currently supported on GHES yet. The previous version of this package can be found at this tag and on npm.

Yes this seems to be the issue, I will look if we can downgrade to v1.

crazy-max commented 4 days ago

Downgrading to v1 does not look promising as we can't interact with azure blob storage API anymore, which is needed in our case to set appropriate content-disposition header when uploading the artifact: https://github.com/docker/actions-toolkit/blob/2e70a0cac6b3a7fad73b736a8fc017036b1b082f/src/github.ts#L154-L173

In the meantime we will print a better error message for GHES users: https://github.com/docker/actions-toolkit/pull/382

@dvdksn Could we add a callout in https://docs.docker.com/build/ci/github-actions/build-summary/ page saying that Build summary is not yet supported on GHES?