Skip to content

Instantly share code, notes, and snippets.

@rexagod
Created February 3, 2022 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rexagod/34cb0f811425f61e121fe425e2e67eba to your computer and use it in GitHub Desktop.
Save rexagod/34cb0f811425f61e121fe425e2e67eba to your computer and use it in GitHub Desktop.
This script is used to bump the version of the whitelisted health checks based on the latest release version, or the current branch.
#!/bin/bash
# This script is used to bump the version of the whitelisted health checks based on the latest release version, or the current branch.
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [ "$CURRENT_BRANCH" = "$DEFAULT_BRANCH" ]; then
LATEST_RELEASE_BRANCH=$(git ls-remote git@github.com:openshift/console.git |\
awk -F '/' '/\/release-/ {print $3}' |\
sort --version-sort |\
tail -n 1)
LATEST_VERSION=$(echo "$LATEST_RELEASE_BRANCH" | sed 's/release-//')
sed -i "s@\(.*\)/[0-9]\+.[0-9]\+/\(.*\)@\1/$LATEST_VERSION/\2@g" whitelisted-health-checks.ts
elif [[ "$CURRENT_BRANCH" =~ release-* ]]; then
CURRENT_VERSION=$(echo "$CURRENT_BRANCH" | sed 's/release-//')
sed -i "s@\(.*\)/[0-9]\+.[0-9]\+/\(.*\)@\1/$CURRENT_VERSION/\2@g" whitelisted-health-checks.ts
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment