Skip to content

Commit 8176740

Browse files
committed
add image-names output
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent 8b743b2 commit 8176740

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

.github/workflows/bake.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ on:
141141
image-digest:
142142
description: "Digest of the built image (for image output if pushed)"
143143
value: ${{ jobs.finalize.outputs.image-digest }}
144+
image-names:
145+
description: "List of image names (for image output if pushed)"
146+
value: ${{ jobs.finalize.outputs.image-names }}
144147
output-type:
145148
description: "Build output type"
146149
value: ${{ jobs.finalize.outputs.output-type }}
@@ -908,6 +911,7 @@ jobs:
908911
cosign-verify-commands: ${{ steps.set.outputs.cosign-verify-commands }}
909912
artifact-name: ${{ inputs.artifact-upload && inputs.artifact-name || '' }}
910913
image-digest: ${{ steps.manifest.outputs.digest }}
914+
image-names: ${{ steps.manifest.outputs.names }}
911915
output-type: ${{ inputs.output }}
912916
signed: ${{ needs.prepare.outputs.sign }}
913917
needs:
@@ -983,6 +987,7 @@ jobs:
983987
}
984988
985989
let digest;
990+
const names = [];
986991
for (const imageName of inpImageNames) {
987992
const tags = [];
988993
for (const tag of inpTagNames) {
@@ -999,12 +1004,16 @@ jobs:
9991004
return;
10001005
}
10011006
digest = result.digest;
1007+
names.push(...result.imageNames);
10021008
core.info(`Manifest created: ${imageName}@${result.digest}`);
10031009
}
10041010
}
10051011
if (digest) {
10061012
core.setOutput('digest', digest);
10071013
}
1014+
if (names.length > 0) {
1015+
core.setOutput('names', names.join('\n'));
1016+
}
10081017
-
10091018
name: Merge artifacts
10101019
if: ${{ inputs.output == 'local' && inputs.artifact-upload }}

.github/workflows/build.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ on:
144144
image-digest:
145145
description: "Digest of the built image (for image output if pushed)"
146146
value: ${{ jobs.finalize.outputs.image-digest }}
147+
image-names:
148+
description: "List of image names (for image output if pushed)"
149+
value: ${{ jobs.finalize.outputs.image-names }}
147150
output-type:
148151
description: "Build output type"
149152
value: ${{ jobs.finalize.outputs.output-type }}
@@ -762,6 +765,7 @@ jobs:
762765
cosign-verify-commands: ${{ steps.set.outputs.cosign-verify-commands }}
763766
artifact-name: ${{ inputs.artifact-upload && inputs.artifact-name || '' }}
764767
image-digest: ${{ steps.manifest.outputs.digest }}
768+
image-names: ${{ steps.manifest.outputs.names }}
765769
output-type: ${{ inputs.output }}
766770
signed: ${{ needs.prepare.outputs.sign }}
767771
needs:
@@ -836,6 +840,7 @@ jobs:
836840
}
837841
838842
let digest;
843+
const names = [];
839844
for (const imageName of inpImageNames) {
840845
const tags = [];
841846
for (const tag of inpTagNames) {
@@ -852,12 +857,16 @@ jobs:
852857
return;
853858
}
854859
digest = result.digest;
860+
names.push(...result.imageNames);
855861
core.info(`Manifest created: ${imageName}@${result.digest}`);
856862
}
857863
}
858864
if (digest) {
859865
core.setOutput('digest', digest);
860866
}
867+
if (names.length > 0) {
868+
core.setOutput('names', names.join('\n'));
869+
}
861870
-
862871
name: Merge artifacts
863872
if: ${{ inputs.output == 'local' && inputs.artifact-upload }}

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ ___
1414
* [Secrets](#secrets)
1515
* [Outputs](#outputs)
1616
* [Bake reusable workflow](#bake-reusable-workflow)
17-
* [Inputs](#inputs)
18-
* [Secrets](#secrets)
17+
* [Inputs](#inputs-1)
18+
* [Secrets](#secrets-1)
1919
* [Outputs](#outputs-1)
2020

2121
## Overview
@@ -267,6 +267,7 @@ with `builder-outputs: ${{ toJSON(needs.<job_id>.outputs) }}`.
267267
| `cosign-verify-commands` | List | Newline-delimited `cosign verify` commands generated when signing is enabled |
268268
| `artifact-name` | String | Name of the uploaded merged artifact (for `local` output with `artifact-upload: true`) |
269269
| `image-digest` | String | Digest of the built image manifest (for `image` output when pushed) |
270+
| `image-names` | List | List of image names (for `image` output when pushed) |
270271
| `output-type` | String | Output type selected for the workflow (`image` or `local`) |
271272
| `signed` | Bool | Whether attestation manifests or local artifacts were signed |
272273

@@ -389,5 +390,6 @@ with `builder-outputs: ${{ toJSON(needs.<job_id>.outputs) }}`.
389390
| `cosign-verify-commands` | List | Newline-delimited `cosign verify` commands generated when signing is enabled |
390391
| `artifact-name` | String | Name of the uploaded merged artifact (for `local` output with `artifact-upload: true`) |
391392
| `image-digest` | String | Digest of the built image manifest (for `image` output when pushed) |
393+
| `image-names` | List | List of image names (for `image` output when pushed) |
392394
| `output-type` | String | Output type selected for the workflow (`image` or `local`) |
393395
| `signed` | Bool | Whether attestation manifests or local artifacts were signed |

0 commit comments

Comments
 (0)