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

Optionally use disclosure elements to hide lengthy Docker build summary #369

Closed
ruffsl opened this issue Jun 17, 2024 · 7 comments · Fixed by #377
Closed

Optionally use disclosure elements to hide lengthy Docker build summary #369

ruffsl opened this issue Jun 17, 2024 · 7 comments · Fixed by #377
Labels
kind/enhancement New feature or request

Comments

@ruffsl
Copy link

ruffsl commented Jun 17, 2024

When using the docker/bake-action@v6 action, the resulting build summary are rather long, taking up quite a bit of the vertical space from the rest of the user provide build summaries, requiring much more scroller for readers.

public static async writeBuildSummary(opts: BuildSummaryOpts): Promise<void> {

While they are nicely detailed for debugging, would it be possible to allow the end user of the resulting docker actions to dynamically configure them to be encapsulate within a togglable disclosure element, via action input?

Even if the just the <h2>Bake definition</h2> and <h2>Build inputs</h2> sections had their body's nested under a collapsed disclosure element by default, that could be a big gain in reduction of line noise.

Related:

@crazy-max
Copy link
Member

crazy-max commented Jun 18, 2024

Thanks for your feedback on this feature!

When using the docker/bake-action@v6 action

I think you mean docker/bake-action@v5 😇

the resulting build summary are rather long, taking up quite a bit of the vertical space from the rest of the user provide build summaries, requiring much more scroller for readers.

Would you mind sharing the workflow run url of the repo affected by this? That would help to understand your issue. If you prefer to share materials (screenshot, video capture), feel free to do so.

While they are nicely detailed for debugging, would it be possible to allow the end user of the resulting docker actions to dynamically configure them to be encapsulate within a togglable disclosure element, via action input?

I think we could make some enhancements and make Build inputs and Bake definition content togglable if it exceeds a predefined number of lines.

cc @colinhemmings @sharonchang1

@colinhemmings
Copy link

colinhemmings commented Jun 18, 2024

Thanks for the feedback, @ruffsl; this is really useful. We will be investigating. Which pieces of information would be most valuable to use in these summaries?

@ruffsl
Copy link
Author

ruffsl commented Jun 18, 2024

Would you mind sharing the workflow run url of the repo affected by this? That would help to understand your issue.

Sure, here is an anonymized example where it includes a trailing disclosure element to hind the lengthy docker build summary, so that PR reviewers can focus on finding the fully qualified tag names, while CI maintainers can expand the docker build summary for greater diagnostics and debugging.

Edit: I'll note there are multiple bake jobs in a single workflow, so the summary below is replicated Nx.


Base Images

Image tag Digest
docker_action-tooler sha256:49799b45cd4b8908fbe9867d0e9ac5df21785f02ec824cb2d4bbab15b4668765
docker_action-validator sha256:d9be7802c1db8652efda7bfdc9aa1cf85a46adbe582712470c592c11e723aa68

tooler

111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler@sha256:49799b45cd4b8908fbe9867d0e9ac5df21785f02ec824cb2d4bbab15b4668765

validator

111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-validator@sha256:d9be7802c1db8652efda7bfdc9aa1cf85a46adbe582712470c592c11e723aa68

example disclosure element that doesn't work in practice because of step isolation

Docker Build summary

Docker Build summary

For a detailed look at the build, download the following build record archive and import it into Docker Desktop's Builds view.
Build records include details such as timing, dependencies, results, logs, traces, and other information about a build. Learn more

⬇️ org~repo~ABJFAM+1.dockerbuild (106.48 KB)
This file includes 2 build records.

Find this useful? Let us know

Preview

IDNameStatusCachedDuration
ABJFAMrepo (tooler)✅ completed66%22s
NYMIYBrepo (validator)✅ completed3%24s

Build inputs

files:
  - ./docker-bake.hcl
  - /home/runner/_work/_temp/docker-actions-toolkit-2FZiur/docker-metadata-action-bake.json
  - /home/runner/_work/_temp/docker-actions-toolkit-TzQCs8/docker-metadata-action-bake.json
targets:
  - tooler
  - validator
pull: true
provenance: 'false'
push: true
set:
  - '*.cache-from=type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:main-tooler.cache'
  - '*.cache-to=type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk,mode=max'
  - '*.cache-from=type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache'
  - tooler.cache-to=type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache,mode=max,image-manifest=true,oci-mediatypes=true
  - '*.cache-from=type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk'

Bake definition

{
  "group": {
    "default": {
      "targets": [
        "tooler",
        "validator"
      ]
    }
  },
  "target": {
    "tooler": {
      "attest": [
        "type=provenance,disabled=true"
      ],
      "context": ".",
      "dockerfile": "Dockerfile",
      "args": {
        "DOCKER_META_IMAGES": "111111111111.dkr.ecr.us-east-1.amazonaws.com/repo",
        "DOCKER_META_VERSION": "docker_action-tooler"
      },
      "labels": {
        "org.opencontainers.image.created": "2024-06-17T18:54:18.131Z",
        "org.opencontainers.image.description": "Experimentation repo for refactoring auto integration repo",
        "org.opencontainers.image.licenses": "",
        "org.opencontainers.image.revision": "50e0ecd7bf698a01710d08ce052319b8d46b50fd",
        "org.opencontainers.image.source": "https://github.com/org/repo",
        "org.opencontainers.image.title": "repo",
        "org.opencontainers.image.url": "https://github.com/org/repo",
        "org.opencontainers.image.version": "docker_action-tooler"
      },
      "tags": [
        "111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler"
      ],
      "cache-from": [
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:main-tooler.cache",
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache",
        "type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk"
      ],
      "cache-to": [
        "type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk,mode=max",
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache,mode=max,image-manifest=true,oci-mediatypes=true"
      ],
      "target": "tooler",
      "output": [
        "type=image,push=true,push=true,push=true,push=true,push=true"
      ],
      "pull": true,
      "no-cache": false
    },
    "validator": {
      "attest": [
        "type=provenance,disabled=true"
      ],
      "context": ".",
      "dockerfile": "Dockerfile",
      "args": {
        "DOCKER_META_IMAGES": "111111111111.dkr.ecr.us-east-1.amazonaws.com/repo",
        "DOCKER_META_VERSION": "docker_action-validator"
      },
      "labels": {
        "org.opencontainers.image.created": "2024-06-17T18:54:17.585Z",
        "org.opencontainers.image.description": "Experimentation repo for refactoring auto integration repo",
        "org.opencontainers.image.licenses": "",
        "org.opencontainers.image.revision": "50e0ecd7bf698a01710d08ce052319b8d46b50fd",
        "org.opencontainers.image.source": "https://github.com/org/repo",
        "org.opencontainers.image.title": "repo",
        "org.opencontainers.image.url": "https://github.com/org/repo",
        "org.opencontainers.image.version": "docker_action-validator"
      },
      "tags": [
        "111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-validator"
      ],
      "cache-from": [
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:main-tooler.cache",
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache",
        "type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk"
      ],
      "cache-to": [
        "type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk,mode=max"
      ],
      "target": "validator",
      "output": [
        "type=image,push=true,push=true,push=true,push=true"
      ],
      "pull": true,
      "no-cache": false
    }
  }
}

@ruffsl
Copy link
Author

ruffsl commented Jun 18, 2024

content togglable if it exceeds a predefined number of lines.

I would prefer tighter control over the rendering, rather than hard coded hursitics.

Perhaps a verbosity parameter could be used to fold headings of different levels? E.g:

with:
  verbosity: 0

would enclose all headings greater than the <h0> tag, E.g everything.

with:
  verbosity: 1

while would similarly enclose all headings greater than the <h1> tag. E.g:


Base Images

Image tag Digest
docker_action-tooler sha256:49799b45cd4b8908fbe9867d0e9ac5df21785f02ec824cb2d4bbab15b4668765
docker_action-validator sha256:d9be7802c1db8652efda7bfdc9aa1cf85a46adbe582712470c592c11e723aa68

tooler

111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler@sha256:49799b45cd4b8908fbe9867d0e9ac5df21785f02ec824cb2d4bbab15b4668765

validator

111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-validator@sha256:d9be7802c1db8652efda7bfdc9aa1cf85a46adbe582712470c592c11e723aa68

Docker Build summary

For a detailed look at the build, download the following build record archive and import it into Docker Desktop's Builds view.
Build records include details such as timing, dependencies, results, logs, traces, and other information about a build. Learn more

⬇️ org~repo~ABJFAM+1.dockerbuild (106.48 KB)
This file includes 2 build records.

Find this useful? Let us know

Preview

Preview

IDNameStatusCachedDuration
ABJFAMrepo (tooler)✅ completed66%22s
NYMIYBrepo (validator)✅ completed3%24s
Build inputs

Build inputs

files:
  - ./docker-bake.hcl
  - /home/runner/_work/_temp/docker-actions-toolkit-2FZiur/docker-metadata-action-bake.json
  - /home/runner/_work/_temp/docker-actions-toolkit-TzQCs8/docker-metadata-action-bake.json
targets:
  - tooler
  - validator
pull: true
provenance: 'false'
push: true
set:
  - '*.cache-from=type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:main-tooler.cache'
  - '*.cache-to=type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk,mode=max'
  - '*.cache-from=type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache'
  - tooler.cache-to=type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache,mode=max,image-manifest=true,oci-mediatypes=true
  - '*.cache-from=type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk'
Bake definition

Bake definition

{
  "group": {
    "default": {
      "targets": [
        "tooler",
        "validator"
      ]
    }
  },
  "target": {
    "tooler": {
      "attest": [
        "type=provenance,disabled=true"
      ],
      "context": ".",
      "dockerfile": "Dockerfile",
      "args": {
        "DOCKER_META_IMAGES": "111111111111.dkr.ecr.us-east-1.amazonaws.com/repo",
        "DOCKER_META_VERSION": "docker_action-tooler"
      },
      "labels": {
        "org.opencontainers.image.created": "2024-06-17T18:54:18.131Z",
        "org.opencontainers.image.description": "Experimentation repo for refactoring auto integration repo",
        "org.opencontainers.image.licenses": "",
        "org.opencontainers.image.revision": "50e0ecd7bf698a01710d08ce052319b8d46b50fd",
        "org.opencontainers.image.source": "https://github.com/org/repo",
        "org.opencontainers.image.title": "repo",
        "org.opencontainers.image.url": "https://github.com/org/repo",
        "org.opencontainers.image.version": "docker_action-tooler"
      },
      "tags": [
        "111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler"
      ],
      "cache-from": [
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:main-tooler.cache",
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache",
        "type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk"
      ],
      "cache-to": [
        "type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk,mode=max",
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache,mode=max,image-manifest=true,oci-mediatypes=true"
      ],
      "target": "tooler",
      "output": [
        "type=image,push=true,push=true,push=true,push=true,push=true"
      ],
      "pull": true,
      "no-cache": false
    },
    "validator": {
      "attest": [
        "type=provenance,disabled=true"
      ],
      "context": ".",
      "dockerfile": "Dockerfile",
      "args": {
        "DOCKER_META_IMAGES": "111111111111.dkr.ecr.us-east-1.amazonaws.com/repo",
        "DOCKER_META_VERSION": "docker_action-validator"
      },
      "labels": {
        "org.opencontainers.image.created": "2024-06-17T18:54:17.585Z",
        "org.opencontainers.image.description": "Experimentation repo for refactoring auto integration repo",
        "org.opencontainers.image.licenses": "",
        "org.opencontainers.image.revision": "50e0ecd7bf698a01710d08ce052319b8d46b50fd",
        "org.opencontainers.image.source": "https://github.com/org/repo",
        "org.opencontainers.image.title": "repo",
        "org.opencontainers.image.url": "https://github.com/org/repo",
        "org.opencontainers.image.version": "docker_action-validator"
      },
      "tags": [
        "111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-validator"
      ],
      "cache-from": [
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:main-tooler.cache",
        "type=registry,ref=111111111111.dkr.ecr.us-east-1.amazonaws.com/repo:docker_action-tooler.cache",
        "type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk"
      ],
      "cache-to": [
        "type=s3,blobs_prefix=cache/repo/,manifests_prefix=cache/repo/,region=us-east-1,bucket=abcdefghijk,mode=max"
      ],
      "target": "validator",
      "output": [
        "type=image,push=true,push=true,push=true,push=true"
      ],
      "pull": true,
      "no-cache": false
    }
  }
}

@ruffsl
Copy link
Author

ruffsl commented Jun 18, 2024

Which pieces of information would be most valuable to use in these summaries?

Well, it would be kind of nice for the build summary to include copyable URIs to the fully qualified tag names.

For example, this is what I've been doing to easily surface the tag names to our end users:

    - name: Job Workflow Info
      id: job_workflow_info
      shell: bash
      run: |
        debugger_image_name="${{ fromJSON(steps.bake_prod_stages.outputs.metadata)['debugger']['image.name'] }}"
        debugger_image_digest="${{ fromJSON(steps.bake_prod_stages.outputs.metadata)['debugger']['containerimage.digest'] }}"
        debugger_image="${debugger_image_name}@${debugger_image_digest}"
        echo "debugger_image=${debugger_image}" >> $GITHUB_OUTPUT

        releaser_image_name="${{ fromJSON(steps.bake_prod_stages.outputs.metadata)['releaser']['image.name'] }}"
        releaser_image_digest="${{ fromJSON(steps.bake_prod_stages.outputs.metadata)['releaser']['containerimage.digest'] }}"
        releaser_image="${releaser_image_name}@${releaser_image_digest}"
        echo "releaser_image=${releaser_image}" >> $GITHUB_OUTPUT

        cat << EOF > $GITHUB_STEP_SUMMARY
        ## Prod Images
        | Image tag | Digest |
        |-|-|
        | \`${debugger_image_name##*:}\` | \`${debugger_image_digest}\` |
        | \`${releaser_image_name##*:}\` | \`${releaser_image_digest}\` |

        ### debugger
        \`\`\`
        ${debugger_image}
        \`\`\`

        ### releaser
        \`\`\`
        ${releaser_image}
        \`\`\`
        EOF

@Pesa
Copy link

Pesa commented Jun 18, 2024

I have similar feedback on the new build summary feature: it is quite verbose in general. I actually like the "Preview" section/table(*) a lot, but the "Build inputs" section doesn't seem very useful unless someone is debugging the workflow (and in that case I would look at the full logs anyway).

See here for an example of a workflow run.

I'd like to request an option to hide the "Build inputs" section in a <details> element, or even suppress it altogether. In fact, I'd argue hiding the section should be the default behavior. I'm using a similar technique with <details> for the job summary generated by our reusable workflow.

(*) while at it, I suggest adding another column with the image size :)

@crazy-max crazy-max added the kind/enhancement New feature or request label Jun 19, 2024
@crazy-max
Copy link
Member

@ruffsl @Pesa Thanks for your feedback, I will make some changes and keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
4 participants