forked from kyma-project/eventing-publisher-proxy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add release flow * Release using branch name as input * Fix `needs` input * Fix `needs` input * Change workflow to be triggered manually * No inputs for manual trigger
- Loading branch information
1 parent
e9e8644
commit 0cb80a3
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/usr/bin/env bash | ||
|
||
############################## | ||
# Check tags in security-scan-config.yaml | ||
# Image Tag, rc-tag | ||
############################## | ||
|
||
|
||
# Get release version | ||
DESIRED_TAG="${1:-"main"}" | ||
|
||
# Get eventing-publisher-proxy tag from sec-scanners-config.yaml | ||
SEC_SCAN_TO_CHECK="${2:-europe-docker.pkg.dev/kyma-project/prod/eventing-publisher-proxy}" | ||
IMAGE_TAG=$(cat sec-scanners-config.yaml | grep "${SEC_SCAN_TO_CHECK}" | cut -d : -f 2) | ||
|
||
# Get rc-tag | ||
RC_TAG_TO_CHECK="${3:-rc-tag}" | ||
RC_TAG=$(cat sec-scanners-config.yaml | grep "${RC_TAG_TO_CHECK}" | cut -d : -f 2 | xargs) | ||
|
||
# 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: | ||
- wanted: $DESIRED_TAG | ||
- security-scanner image tag: $IMAGE_TAG | ||
- rc-tag: $RC_TAG" | ||
exit 1 | ||
fi | ||
|
||
# OK: Everything is fine | ||
echo "Tags are correct" | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Checking status of POST Jobs for Eventing-Manager" | ||
|
||
REF_NAME="${1:-"main"}" | ||
TIMEOUT_TIME="${2:-600}" | ||
INTERVAL_TIME="${3:-3}" | ||
INITIAL_WAIT_TIME="${4:-30}" | ||
|
||
# Generate job Status URL | ||
STATUS_URL="https://api.github.com/repos/kyma-project/eventing-manager/commits/${REF_NAME}/status" | ||
|
||
# Dates | ||
START_TIME=$(date +%s) | ||
TODAY_DATE=$(date '+%Y-%m-%d') | ||
|
||
# Retry function | ||
function retry { | ||
|
||
# Get status result | ||
local statusresult=$(curl -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" ${STATUS_URL}) | ||
|
||
# Get overall state | ||
fullstatus=$(echo $statusresult | jq '.state' | tr -d '"') | ||
|
||
# Collect latest run related data | ||
local latestrun=$(echo $statusresult | jq '.statuses[-1]') | ||
local latestrun_state=$(echo $latestrun | jq '.state' | tr -d '"') | ||
local latestrun_createdat=$(echo $latestrun | jq '.created_at' | tr -d '"') | ||
local latestrun_targeturl=$(echo $latestrun | jq '.target_url' | tr -d '"') | ||
|
||
# Check Today's run data | ||
if [[ $latestrun_createdat == *"$TODAY_DATE"* ]]; then | ||
echo $latestrun_createdat | ||
echo $latestrun_state | ||
echo $latestrun_targeturl | ||
fi | ||
|
||
# Show all execution for Today | ||
echo $statusresult | jq --arg t $TODAY_DATE '.statuses[]|select(.created_at | contains($t))' | ||
|
||
# Date time for time-out | ||
local CURRENT_TIME=$(date +%s) | ||
local elapsed_time=$((CURRENT_TIME - START_TIME)) | ||
|
||
# Check time-out | ||
if [ $elapsed_time -ge $TIMEOUT_TIME ]; then | ||
echo "Timeout reached. Exiting." | ||
exit 1 | ||
fi | ||
|
||
if [ "$fullstatus" == "success" ]; then | ||
echo "Success!" | ||
elif [ "$fullstatus" == "failed" ]; then | ||
# Show overall state to user | ||
echo "$statusresult" | ||
echo "Failure! Exiting with an error." | ||
exit 1 | ||
elif [ "$fullstatus" == "pending" ]; then | ||
echo "Status is '$fullstatus'. Retrying in $INTERVAL_TIME seconds..." | ||
sleep $INTERVAL_TIME | ||
else | ||
echo "Invalid result: $result" | ||
exit 1 | ||
fi | ||
|
||
} | ||
|
||
# Initial wait | ||
sleep $INITIAL_WAIT_TIME | ||
# Call retry function | ||
retry | ||
while [ "$fullstatus" == "pending" ]; do | ||
retry | ||
done |