Skip to content

Commit

Permalink
Don't default OpenShift version for butane config.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaypoulz committed Mar 26, 2024
1 parent f26f990 commit c577d99
Showing 1 changed file with 16 additions and 1 deletion.
Expand Up @@ -7,11 +7,26 @@ set -o pipefail
node_role=${APPLY_NODE_ROLE:=worker}
log_path=${LOG_PATH:="/var/crash"}

openshift_release="4.11.0"
openshift_release=""
echo "Trying to extract release image version from RELEASE_IMAGE_LATEST=$RELEASE_IMAGE_LATEST"
if [[ $(echo $RELEASE_IMAGE_LATEST | grep -o -e "4\.[0-9]\+\.") ]]; then
openshift_release="$(echo $RELEASE_IMAGE_LATEST | grep -o -e '4\.[0-9]\+\.').0"
fi

if [[ -z "$openshift_release" ]]; then
echo "Unable to determine OpenShift release version from RELEASE_IMAGE_LATEST. Defaulting to JOB_NAME=$JOB_NAME"
# This regex first scans for the first pattern that ends with 4.xx, then uses grep to extract just the end of that line
# It can be collapsed to a single line with perl (perl -pe 's|^(?:.*?)(4\.[0-9]+)(?:.*)$|\1|'), but
# that isn't installed on all of the CI containers. sed was another alternative, but it supports GNU/POSIX regex
# which do not include the non-greedy match character '?'
openshift_release="$(echo $JOB_NAME | grep -oP -e '^(?:.*?)(4\.[0-9]+)' | grep -oP -e '4\.[0-9]+').0"
fi

if [[ -z "$openshift_release" ]]; then
echo "Unable to determine OpenShift release version from JOB_NAME. Skipping crash kernel configuration."
exit 0
fi

echo "Crash kernel set to ${CRASH_KERNEL_MEMORY}"

echo "Configuring kernel dumps on $node_role nodes"
Expand Down

0 comments on commit c577d99

Please sign in to comment.