Skip to content

Commit

Permalink
Update check-unique-tags.yml
Browse files Browse the repository at this point in the history
Signed-off-by: John Osborne <josborne@chainguard.dev>
  • Loading branch information
johnfosborneiii authored Nov 18, 2024
1 parent 55f5201 commit cb69ee3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/check-unique-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,10 @@ jobs:
echo "Extracted Unique Tags: $CURRENT_UNIQUE_IMAGE"
echo "CURRENT_UNIQUE_TAG=$CURRENT_UNIQUE_IMAGE" >> $GITHUB_ENV
- name: 'Env Setup'
run: |
echo "REDIS_IMAGE_FULL_REF=${{ env.REDIS_IMAGE }}:${{ env.REDIS_IMAGE_TAG }}" >> $GITHUB_ENV
- name: Get latest unique tag
id: get_current_unique_tag
run: |
LATEST_UNIQUE_TAG=$(crane ls ${{ env.REDIS_IMAGE_FULL_REF }} | grep -E '^[^ ]+-[0-9]{12}$' | grep -v '^latest' | sort -Vr | head -n 1)
LATEST_UNIQUE_TAG=$(crane ls ${{ env.REDIS_IMAGE }} | grep -E '^[^ ]+-[0-9]{12}$' | grep -v '^latest' | sort -Vr | head -n 1)
echo "LATEST_UNIQUE_TAG=${LATEST_UNIQUE_TAG}" >> $GITHUB_ENV
- name: Compare unique tags
Expand All @@ -75,8 +71,8 @@ jobs:
if: env.UNIQUE_TAGS_CHANGED == 'true'
id: diff_vulnerabilities
run: |
OLD_IMAGE="${{ env.REDIS_IMAGE_FULL_REF }}@${{ env.CURRENT_UNIQUE_TAG }}"
NEW_IMAGE="${{ env.REDIS_IMAGE_FULL_REF }}@${{ env.LATEST_UNIQUE_TAG }}"
OLD_IMAGE="${{ env.REDIS_IMAGE }}@${{ env.CURRENT_UNIQUE_TAG }}"
NEW_IMAGE="${{ env.REDIS_IMAGE }}@${{ env.LATEST_UNIQUE_TAG }}"
DIFF_OUTPUT=$(chainctl images diff $OLD_IMAGE $NEW_IMAGE 2>/dev/null | jq '.vulnerabilities.removed[] | select(.severity == "Critical" or .severity == "High") .id' -r)
echo "DIFF_OUTPUT=$DIFF_OUTPUT" >> $GITHUB_ENV
Expand Down

0 comments on commit cb69ee3

Please sign in to comment.