Skip to content

Commit 2154bbf

Browse files
committed
build/bake: honor name and enable attributes in meta-images
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent 9578080 commit 2154bbf

5 files changed

Lines changed: 28 additions & 8 deletions

File tree

‎.github/workflows/.test-bake.yml‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,15 @@ jobs:
695695
password: ${{ secrets.GITHUB_TOKEN }}
696696
697697
bake-ghcr-image-casing:
698+
strategy:
699+
matrix:
700+
include:
701+
- variant: plain
702+
images: ghcr.io/docker/GitHub-Builder-Test
703+
- variant: attributes
704+
images: |
705+
name=registry.invalid/disabled/app,enable=false
706+
name=ghcr.io/docker/GitHub-Builder-Test,enable=true
698707
uses: ./.github/workflows/bake.yml
699708
permissions:
700709
contents: read
@@ -709,9 +718,9 @@ jobs:
709718
*.args.VERSION={{meta.version}}
710719
target: hello-cross
711720
set-meta-annotations: true
712-
meta-images: ghcr.io/docker/GitHub-Builder-Test
721+
meta-images: ${{ matrix.images }}
713722
meta-tags: |
714-
type=raw,value=bake-image-casing-${{ github.run_id }}
723+
type=raw,value=bake-image-casing-${{ matrix.variant }}-${{ github.run_id }}
715724
secrets:
716725
registry-auths: |
717726
- registry: ghcr.io

‎.github/workflows/.test-build.yml‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,15 @@ jobs:
705705
password: ${{ secrets.GITHUB_TOKEN }}
706706
707707
build-ghcr-image-casing:
708+
strategy:
709+
matrix:
710+
include:
711+
- variant: plain
712+
images: ghcr.io/docker/GitHub-Builder-Test
713+
- variant: attributes
714+
images: |
715+
name=registry.invalid/disabled/app,enable=false
716+
name=ghcr.io/docker/GitHub-Builder-Test,enable=true
708717
uses: ./.github/workflows/build.yml
709718
permissions:
710719
contents: read
@@ -719,9 +728,9 @@ jobs:
719728
push: ${{ github.event_name != 'pull_request' }}
720729
sbom: true
721730
set-meta-annotations: true
722-
meta-images: ghcr.io/docker/GitHub-Builder-Test
731+
meta-images: ${{ matrix.images }}
723732
meta-tags: |
724-
type=raw,value=build-image-casing-${{ github.run_id }}
733+
type=raw,value=build-image-casing-${{ matrix.variant }}-${{ github.run_id }}
725734
secrets:
726735
registry-auths: |
727736
- registry: ghcr.io

‎.github/workflows/bake.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ jobs:
340340
const { Bake } = require('@docker/github-builder-runtime/lib/buildx/bake');
341341
const { Build } = require('@docker/github-builder-runtime/lib/buildx/build');
342342
const { GitHub } = require('@docker/github-builder-runtime/lib/github/github');
343+
const { MetaImages } = require('@docker/github-builder-runtime/lib/github-builder/meta-images');
343344
const { RunnerMapping } = require('@docker/github-builder-runtime/lib/github-builder/runner-mapping');
344345
const { BakeTargets } = require('@docker/github-builder-runtime/lib/github-builder/bake-targets');
345346
const { BakeVars } = require('@docker/github-builder-runtime/lib/github-builder/bake-vars');
@@ -413,7 +414,7 @@ jobs:
413414
}).sort(), null, 2));
414415
});
415416
416-
const metaImages = inpMetaImages.map(image => image.toLowerCase());
417+
const metaImages = MetaImages.resolve(inpMetaImages);
417418
await core.group(`Set metaImages output`, async () => {
418419
core.info(JSON.stringify(metaImages, null, 2));
419420
core.setOutput('metaImages', metaImages.join('\n'));

‎.github/workflows/build.yml‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ jobs:
332332
with:
333333
script: |
334334
const { GitHub } = require('@docker/github-builder-runtime/lib/github/github');
335+
const { MetaImages } = require('@docker/github-builder-runtime/lib/github-builder/meta-images');
335336
const { RunnerMapping } = require('@docker/github-builder-runtime/lib/github-builder/runner-mapping');
336337
const { Util } = require('@docker/github-builder-runtime/lib/util');
337338
@@ -399,7 +400,7 @@ jobs:
399400
core.setOutput('proxyNetwork', proxyNetwork);
400401
});
401402
402-
const metaImages = inpMetaImages.map(image => image.toLowerCase());
403+
const metaImages = MetaImages.resolve(inpMetaImages);
403404
await core.group(`Set metaImages output`, async () => {
404405
core.info(JSON.stringify(metaImages, null, 2));
405406
core.setOutput('metaImages', metaImages.join('\n'));

‎README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ jobs:
253253
| `ulimit` | List | | [Ulimit](https://docs.docker.com/engine/reference/commandline/buildx_build/#ulimit) options (e.g., `nofile=1024:1024`) |
254254
| `set-meta-annotations` | Bool | `false` | Append OCI Image Format Specification annotations generated by `docker/metadata-action` |
255255
| `set-meta-labels` | Bool | `false` | Append OCI Image Format Specification labels generated by `docker/metadata-action` |
256-
| `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) |
256+
| `meta-images` | List | | List of image names or `name=...,enable=...` entries (required for image output). Disabled entries are excluded from exports, signing, and manifests. |
257257
| `meta-tags` | List | | [List of tags](https://github.com/docker/metadata-action?tab=readme-ov-file#tags-input) as key-value pair attributes |
258258
| `meta-labels` | List | | [List of custom labels](https://github.com/docker/metadata-action?tab=readme-ov-file#overwrite-labels-and-annotations) |
259259
| `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:
368368
| `vars` | List | | [Variables](https://docs.docker.com/build/bake/variables/) to set in the Bake definition as list of key-value pair |
369369
| `set-meta-annotations` | Bool | `false` | Append OCI Image Format Specification annotations generated by `docker/metadata-action` |
370370
| `set-meta-labels` | Bool | `false` | Append OCI Image Format Specification labels generated by `docker/metadata-action` |
371-
| `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) |
371+
| `meta-images` | List | | List of image names or `name=...,enable=...` entries (required for image output). Disabled entries are excluded from exports, signing, and manifests. |
372372
| `meta-tags` | List | | [List of tags](https://github.com/docker/metadata-action?tab=readme-ov-file#tags-input) as key-value pair attributes |
373373
| `meta-labels` | List | | [List of custom labels](https://github.com/docker/metadata-action?tab=readme-ov-file#overwrite-labels-and-annotations) |
374374
| `meta-annotations` | List | | [List of custom annotations](https://github.com/docker/metadata-action?tab=readme-ov-file#overwrite-labels-and-annotations) |

0 commit comments

Comments
 (0)