From: Anil Belur Date: Mon, 30 Jul 2018 02:29:22 +0000 (+1000) Subject: Handle snapshot artifacts in get_file_info() X-Git-Tag: v0.15.0~1^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F29%2F12029%2F2;p=releng%2Flftools.git Handle snapshot artifacts in get_file_info() This fixes lftools deploy maven-file to upload snapshot artifacts to Nexus. Issue: RELENG-1098 Change-Id: I5ed1c030b2b9c8f62e7f7e4ee0a63858782a747c Signed-off-by: Anil Belur --- diff --git a/shell/deploy b/shell/deploy index 41dfe120..f401bc6d 100755 --- a/shell/deploy +++ b/shell/deploy @@ -301,14 +301,20 @@ get_file_info () { artifact_id=$(echo "$basefile" | cut -f 1 -d '_') else # handle other file types (tar, jar, gunzip files versions) - artifact_id=$(echo "$basefile" | rev | cut -f 2- -d '-' | rev) + # extract artifactId from string - + # regex ex: input "onap-amsterdam1-regional-controller-master-1.0.0-SNAPSHOT" + # returns "onap-amsterdam1-regional-controller-master" + artifact_id=$(echo "$basefile" | sed -r 's#(.*)-([0-9.]+(-SNAPSHOT)?)$#\1#g') fi if [ -z "$version" ] && [[ "$1" =~ rpm|deb ]]; then version=$(echo "$basefile" | cut -f 2- -d '_') else # handle other file types (tar, jar, gunzip files versions) - version=$(echo "$basefile" | rev | cut -f 1 -d '-' | rev) + # extract version from string - + # regex ex: input "onap-amsterdam1-regional-controller-master-1.0.0-SNAPSHOT" returns "1.0.0-SNAPSHOT" or + # ex: input "onap-1.0.0" returns "1.0.0" + version=$(echo "$basefile" | sed -r 's#(.*)-([0-9.]+(-SNAPSHOT)?)$#\2#g') fi }