Skip to content

Commit

Permalink
Merge pull request kubernetes-csi#57 from ggriffiths/version_gt_kuber…
Browse files Browse the repository at this point in the history
…netes_fix

Fix version_gt to work with Kubernetes prefix
  • Loading branch information
k8s-ci-robot authored Dec 23, 2019
2 parents 9f1f3dd + fc80975 commit f6c74b3
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 f6c74b3

Please sign in to comment.