Skip to content

Commit 7a4d5f4

Browse files
authored
add addiitional pr tag to images (nginx#5799)
1 parent 375cf7a commit 7a4d5f4

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/scripts/variables.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ case $INPUT in
5151
;;
5252

5353
build_tag)
54-
echo "build_tag=$(get_build_tag)"
54+
echo "build_tag=t-$(get_build_tag)"
5555
;;
5656

5757
stable_tag)
58-
echo "stable_tag=$(get_stable_tag)"
58+
echo "stable_tag=s-$(get_stable_tag)"
5959
;;
6060

6161
*)

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
stable_tag: ${{ steps.vars.outputs.stable_tag }}
4747
forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
4848
stable_image_exists: ${{ steps.stable_exists.outputs.exists }}
49+
additional_tag: ${{ steps.vars.outputs.additional_tag }}
4950
steps:
5051
- name: Checkout Repository
5152
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
@@ -104,6 +105,13 @@ jobs:
104105
./.github/scripts/variables.sh docker_md5 >> $GITHUB_OUTPUT
105106
./.github/scripts/variables.sh build_tag >> $GITHUB_OUTPUT
106107
./.github/scripts/variables.sh stable_tag >> $GITHUB_OUTPUT
108+
ref=${{ github.ref_name }}
109+
if [[ $ref =~ merge ]]; then
110+
additional_tag="pr-${ref%*/merge}"
111+
else
112+
additional_tag="${ref//\//-}"
113+
fi
114+
echo "additional_tag=${additional_tag}" >> $GITHUB_OUTPUT
107115
cat $GITHUB_OUTPUT
108116
109117
- name: Fetch Cached Binary Artifacts
@@ -166,6 +174,7 @@ jobs:
166174
echo stable_tag: ${{ steps.vars.outputs.stable_tag }}
167175
echo forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
168176
echo stable_image_exists: ${{ steps.stable_exists.outputs.exists }}
177+
echo additional_tag: ${{ steps.vars.outputs.additional_tag }}
169178
170179
unit-tests:
171180
name: Unit Tests
@@ -411,6 +420,20 @@ jobs:
411420
pull-requests: write # for scout report
412421
secrets: inherit
413422

423+
tag-target:
424+
name: Tag untested image with PR number
425+
needs: [checks, build-docker, build-docker-plus, build-docker-nap]
426+
permissions:
427+
contents: read # To checkout repository
428+
id-token: write # To sign into Google Container Registry
429+
uses: ./.github/workflows/retag-images.yml
430+
with:
431+
source_tag: ${{ needs.checks.outputs.build_tag }}
432+
target_tag: ${{ needs.checks.outputs.additional_tag }}
433+
dry_run: false
434+
secrets: inherit
435+
if: ${{ inputs.force || (needs.checks.outputs.forked_workflow == 'false' && needs.checks.outputs.stable_image_exists != 'true' && needs.checks.outputs.docs_only == 'false') }}
436+
414437
helm-tests:
415438
if: ${{ needs.checks.outputs.docs_only != 'true' }}
416439
name: Helm Tests ${{ matrix.base-os }}

0 commit comments

Comments
 (0)