Skip to content

Commit

Permalink
Fix kpt branch logic (#1200)
Browse files Browse the repository at this point in the history
  • Loading branch information
Clay authored May 16, 2022
1 parent 3205315 commit ff9b627
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
4 changes: 2 additions & 2 deletions asmcli/asmcli

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions asmcli/lib/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -367,14 +367,14 @@ init() {
readonly APATH

local REVISION_LABEL
KPT_BRANCH="${_CI_ASM_KPT_BRANCH:=main}"
KPT_BRANCH="${_CI_ASM_KPT_BRANCH:-main}"
if [[ "${POINT}" == "alpha" ]]; then
RELEASE="${MAJOR}.${MINOR}-alpha.${REV}"
REVISION_LABEL="${_CI_REVISION_PREFIX}asm-${MAJOR}${MINOR}${POINT}"
elif [[ "$(version_message)" =~ ^[0-9]+\.[0-9]+\.[0-9]+-asm\.[0-9]+\+config[0-9]+$ ]]; then
RELEASE="${MAJOR}.${MINOR}.${POINT}-asm.${REV}"
REVISION_LABEL="${_CI_REVISION_PREFIX}asm-${MAJOR}${MINOR}${POINT}-${REV}"
KPT_BRANCH="${_CI_ASM_KPT_BRANCH:=$(version_message)}"
KPT_BRANCH="${_CI_ASM_KPT_BRANCH:-$(version_message)}"
else
RELEASE="${MAJOR}.${MINOR}.${POINT}-asm.${REV}"
REVISION_LABEL="${_CI_REVISION_PREFIX}asm-${MAJOR}${MINOR}${POINT}-${REV}"
Expand Down
24 changes: 24 additions & 0 deletions asmcli/tests/lib/util.bats
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,27 @@ EOF
assert_output "stable"
### [END] channel should be stable for stable GKE channel ###
}

@test "UTIL: KPT_BRANCH is set correctly for release versions" {
local TEST_VER; TEST_VER="1.1.1-asm.1+config1"
version_message() {
echo "${TEST_VER}"
}
init

if [[ "${TEST_VER}" != "$KPT_BRANCH" ]]; then
exit 1
fi
}

@test "UTIL: KPT_BRANCH is set correctly for nonrelease versions" {
version_message() {
echo "1.1.1-asm.1+config1+unstable"
}

init

if [[ "main" != "$KPT_BRANCH" ]]; then
exit 1
fi
}

0 comments on commit ff9b627

Please sign in to comment.