From 5eb7f4e2a0d4e66b91431f741224ff5b77933de6 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Fri, 28 Nov 2025 17:07:16 +0100 Subject: [PATCH] show generated imagetools create args if image not pushed Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/bake.yml | 24 ++++++++++++++++-------- .github/workflows/build.yml | 24 ++++++++++++++++-------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/.github/workflows/bake.yml b/.github/workflows/bake.yml index 565033f..47169b8 100644 --- a/.github/workflows/bake.yml +++ b/.github/workflows/bake.yml @@ -698,14 +698,16 @@ jobs: driver-opts: image=${{ env.BUILDKIT_IMAGE }} - name: Create manifest - if: ${{ inputs.push && inputs.output == 'image' }} + if: ${{ inputs.output == 'image' }} uses: actions/github-script@v8 env: + INPUT_PUSH: ${{ inputs.push }} INPUT_IMAGE-NAMES: ${{ inputs.meta-images }} INPUT_TAG-NAMES: ${{ steps.meta.outputs.tag-names }} INPUT_BUILD-OUTPUTS: ${{ toJSON(needs.build.outputs) }} with: script: | + const inpPush = core.getBooleanInput('push'); const inpImageNames = core.getMultilineInput('image-names'); const inpTagNames = core.getMultilineInput('tag-names'); const inpBuildOutputs = JSON.parse(core.getInput('build-outputs')); @@ -729,13 +731,19 @@ jobs: for (const digest of digests) { createArgs.push(digest); } - await exec.getExecOutput('docker', createArgs, { - ignoreReturnCode: true - }).then(res => { - if (res.stderr.length > 0 && res.exitCode != 0) { - throw new Error(res.stderr); - } - }); + if (inpPush) { + await exec.getExecOutput('docker', createArgs, { + ignoreReturnCode: true + }).then(res => { + if (res.stderr.length > 0 && res.exitCode != 0) { + throw new Error(res.stderr); + } + }); + } else { + await core.group(`Generated imagetools create command for ${imageName}`, async () => { + core.info(`docker ${createArgs.join(' ')}`); + }); + } } - name: Set outputs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d2342dc..3756f65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -591,14 +591,16 @@ jobs: driver-opts: image=${{ env.BUILDKIT_IMAGE }} - name: Create manifest - if: ${{ inputs.push && inputs.output == 'image' }} + if: ${{ inputs.output == 'image' }} uses: actions/github-script@v8 env: + INPUT_PUSH: ${{ inputs.push }} INPUT_IMAGE-NAMES: ${{ inputs.meta-images }} INPUT_TAG-NAMES: ${{ steps.meta.outputs.tag-names }} INPUT_BUILD-OUTPUTS: ${{ toJSON(needs.build.outputs) }} with: script: | + const inpPush = core.getBooleanInput('push'); const inpImageNames = core.getMultilineInput('image-names'); const inpTagNames = core.getMultilineInput('tag-names'); const inpBuildOutputs = JSON.parse(core.getInput('build-outputs')); @@ -622,13 +624,19 @@ jobs: for (const digest of digests) { createArgs.push(digest); } - await exec.getExecOutput('docker', createArgs, { - ignoreReturnCode: true - }).then(res => { - if (res.stderr.length > 0 && res.exitCode != 0) { - throw new Error(res.stderr); - } - }); + if (inpPush) { + await exec.getExecOutput('docker', createArgs, { + ignoreReturnCode: true + }).then(res => { + if (res.stderr.length > 0 && res.exitCode != 0) { + throw new Error(res.stderr); + } + }); + } else { + await core.group(`Generated imagetools create command for ${imageName}`, async () => { + core.info(`docker ${createArgs.join(' ')}`); + }); + } } - name: Set outputs