|
34 | 34 | type: string
|
35 | 35 | required: false
|
36 | 36 | default: ""
|
| 37 | + push: |
| 38 | + description: Optionally push the images to the registry, defaults to true but for forks we cannot do this in PRs. |
| 39 | + type: boolean |
| 40 | + required: false |
| 41 | + default: true |
37 | 42 | secrets:
|
38 | 43 | token:
|
39 | 44 | description: The Github token or similar to authenticate with for the registry.
|
|
44 | 49 | cosign_private_key_password:
|
45 | 50 | description: If the Cosign key requires a password then specify here, otherwise not required.
|
46 | 51 | required: false
|
| 52 | +env: |
| 53 | + DOCKER_PUSH_EXTRA_FLAGS: ${{ inputs.push && '' || '--dry-run' }} |
47 | 54 | jobs:
|
48 | 55 | call-build-images-meta:
|
49 | 56 | name: Extract any supporting metadata
|
@@ -120,8 +127,8 @@ jobs:
|
120 | 127 | platforms: linux/${{ matrix.platform }}
|
121 | 128 | # Must be disabled to provide legacy format images from the registry
|
122 | 129 | provenance: false
|
123 |
| - push: true |
124 |
| - load: false |
| 130 | + push: ${{ inputs.push }} |
| 131 | + load: ${{ !inputs.push}} |
125 | 132 | build-args: |
|
126 | 133 | FLB_NIGHTLY_BUILD=${{ inputs.unstable }}
|
127 | 134 | RELEASE_VERSION=${{ inputs.version }}
|
@@ -184,12 +191,13 @@ jobs:
|
184 | 191 |
|
185 | 192 | - name: Create production manifest
|
186 | 193 | run: |
|
187 |
| - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
| 194 | + docker buildx imagetools create $DOCKER_PUSH_EXTRA_FLAGS $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
188 | 195 | $(printf '${{ inputs.registry }}/${{ inputs.image }}@sha256:%s ' *)
|
189 | 196 | shell: bash
|
190 | 197 | working-directory: /tmp/production-digests
|
191 | 198 |
|
192 | 199 | - name: Inspect image
|
| 200 | + if: inputs.push |
193 | 201 | run: |
|
194 | 202 | docker buildx imagetools inspect ${{ inputs.registry }}/${{ inputs.image }}:${{ steps.meta.outputs.version }}
|
195 | 203 | shell: bash
|
@@ -235,17 +243,19 @@ jobs:
|
235 | 243 |
|
236 | 244 | - name: Create debug manifest
|
237 | 245 | run: |
|
238 |
| - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
| 246 | + docker buildx imagetools create $DOCKER_PUSH_EXTRA_FLAGS $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ |
239 | 247 | $(printf '${{ inputs.registry }}/${{ inputs.image }}@sha256:%s ' *)
|
240 | 248 | shell: bash
|
241 | 249 | working-directory: /tmp/debug-digests
|
242 | 250 |
|
243 | 251 | - name: Inspect image
|
| 252 | + if: inputs.push |
244 | 253 | run: |
|
245 | 254 | docker buildx imagetools inspect ${{ inputs.registry }}/${{ inputs.image }}:${{ steps.debug-meta.outputs.version }}
|
246 | 255 | shell: bash
|
247 | 256 |
|
248 | 257 | call-build-images-generate-schema:
|
| 258 | + if: inputs.push |
249 | 259 | needs:
|
250 | 260 | - call-build-images-meta
|
251 | 261 | - call-build-container-image-manifests
|
@@ -276,6 +286,7 @@ jobs:
|
276 | 286 | if-no-files-found: error
|
277 | 287 |
|
278 | 288 | call-build-images-scan:
|
| 289 | + if: inputs.push |
279 | 290 | needs:
|
280 | 291 | - call-build-images-meta
|
281 | 292 | - call-build-container-image-manifests
|
@@ -311,6 +322,7 @@ jobs:
|
311 | 322 | exit-level: WARN
|
312 | 323 |
|
313 | 324 | call-build-images-sign:
|
| 325 | + if: inputs.push |
314 | 326 | needs:
|
315 | 327 | - call-build-images-meta
|
316 | 328 | - call-build-container-image-manifests
|
@@ -400,6 +412,10 @@ jobs:
|
400 | 412 | - name: Build the production images
|
401 | 413 | run: |
|
402 | 414 | docker build -t ${{ inputs.registry }}/${{ inputs.image }}:windows-${{ matrix.windows-base-version }}-${{ inputs.version }} --build-arg FLB_NIGHTLY_BUILD=${{ inputs.unstable }} --build-arg WINDOWS_VERSION=ltsc${{ matrix.windows-base-version }} -f ./dockerfiles/Dockerfile.windows .
|
| 415 | +
|
| 416 | + - name: Push the production images |
| 417 | + if: inputs.push |
| 418 | + run: | |
403 | 419 | docker push ${{ inputs.registry }}/${{ inputs.image }}:windows-${{ matrix.windows-base-version }}-${{ inputs.version }}
|
404 | 420 |
|
405 | 421 | # We cannot use this action as it requires privileged mode
|
|
0 commit comments