Merge "Update JJB version 2.0.5"
[releng/builder.git] / jjb / integration / integration-upload-distribution.sh
1 #!/bin/bash
2 set -xeu -o pipefail
3
4 BUNDLE_VERSION=$(xpath "${BUNDLE_POM}" '/project/version/text()' 2> /dev/null)
5 BUNDLE="${KARAF_ARTIFACT}-${BUNDLE_VERSION}.zip"
6 BUNDLE_FILEPATH="/tmp/r/org/opendaylight/integration/${KARAF_ARTIFACT}/${BUNDLE_VERSION}/${BUNDLE}"
7 ls -l "${BUNDLE_FILEPATH}"
8 LOG_FILE='integration-upload-distribution.log'
9 echo "Uploading distribution to Nexus..."
10 "$MVN" deploy:deploy-file \
11     --log-file ${LOG_FILE} \
12     --global-settings "$GLOBAL_SETTINGS_FILE" \
13     --settings "$SETTINGS_FILE" \
14     -Dfile="${BUNDLE_FILEPATH}" \
15     -DrepositoryId=opendaylight-snapshot \
16     -Durl="$ODLNEXUSPROXY/content/repositories/opendaylight.snapshot/" \
17     -DgroupId="org.opendaylight.integration.${GERRIT_PROJECT//\//.}" \
18     -DartifactId=${KARAF_ARTIFACT} \
19     -Dversion="${BUNDLE_VERSION}" \
20     -Dpackaging=zip \
21     || true  # Sandbox is not allowed to uplad to Nexus.
22
23 cat "${LOG_FILE}"
24
25 BUNDLE_URL=$(grep "Uploaded.*${KARAF_ARTIFACT}/${BUNDLE_VERSION}.*.zip" ${LOG_FILE} | awk '{print $5}') || true
26 echo "Bundle uploaded to ${BUNDLE_URL}"
27
28 # Re-inject the new BUNDLE_URL for downstream jobs to pull from Nexus
29 cat > "${WORKSPACE}/integration-upload-distribution.env" <<EOF
30 BUNDLE_URL=${BUNDLE_URL}
31 EOF