Skip to content

Commit c56377b

Browse files
authored
Merge pull request #47 from crazy-max/imagetools-args
show generated imagetools create args if image not pushed
2 parents 813ea76 + 5eb7f4e commit c56377b

File tree

2 files changed

+32
-16
lines changed

2 files changed

+32
-16
lines changed

.github/workflows/bake.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -698,14 +698,16 @@ jobs:
698698
driver-opts: image=${{ env.BUILDKIT_IMAGE }}
699699
-
700700
name: Create manifest
701-
if: ${{ inputs.push && inputs.output == 'image' }}
701+
if: ${{ inputs.output == 'image' }}
702702
uses: actions/github-script@v8
703703
env:
704+
INPUT_PUSH: ${{ inputs.push }}
704705
INPUT_IMAGE-NAMES: ${{ inputs.meta-images }}
705706
INPUT_TAG-NAMES: ${{ steps.meta.outputs.tag-names }}
706707
INPUT_BUILD-OUTPUTS: ${{ toJSON(needs.build.outputs) }}
707708
with:
708709
script: |
710+
const inpPush = core.getBooleanInput('push');
709711
const inpImageNames = core.getMultilineInput('image-names');
710712
const inpTagNames = core.getMultilineInput('tag-names');
711713
const inpBuildOutputs = JSON.parse(core.getInput('build-outputs'));
@@ -729,13 +731,19 @@ jobs:
729731
for (const digest of digests) {
730732
createArgs.push(digest);
731733
}
732-
await exec.getExecOutput('docker', createArgs, {
733-
ignoreReturnCode: true
734-
}).then(res => {
735-
if (res.stderr.length > 0 && res.exitCode != 0) {
736-
throw new Error(res.stderr);
737-
}
738-
});
734+
if (inpPush) {
735+
await exec.getExecOutput('docker', createArgs, {
736+
ignoreReturnCode: true
737+
}).then(res => {
738+
if (res.stderr.length > 0 && res.exitCode != 0) {
739+
throw new Error(res.stderr);
740+
}
741+
});
742+
} else {
743+
await core.group(`Generated imagetools create command for ${imageName}`, async () => {
744+
core.info(`docker ${createArgs.join(' ')}`);
745+
});
746+
}
739747
}
740748
-
741749
name: Set outputs

.github/workflows/build.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -591,14 +591,16 @@ jobs:
591591
driver-opts: image=${{ env.BUILDKIT_IMAGE }}
592592
-
593593
name: Create manifest
594-
if: ${{ inputs.push && inputs.output == 'image' }}
594+
if: ${{ inputs.output == 'image' }}
595595
uses: actions/github-script@v8
596596
env:
597+
INPUT_PUSH: ${{ inputs.push }}
597598
INPUT_IMAGE-NAMES: ${{ inputs.meta-images }}
598599
INPUT_TAG-NAMES: ${{ steps.meta.outputs.tag-names }}
599600
INPUT_BUILD-OUTPUTS: ${{ toJSON(needs.build.outputs) }}
600601
with:
601602
script: |
603+
const inpPush = core.getBooleanInput('push');
602604
const inpImageNames = core.getMultilineInput('image-names');
603605
const inpTagNames = core.getMultilineInput('tag-names');
604606
const inpBuildOutputs = JSON.parse(core.getInput('build-outputs'));
@@ -622,13 +624,19 @@ jobs:
622624
for (const digest of digests) {
623625
createArgs.push(digest);
624626
}
625-
await exec.getExecOutput('docker', createArgs, {
626-
ignoreReturnCode: true
627-
}).then(res => {
628-
if (res.stderr.length > 0 && res.exitCode != 0) {
629-
throw new Error(res.stderr);
630-
}
631-
});
627+
if (inpPush) {
628+
await exec.getExecOutput('docker', createArgs, {
629+
ignoreReturnCode: true
630+
}).then(res => {
631+
if (res.stderr.length > 0 && res.exitCode != 0) {
632+
throw new Error(res.stderr);
633+
}
634+
});
635+
} else {
636+
await core.group(`Generated imagetools create command for ${imageName}`, async () => {
637+
core.info(`docker ${createArgs.join(' ')}`);
638+
});
639+
}
632640
}
633641
-
634642
name: Set outputs

0 commit comments

Comments
 (0)