From: Jessica Wagantall Date: Thu, 9 Jul 2020 16:25:35 +0000 (-0700) Subject: Update semver regex for release-job.sh X-Git-Tag: v0.55.2~5 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F64493%2F2;p=releng%2Fglobal-jjb.git Update semver regex for release-job.sh Update semver regex to the one recommended by https://semver.org/ This regex was taken from https://github.com/fsaintjacques/semver-tool which follows the semver guidances and works in bash. Issue: IT-20145 Signed-off-by: Jessica Wagantall Change-Id: I9d1fe49693279f71243df0280eebed266e55ff4e --- diff --git a/releasenotes/notes/release-version-regex-af5a68f1cf28caf5.yaml b/releasenotes/notes/release-version-regex-af5a68f1cf28caf5.yaml new file mode 100644 index 00000000..0bf62c9f --- /dev/null +++ b/releasenotes/notes/release-version-regex-af5a68f1cf28caf5.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - | + Release verify will not allow valid semver versions like "1.3.2-1" + which should be accepted. Update semver regex to conform to https://semver.org/ + This regex was taken from https://github.com/fsaintjacques/semver-tool + which follows the semver guidances and works in bash. diff --git a/shell/release-job.sh b/shell/release-job.sh index 5276a684..3ad45306 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -218,7 +218,7 @@ verify_schema(){ verify_version(){ # Verify allowed patterns "#.#.#" (SemVer) or "v#.#.#" echo "INFO: Verifying version $VERSION" - allowed_version_regex="^((v?)([0-9]+)\.([0-9]+)\.([0-9]+))$" + allowed_version_regex="^[vV]?(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\-(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(\.(0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$" if [[ $VERSION =~ $allowed_version_regex ]]; then echo "INFO: The version $VERSION is valid" else