Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

workflows: fix optional image pushing #10107

Merged
merged 1 commit into from
Mar 20, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/call-build-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ on:
cosign_private_key_password:
description: If the Cosign key requires a password then specify here, otherwise not required.
required: false
env:
DOCKER_PUSH_EXTRA_FLAGS: ${{ inputs.push && '' || '--dry-run' }}
jobs:
call-build-images-meta:
name: Extract any supporting metadata
Expand Down Expand Up @@ -123,12 +121,13 @@ jobs:
file: ./dockerfiles/Dockerfile
context: .
target: ${{ matrix.target }}
outputs: type=image,name=${{ inputs.registry }}/${{ inputs.image }},push-by-digest=true,name-canonical=true,push=true
outputs: type=image,name=${{ inputs.registry }}/${{ inputs.image }},push-by-digest=true,name-canonical=true,push=${{ inputs.push }}
platforms: linux/${{ matrix.platform }}
# Must be disabled to provide legacy format images from the registry
provenance: false
# This is configured in outputs above
push: ${{ inputs.push }}
load: ${{ !inputs.push}}
load: false
build-args: |
FLB_NIGHTLY_BUILD=${{ inputs.unstable }}
RELEASE_VERSION=${{ inputs.version }}
Expand Down Expand Up @@ -191,7 +190,7 @@ jobs:

- name: Create production manifest
run: |
docker buildx imagetools create $DOCKER_PUSH_EXTRA_FLAGS $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
${{ inputs.push && '' || 'echo' }} docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ inputs.registry }}/${{ inputs.image }}@sha256:%s ' *)
shell: bash
working-directory: /tmp/production-digests
Expand Down Expand Up @@ -243,7 +242,7 @@ jobs:

- name: Create debug manifest
run: |
docker buildx imagetools create $DOCKER_PUSH_EXTRA_FLAGS $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
${{ inputs.push && '' || 'echo' }} docker buildx imagetools create $DOCKER_PUSH_EXTRA_FLAGS $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ inputs.registry }}/${{ inputs.image }}@sha256:%s ' *)
shell: bash
working-directory: /tmp/debug-digests
Expand Down
Loading