From f90d002be64f126671ebe3a48d9af4add1ded6c1 Mon Sep 17 00:00:00 2001 From: Jeremy Phelps Date: Fri, 11 May 2018 13:33:03 -0500 Subject: [PATCH] Add ALT_NEXUS_URL to create-netrc This change is backwards compatible with existing system configs but lets the user spec this env var which will take precedence. This is useful, for example, to point at nexus3.edgexfoundry.org if you have NEXUS_URL=nexus.edgexfoundry.org. Change-Id: Ibbba26670ab374fd98e1bf20f78ffff7f8b7c52a Signed-off-by: Jeremy Phelps --- docs/jjb/lf-macros.rst | 7 +++++++ shell/create-netrc.sh | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/docs/jjb/lf-macros.rst b/docs/jjb/lf-macros.rst index 72d898c6..724dad65 100644 --- a/docs/jjb/lf-macros.rst +++ b/docs/jjb/lf-macros.rst @@ -25,6 +25,13 @@ Create a ~/.netrc file from a Maven settings.xml :server-id: The id of a server as defined in settings.xml. +:Optional parameters: + + :ALT_NEXUS_SERVER: URL of custom nexus server. + If set this will take precedence. + Use this to point at nexus3.$PROJECTDOMAIN + for example. + lf-infra-deploy-maven-file -------------------------- diff --git a/shell/create-netrc.sh b/shell/create-netrc.sh index 2c7f7823..b309c54b 100644 --- a/shell/create-netrc.sh +++ b/shell/create-netrc.sh @@ -13,7 +13,15 @@ echo "---> create-netrc.sh" # Ensure we fail the job if any steps fail. set -eu -o pipefail -NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}" +ALT_NEXUS_URL="${ALT_NEXUS_URL}" + +if [ -z "$ALT_NEXUS_URL" ] +then + NEXUS_URL="${NEXUSPROXY:-$NEXUS_URL}" +else + NEXUS_URL="${ALT_NEXUS_URL}" +fi + CREDENTIAL=$(xmlstarlet sel -N "x=http://maven.apache.org/SETTINGS/1.0.0" \ -t -m "/x:settings/x:servers/x:server[x:id='${SERVER_ID}']" \ -v x:username -o ":" -v x:password \ -- 2.16.6