Skip to content

Commit

Permalink
improve check_sec-scanners-config.sh
Browse files Browse the repository at this point in the history
rename from check_tag_info.sh to check_sec-scanners-config.sh and add error handling and desciption.
  • Loading branch information
friedrichwilken committed Jan 15, 2024
1 parent e9e7252 commit e22cade
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Check image Tag
env:
VERSION: ${{ steps.gen-version.outputs.VERSION }}
run: ./scripts/check_tag_info.sh $VERSION
run: ./scripts/check_sec-scanners-config.sh $VERSION

create-draft:
name: Create draft release
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/usr/bin/env bash

##############################
# Check tags in security-scan-config.yaml
# Image Tag, rc-tag
##############################
# This script checks thate the RC-Tag and the eventing-manager image have the tag of the corresponding release.

# Error handling:
set -o nounset # treat unset variables as an error and exit immediately.
set -o errexit # exit immediately when a command fails.
set -E # needs to be set if we want the ERR trap
set -o pipefail # prevents errors in a pipeline from being masked

# Get release version
DESIRED_TAG="${1:-"main"}"
Expand All @@ -19,12 +21,12 @@ RC_TAG=$(cat sec-scanners-config.yaml | grep "${RC_TAG_TO_CHECK}" | cut -d : -f

# Check IMAGE_TAG and required image tag
if [[ "$IMAGE_TAG" != "$DESIRED_TAG" ]] || [[ "$RC_TAG" != "$DESIRED_TAG" ]]; then
# ERROR: Tag issue
echo "Tags are not correct:
# ERROR: Tag issue
echo "Tags are not correct:
- wanted: $DESIRED_TAG
- security-scanner image tag: $IMAGE_TAG
- rc-tag: $RC_TAG"
exit 1
exit 1
fi

# OK: Everything is fine
Expand Down

0 comments on commit e22cade

Please sign in to comment.