diff options
author | Tony Hansen <tony@att.com> | 2017-10-24 17:43:05 +0000 |
---|---|---|
committer | Tony Hansen <tony@att.com> | 2017-10-24 19:10:37 +0000 |
commit | 810ab2d67c10b820309d7c913083c17c029e59d1 (patch) | |
tree | aab06a5cb6d2e30ad9c0716c920c7c8da19872cc | |
parent | 2db25ae8c4c844b968d3e93c02ad92aec0eb7689 (diff) |
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 <tony@att.com>
Issue-ID: CCSDK-128
Signed-off-by: Tony Hansen <tony@att.com>
-rwxr-xr-x | mvn-phase-script.sh | 34 |
1 files 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 |