Skip to content

Commit

Permalink
add addiitional pr tag to images (#5799)
Browse files Browse the repository at this point in the history
  • Loading branch information
pdabelf5 authored Jun 20, 2024
1 parent 375cf7a commit 7a4d5f4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/variables.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ case $INPUT in
;;

build_tag)
echo "build_tag=$(get_build_tag)"
echo "build_tag=t-$(get_build_tag)"
;;

stable_tag)
echo "stable_tag=$(get_stable_tag)"
echo "stable_tag=s-$(get_stable_tag)"
;;

*)
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ jobs:
stable_tag: ${{ steps.vars.outputs.stable_tag }}
forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
stable_image_exists: ${{ steps.stable_exists.outputs.exists }}
additional_tag: ${{ steps.vars.outputs.additional_tag }}
steps:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
Expand Down Expand Up @@ -104,6 +105,13 @@ jobs:
./.github/scripts/variables.sh docker_md5 >> $GITHUB_OUTPUT
./.github/scripts/variables.sh build_tag >> $GITHUB_OUTPUT
./.github/scripts/variables.sh stable_tag >> $GITHUB_OUTPUT
ref=${{ github.ref_name }}
if [[ $ref =~ merge ]]; then
additional_tag="pr-${ref%*/merge}"
else
additional_tag="${ref//\//-}"
fi
echo "additional_tag=${additional_tag}" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
- name: Fetch Cached Binary Artifacts
Expand Down Expand Up @@ -166,6 +174,7 @@ jobs:
echo stable_tag: ${{ steps.vars.outputs.stable_tag }}
echo forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
echo stable_image_exists: ${{ steps.stable_exists.outputs.exists }}
echo additional_tag: ${{ steps.vars.outputs.additional_tag }}
unit-tests:
name: Unit Tests
Expand Down Expand Up @@ -411,6 +420,20 @@ jobs:
pull-requests: write # for scout report
secrets: inherit

tag-target:
name: Tag untested image with PR number
needs: [checks, build-docker, build-docker-plus, build-docker-nap]
permissions:
contents: read # To checkout repository
id-token: write # To sign into Google Container Registry
uses: ./.github/workflows/retag-images.yml
with:
source_tag: ${{ needs.checks.outputs.build_tag }}
target_tag: ${{ needs.checks.outputs.additional_tag }}
dry_run: false
secrets: inherit
if: ${{ inputs.force || (needs.checks.outputs.forked_workflow == 'false' && needs.checks.outputs.stable_image_exists != 'true' && needs.checks.outputs.docs_only == 'false') }}

helm-tests:
if: ${{ needs.checks.outputs.docs_only != 'true' }}
name: Helm Tests ${{ matrix.base-os }}
Expand Down

0 comments on commit 7a4d5f4

Please sign in to comment.