Skip to content

Commit

Permalink
Fix version_gt to work with kubernetes prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Grant Griffiths <[email protected]>
  • Loading branch information
ggriffiths committed Dec 21, 2019
1 parent 9f1f3dd commit fc80975
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion prow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ make_test_to_junit () {
# The follow substrings are stripped before version comparison:
# - "v"
# - "release-"
# - "kubernetes-"
#
# Usage:
# version_gt release-1.3 v1.2.0 (returns true)
Expand All @@ -1022,8 +1023,9 @@ make_test_to_junit () {
# version_gt 1.1.1 release-1.2.0 (returns false)
# version_gt 1.2.0 1.2.2 (returns false)
function version_gt() {
versions=$(for ver in "$@"; do ver=${ver#release-}; echo "${ver#v}"; done)
versions=$(for ver in "$@"; do ver=${ver#release-}; ver=${ver#kubernetes-}; echo "${ver#v}"; done)
greaterVersion=${1#"release-"};
greaterVersion=${greaterVersion#"kubernetes-"};
greaterVersion=${greaterVersion#"v"};
test "$(printf '%s' "$versions" | sort -V | head -n 1)" != "$greaterVersion"
}
Expand Down

0 comments on commit fc80975

Please sign in to comment.