Merge "Migrate autorelease jobs to lf-infra-publish"
[releng/builder.git] / jjb / autorelease / include-raw-autorelease-get-integration-test-variables.sh
index 38c8d798ae5d5af025909937ea1269f1c5e0e6a5..941106e5a8a507a2d06b977dc8bfff0b2b16029a 100644 (file)
@@ -9,14 +9,25 @@
 # http://www.eclipse.org/legal/epl-v10.html
 ##############################################################################
 
-NEXUSURL=https://nexus.opendaylight.org/content/repositories/
-VERSION=`grep -m1 '<version>' ${WORKSPACE}/integration/distribution/distribution-karaf/pom.xml | awk -F'[<|>]' '/version/ { printf $3 }'`
-if [ "x${VERSION}" == "x" ]; then
-    echo "Lithium or sooner, different path needs to be searched."
-    VERSION=`grep -m1 '<version>' ${WORKSPACE}/integration/distribution/distributions/karaf/pom.xml | awk -F'[<|>]' '/version/ { printf $3 }'`
-fi
+# ODLNEXUSPROXY is used to define the location of the Nexus server used by the CI system.
+# by default it should be set to https://nexus.opendaylight.org
+# in cases where an internal ci system is using multiple NEXUS systems one for artifacts and another for staging,
+# we can override using ODLNEXUS_STAGING_URL to route the staging build to the 2nd server.
+# (most CI setups where a single Nexus server is used, ODLNEXUS_STAGING_URL should be left unset)
+NEXUS_STAGING_URL=${ODLNEXUS_STAGING_URL:-$ODLNEXUSPROXY}
+
+NEXUSURL=${NEXUS_STAGING_URL}/content/repositories/
+VERSION=$(grep -m2 '<version>' "${WORKSPACE}/integration/distribution/${KARAF_ARTIFACT}/pom.xml" | tail -n1 | awk -F'[<|>]' '/version/ { printf $3 }')
 echo "VERSION: ${VERSION}"
-REPOID=`grep "Created staging repository with ID" $WORKSPACE/deploy-staged-repository.log | cut -d '"' -f2`
+STAGING_REPO_ID=$(grep "Created staging repository with ID" "$WORKSPACE/deploy-staged-repository.log" | cut -d '"' -f2)
+BUNDLE_URL="${NEXUSURL}/${STAGING_REPO_ID}/org/opendaylight/integration/${KARAF_ARTIFACT}/${VERSION}/${KARAF_ARTIFACT}-${VERSION}.zip"
+echo STAGING_REPO_ID="$STAGING_REPO_ID" >> "$WORKSPACE/variables.prop"
+echo BUNDLE_URL="$BUNDLE_URL" >> "$WORKSPACE/variables.prop"
+echo KARAF_VERSION="$KARAF_VERSION" >> "$WORKSPACE/variables.prop"
+echo "BUNDLE_URL: ${BUNDLE_URL}"
 
-echo BUNDLEURL=${NEXUSURL}/${REPOID}/org/opendaylight/integration/distribution-karaf/${VERSION}/distribution-karaf-${VERSION}.zip > $WORKSPACE/variables.prop
-echo "BUNDLEURL: ${BUNDLEURL}"
+# Copy variables.prop to variables.jenkins-trigger so that the end of build
+# trigger can pick up the file as input for triggering downstream jobs.
+# This allows variables.prop to get archive to logs.opendaylight.org while not
+# breaking the downstream trigger due to missing file from archiving.
+cp variables.prop variables.jenkins-trigger