From 810ab2d67c10b820309d7c913083c17c029e59d1 Mon Sep 17 00:00:00 2001 From: Tony Hansen Date: Tue, 24 Oct 2017 17:43:05 +0000 Subject: fix uploading of plugin/type files fixed the MVN_SERVER_ID variable used to extract values from the settings.xml file to be MVN_RAWREPO_SERVERID with a backup value of ecomp-raw. upload to both NEXUS/GROUPID/types/foo/foo.h AND NEXUS/GROUPID/{snapshots,releases}/types/foo/foo.h Change-Id: I33545b919679b13c02aaf28d8b3ef42195c606bb Signed-off-by: Tony Hansen Issue-ID: CCSDK-128 Signed-off-by: Tony Hansen --- mvn-phase-script.sh | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh index 38aa669..b23eb86 100755 --- a/mvn-phase-script.sh +++ b/mvn-phase-script.sh @@ -42,6 +42,27 @@ echo "=> Nexus Proxy at $MVN_NEXUSPROXY_HOST, $MVN_NEXUSPROXY" # mvn phase in life cycle MVN_PHASE="$2" +function setnetrc { + # Turn off -x so won't leak the credentials + set +x + serverid=${MVN_RAWREPO_SERVERID:-ecomp-raw} + hostport=$(echo $1 | cut -f3 -d /) + host=$(echo $hostport | cut -f1 -d:) + settings=${SETTINGS_FILE:-$HOME/.m2/settings.xml} + echo machine $host login $(xpath -q -e "//servers/server[id='$serverid']/username/text()" $settings) password $(xpath -q -e "//servers/server[id='$serverid']/password/text()" $settings) >$HOME/.netrc + chmod 600 $HOME/.netrc + set -x +} + +function putraw { + case "$MVN_PROJECT_VERSION" in + *SNAPSHOT ) export subdir=snapshots ;; + * ) export subdir=releases ;; + esac + curl -X PUT -H "Content-Type: $3" --netrc --upload-file $1 --url $REPO/$2 + curl -X PUT -H "Content-Type: $3" --netrc --upload-file $1 --url $REPO/$subdir/$2 +} + case $MVN_PHASE in clean) echo "==> clean phase script" @@ -93,19 +114,6 @@ deploy) echo "==> deploy phase script" # Just upload files to Nexus set -e -x - function setnetrc { - # Turn off -x so won't leak the credentials - set +x - hostport=$(echo $1 | cut -f3 -d /) - host=$(echo $hostport | cut -f1 -d:) - settings=${SETTINGS_FILE:-$HOME/.m2/settings.xml} - echo machine $host login $(xpath -q -e "//servers/server[id='$MVN_SERVER_ID']/username/text()" $settings) password $(xpath -q -e "//servers/server[id='$MVN_SERVER_ID']/password/text()" $settings) >$HOME/.netrc - chmod 600 $HOME/.netrc - set -x - } - function putraw { - curl -X PUT -H "Content-Type: $3" --netrc --upload-file $1 --url $REPO/$2 - } setnetrc $REPO PLUGIN_FILE=$(echo $PLUGIN_NAME-*.wgn) putraw $PLUGIN_FILE plugins/$PLUGIN_FILE application/gzip -- cgit 1.2.3-korg