Skip to content

Commit

Permalink
changing grep on version checks to remove PCRE (#69)
Browse files Browse the repository at this point in the history
this commit changes the function replace_binary() to use -E flag instead of -P on grep commands for semver and build date

Signed-off-by: Ian Cardoso <osodracnai@gmail.com>
  • Loading branch information
osodracnai authored Jul 24, 2023
1 parent ee2741d commit 81842ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ replace_binary() {
exit 0
fi

NEW_BIN_SEMVER="$($NEW_BINARY -v | grep -Po 'k3s version v\K[\d.]+')"
FULL_BIN_SEMVER="$($FULL_BIN_PATH -v | grep -Po 'k3s version v\K[\d.]+')"
NEW_BIN_SEMVER="$($NEW_BINARY -v | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')"
FULL_BIN_SEMVER="$($FULL_BIN_PATH -v | grep -Eo 'v[0-9]+\.[0-9]+\.[0-9]+')"

compare_versions "$FULL_BIN_SEMVER" "$NEW_BIN_SEMVER"

Expand All @@ -89,8 +89,8 @@ replace_binary() {
exit 1
fi

NEW_BIN_RELEASE_DATE="$($NEW_BINARY kubectl version --client=true -o yaml | grep -Po 'buildDate:\s+"\K[^"]+')"
FULL_NEW_BIN_RELEASE_DATE="$($FULL_BIN_PATH kubectl version --client=true -o yaml | grep -Po 'buildDate:\s+"\K[^"]+')"
NEW_BIN_RELEASE_DATE="$($NEW_BINARY kubectl version --client=true -o yaml | grep -Eo 'buildDate:[[:space:]]+"([^"]+)' | cut -d'"' -f2)"
FULL_NEW_BIN_RELEASE_DATE="$($FULL_BIN_PATH kubectl version --client=true -o yaml | grep -Eo 'buildDate:[[:space:]]+"([^"]+)' | cut -d'"' -f2)"

compare_build_dates "$NEW_BIN_RELEASE_DATE" "$FULL_NEW_BIN_RELEASE_DATE"

Expand Down

0 comments on commit 81842ed

Please sign in to comment.