diff --git a/.github/workflows/.test-bake.yml b/.github/workflows/.test-bake.yml index 9903a940..a310b231 100644 --- a/.github/workflows/.test-bake.yml +++ b/.github/workflows/.test-bake.yml @@ -32,6 +32,7 @@ jobs: contents: read id-token: write with: + job-name-prefix: bake-dockerhub-single cache: true cache-scope: bake-dockerhub-single context: test diff --git a/.github/workflows/.test-build.yml b/.github/workflows/.test-build.yml index 13c98c3d..c25f3598 100644 --- a/.github/workflows/.test-build.yml +++ b/.github/workflows/.test-build.yml @@ -32,6 +32,7 @@ jobs: contents: read id-token: write with: + job-name-prefix: build-dockerhub-single build-args: | VERSION={{meta.version}} cache: true diff --git a/.github/workflows/bake.yml b/.github/workflows/bake.yml index 86e81f8b..78f14132 100644 --- a/.github/workflows/bake.yml +++ b/.github/workflows/bake.yml @@ -21,6 +21,10 @@ on: description: "Whether to cancel all in-progress and queued jobs in the matrix if any job fails" required: false default: false + job-name-prefix: + type: string + description: "Prefix to include in reusable workflow job matrix names in the GitHub Actions UI" + required: false setup-qemu: type: boolean description: "Runs the setup-qemu-action step to install QEMU static binaries" @@ -181,6 +185,10 @@ env: jobs: prepare: runs-on: ubuntu-24.04 + strategy: + matrix: + include: + - name: ${{ inputs.job-name-prefix }} outputs: includes: ${{ steps.set.outputs.includes }} metaImages: ${{ steps.set.outputs.metaImages }} @@ -280,6 +288,7 @@ jobs: INPUT_RUNNER: ${{ inputs.runner }} INPUT_DISTRIBUTE: ${{ inputs.distribute }} INPUT_ARTIFACT-UPLOAD: ${{ inputs.artifact-upload }} + INPUT_JOB-NAME-PREFIX: ${{ inputs.job-name-prefix }} INPUT_CONTEXT: ${{ inputs.context }} INPUT_FILES: ${{ inputs.files }} INPUT_OUTPUT: ${{ inputs.output }} @@ -306,6 +315,7 @@ jobs: const inpRunner = core.getMultilineInput('runner'); const inpDistribute = core.getBooleanInput('distribute'); const inpArtifactUpload = core.getBooleanInput('artifact-upload'); + const inpJobNamePrefix = core.getInput('job-name-prefix'); const inpContext = core.getInput('context'); const inpVars = Util.getInputList('vars'); const inpFiles = Util.getInputList('files'); @@ -540,19 +550,25 @@ jobs: }); await core.group(`Set includes output`, async () => { + const withJobNamePrefix = include => { + if (inpJobNamePrefix) { + return {name: inpJobNamePrefix, ...include}; + } + return include; + }; let includes = []; if (!inpDistribute || platforms.length === 0) { - includes.push({ + includes.push(withJobNamePrefix({ index: 0, runner: resolveRunner(runnerConfig) - }); + })); } else { platforms.forEach((platform, index) => { - includes.push({ + includes.push(withJobNamePrefix({ index: index, platform: platform, runner: resolveRunner(runnerConfig, platform) - }); + })); }); } core.info(JSON.stringify(includes, null, 2)); @@ -1105,6 +1121,10 @@ jobs: finalize: runs-on: ubuntu-24.04 + strategy: + matrix: + include: + - name: ${{ inputs.job-name-prefix }} outputs: meta-json: ${{ steps.meta.outputs.json }} cosign-version: ${{ env.COSIGN_VERSION }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 33015433..6332cb8b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,10 @@ on: description: "Whether to cancel all in-progress and queued jobs in the matrix if any job fails" required: false default: false + job-name-prefix: + type: string + description: "Prefix to include in reusable workflow job matrix names in the GitHub Actions UI" + required: false setup-qemu: type: boolean description: "Runs the setup-qemu-action step to install QEMU static binaries" @@ -184,6 +188,10 @@ env: jobs: prepare: runs-on: ubuntu-24.04 + strategy: + matrix: + include: + - name: ${{ inputs.job-name-prefix }} outputs: includes: ${{ steps.set.outputs.includes }} metaImages: ${{ steps.set.outputs.metaImages }} @@ -275,6 +283,7 @@ jobs: INPUT_RUNNER: ${{ inputs.runner }} INPUT_DISTRIBUTE: ${{ inputs.distribute }} INPUT_ARTIFACT-UPLOAD: ${{ inputs.artifact-upload }} + INPUT_JOB-NAME-PREFIX: ${{ inputs.job-name-prefix }} INPUT_OUTPUT: ${{ inputs.output }} INPUT_PLATFORMS: ${{ inputs.platforms }} INPUT_PUSH: ${{ inputs.push }} @@ -291,6 +300,7 @@ jobs: const inpRunner = core.getMultilineInput('runner'); const inpDistribute = core.getBooleanInput('distribute'); const inpArtifactUpload = core.getBooleanInput('artifact-upload'); + const inpJobNamePrefix = core.getInput('job-name-prefix'); const inpPlatforms = Util.getInputList('platforms'); const inpOutput = core.getInput('output'); const inpPush = core.getBooleanInput('push'); @@ -432,19 +442,25 @@ jobs: }); await core.group(`Set includes output`, async () => { + const withJobNamePrefix = include => { + if (inpJobNamePrefix) { + return {name: inpJobNamePrefix, ...include}; + } + return include; + }; let includes = []; if (!inpDistribute || inpPlatforms.length === 0) { - includes.push({ + includes.push(withJobNamePrefix({ index: 0, runner: resolveRunner(runnerConfig) - }); + })); } else { inpPlatforms.forEach((platform, index) => { - includes.push({ + includes.push(withJobNamePrefix({ index: index, platform: platform, runner: resolveRunner(runnerConfig, platform) - }); + })); }); } core.info(JSON.stringify(includes, null, 2)); @@ -960,6 +976,10 @@ jobs: finalize: runs-on: ubuntu-24.04 + strategy: + matrix: + include: + - name: ${{ inputs.job-name-prefix }} outputs: meta-json: ${{ steps.meta.outputs.json }} cosign-version: ${{ env.COSIGN_VERSION }} diff --git a/README.md b/README.md index 41edb6e5..5bc27729 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,7 @@ jobs: | `runner` | String | See [Runner mapping](#runner-mapping) | GitHub-hosted Linux runner label or platform mapping to build on. See [Runner mapping](#runner-mapping). | | `distribute` | Bool | `true` | Whether to distribute the build across multiple runners (one platform per runner) | | `fail-fast` | Bool | `false` | Whether to cancel all in-progress and queued jobs in the matrix if any job fails | +| `job-name-prefix` | String | | Prefix to include in reusable workflow job matrix names in the GitHub Actions UI | | `setup-qemu` | Bool | `false` | Runs the `setup-qemu-action` step to install QEMU static binaries | | `artifact-name` | String | `docker-github-builder-assets` | Name of the uploaded GitHub artifact (for `local` output) | | `artifact-upload` | Bool | `false` | Upload build output GitHub artifact (for `local` output) | @@ -330,6 +331,7 @@ jobs: | `runner` | String | See [Runner mapping](#runner-mapping) | GitHub-hosted Linux runner label or platform mapping to build on. See [Runner mapping](#runner-mapping). | | `distribute` | Bool | `true` | Whether to distribute the build across multiple runners (one platform per runner) | | `fail-fast` | Bool | `false` | Whether to cancel all in-progress and queued jobs in the matrix if any job fails | +| `job-name-prefix` | String | | Prefix to include in reusable workflow job matrix names in the GitHub Actions UI | | `setup-qemu` | Bool | `false` | Runs the `setup-qemu-action` step to install QEMU static binaries | | `artifact-name` | String | `docker-github-builder-assets` | Name of the uploaded GitHub artifact (for `local` output) | | `artifact-upload` | Bool | `false` | Upload build output GitHub artifact (for `local` output) |