Add verification for full distribution
[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 BUNDLEFOLDER="${KARAF_ARTIFACT}-${BUNDLE_VERSION}"
6 BUNDLE="${BUNDLEFOLDER}.zip"
7 BUNDLE_PATH="/tmp/r/org/opendaylight/integration/${KARAF_ARTIFACT}/${BUNDLE_VERSION}/${BUNDLE}"
8 ls -l "${BUNDLE_PATH}"
9 LOG_FILE='integration-upload-distribution.log'
10 echo "Uploading distribution to Nexus..."
11 "$MVN" deploy:deploy-file \
12     --log-file ${LOG_FILE} \
13     --global-settings "$GLOBAL_SETTINGS_FILE" \
14     --settings "$SETTINGS_FILE" \
15     -Dfile="${BUNDLE_PATH}" \
16     -DrepositoryId=opendaylight-snapshot \
17     -Durl="$ODLNEXUSPROXY/content/repositories/opendaylight.snapshot/" \
18     -DgroupId="org.opendaylight.integration.${GERRIT_PROJECT//\//.}" \
19     -DartifactId=${KARAF_ARTIFACT} \
20     -Dversion="${BUNDLE_VERSION}" \
21     -Dpackaging=zip \
22     || true  # Sandbox is not allowed to uplad to Nexus.
23
24 cat "${LOG_FILE}"
25
26 BUNDLE_URL=$(grep "Uploaded.*${KARAF_ARTIFACT}/${BUNDLE_VERSION}.*.zip" ${LOG_FILE} | awk '{print $5}') || true
27 echo "Bundle uploaded to ${BUNDLE_URL}"
28
29 # Re-inject the new BUNDLE_URL for downstream jobs to pull from Nexus
30 cat > "${WORKSPACE}/integration-upload-distribution.env" <<EOF
31 BUNDLE_URL=${BUNDLE_URL}
32 BUNDLE_VERSION=${BUNDLE_VERSION}
33 BUNDLEFOLDER=${BUNDLEFOLDER}
34 BUNDLE=${BUNDLE}
35 BUNDLE_PATH=${BUNDLE_PATH}
36 EOF