From 2154bbf56643063ce576dc632228fc8493902ab7 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Thu, 5 Nov 2026 15:34:55 +0100 Subject: [PATCH] build/bake: honor name and enable attributes in meta-images Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/.test-bake.yml | 13 +++++++++++-- .github/workflows/.test-build.yml | 13 +++++++++++-- .github/workflows/bake.yml | 3 ++- .github/workflows/build.yml | 3 ++- README.md | 4 ++-- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/.github/workflows/.test-bake.yml b/.github/workflows/.test-bake.yml index e122f48c..1140589f 100644 --- a/.github/workflows/.test-bake.yml +++ b/.github/workflows/.test-bake.yml @@ -695,6 +695,15 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} bake-ghcr-image-casing: + strategy: + matrix: + include: + - variant: plain + images: ghcr.io/docker/GitHub-Builder-Test + - variant: attributes + images: | + name=registry.invalid/disabled/app,enable=false + name=ghcr.io/docker/GitHub-Builder-Test,enable=true uses: ./.github/workflows/bake.yml permissions: contents: read @@ -709,9 +718,9 @@ jobs: *.args.VERSION={{meta.version}} target: hello-cross set-meta-annotations: true - meta-images: ghcr.io/docker/GitHub-Builder-Test + meta-images: ${{ matrix.images }} meta-tags: | - type=raw,value=bake-image-casing-${{ github.run_id }} + type=raw,value=bake-image-casing-${{ matrix.variant }}-${{ github.run_id }} secrets: registry-auths: | - registry: ghcr.io diff --git a/.github/workflows/.test-build.yml b/.github/workflows/.test-build.yml index 65038afd..6cb72a5b 100644 --- a/.github/workflows/.test-build.yml +++ b/.github/workflows/.test-build.yml @@ -705,6 +705,15 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} build-ghcr-image-casing: + strategy: + matrix: + include: + - variant: plain + images: ghcr.io/docker/GitHub-Builder-Test + - variant: attributes + images: | + name=registry.invalid/disabled/app,enable=false + name=ghcr.io/docker/GitHub-Builder-Test,enable=true uses: ./.github/workflows/build.yml permissions: contents: read @@ -719,9 +728,9 @@ jobs: push: ${{ github.event_name != 'pull_request' }} sbom: true set-meta-annotations: true - meta-images: ghcr.io/docker/GitHub-Builder-Test + meta-images: ${{ matrix.images }} meta-tags: | - type=raw,value=build-image-casing-${{ github.run_id }} + type=raw,value=build-image-casing-${{ matrix.variant }}-${{ github.run_id }} secrets: registry-auths: | - registry: ghcr.io diff --git a/.github/workflows/bake.yml b/.github/workflows/bake.yml index 8f03906c..4c3da125 100644 --- a/.github/workflows/bake.yml +++ b/.github/workflows/bake.yml @@ -340,6 +340,7 @@ jobs: const { Bake } = require('@docker/github-builder-runtime/lib/buildx/bake'); const { Build } = require('@docker/github-builder-runtime/lib/buildx/build'); const { GitHub } = require('@docker/github-builder-runtime/lib/github/github'); + const { MetaImages } = require('@docker/github-builder-runtime/lib/github-builder/meta-images'); const { RunnerMapping } = require('@docker/github-builder-runtime/lib/github-builder/runner-mapping'); const { BakeTargets } = require('@docker/github-builder-runtime/lib/github-builder/bake-targets'); const { BakeVars } = require('@docker/github-builder-runtime/lib/github-builder/bake-vars'); @@ -413,7 +414,7 @@ jobs: }).sort(), null, 2)); }); - const metaImages = inpMetaImages.map(image => image.toLowerCase()); + const metaImages = MetaImages.resolve(inpMetaImages); await core.group(`Set metaImages output`, async () => { core.info(JSON.stringify(metaImages, null, 2)); core.setOutput('metaImages', metaImages.join('\n')); diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 492a925c..5f0ea17f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -332,6 +332,7 @@ jobs: with: script: | const { GitHub } = require('@docker/github-builder-runtime/lib/github/github'); + const { MetaImages } = require('@docker/github-builder-runtime/lib/github-builder/meta-images'); const { RunnerMapping } = require('@docker/github-builder-runtime/lib/github-builder/runner-mapping'); const { Util } = require('@docker/github-builder-runtime/lib/util'); @@ -399,7 +400,7 @@ jobs: core.setOutput('proxyNetwork', proxyNetwork); }); - const metaImages = inpMetaImages.map(image => image.toLowerCase()); + const metaImages = MetaImages.resolve(inpMetaImages); await core.group(`Set metaImages output`, async () => { core.info(JSON.stringify(metaImages, null, 2)); core.setOutput('metaImages', metaImages.join('\n')); diff --git a/README.md b/README.md index 810a5637..ebe316e7 100644 --- a/README.md +++ b/README.md @@ -253,7 +253,7 @@ jobs: | `ulimit` | List | | [Ulimit](https://docs.docker.com/engine/reference/commandline/buildx_build/#ulimit) options (e.g., `nofile=1024:1024`) | | `set-meta-annotations` | Bool | `false` | Append OCI Image Format Specification annotations generated by `docker/metadata-action` | | `set-meta-labels` | Bool | `false` | Append OCI Image Format Specification labels generated by `docker/metadata-action` | -| `meta-images` | List | | [List of images](https://github.com/docker/metadata-action?tab=readme-ov-file#images-input) to use as base name for tags (required for image output) | +| `meta-images` | List | | List of image names or `name=...,enable=...` entries (required for image output). Disabled entries are excluded from exports, signing, and manifests. | | `meta-tags` | List | | [List of tags](https://github.com/docker/metadata-action?tab=readme-ov-file#tags-input) as key-value pair attributes | | `meta-labels` | List | | [List of custom labels](https://github.com/docker/metadata-action?tab=readme-ov-file#overwrite-labels-and-annotations) | | `meta-annotations` | List | | [List of custom annotations](https://github.com/docker/metadata-action?tab=readme-ov-file#overwrite-labels-and-annotations) | @@ -368,7 +368,7 @@ jobs: | `vars` | List | | [Variables](https://docs.docker.com/build/bake/variables/) to set in the Bake definition as list of key-value pair | | `set-meta-annotations` | Bool | `false` | Append OCI Image Format Specification annotations generated by `docker/metadata-action` | | `set-meta-labels` | Bool | `false` | Append OCI Image Format Specification labels generated by `docker/metadata-action` | -| `meta-images` | List | | [List of images](https://github.com/docker/metadata-action?tab=readme-ov-file#images-input) to use as base name for tags (required for image output) | +| `meta-images` | List | | List of image names or `name=...,enable=...` entries (required for image output). Disabled entries are excluded from exports, signing, and manifests. | | `meta-tags` | List | | [List of tags](https://github.com/docker/metadata-action?tab=readme-ov-file#tags-input) as key-value pair attributes | | `meta-labels` | List | | [List of custom labels](https://github.com/docker/metadata-action?tab=readme-ov-file#overwrite-labels-and-annotations) | | `meta-annotations` | List | | [List of custom annotations](https://github.com/docker/metadata-action?tab=readme-ov-file#overwrite-labels-and-annotations) |