Update cloud image Ubuntu18.04 docker x86_64
[releng/builder.git] / jjb / integration / integration-upload-distribution.sh
1 #!/bin/bash
2 set -xeu -o pipefail
3
4 # TODO: remove the second xpath command once the old version in CentOS 7 is not used any more
5 BUNDLE_VERSION=$(xpath -e '/project/version/text()' "${BUNDLE_POM}" 2>/dev/null ||
6         xpath "${BUNDLE_POM}" '/project/version/text()' 2>/dev/null)
7 BUNDLEFOLDER="${KARAF_ARTIFACT}-${BUNDLE_VERSION}"
8 BUNDLE="${BUNDLEFOLDER}.zip"
9 BUNDLE_PATH="/tmp/r/org/opendaylight/${KARAF_PROJECT}/${KARAF_ARTIFACT}/${BUNDLE_VERSION}/${BUNDLE}"
10 if [[ "$KARAF_PROJECT" == "integration" ]]; then
11     GROUP_ID="org.opendaylight.${KARAF_PROJECT}.${GERRIT_PROJECT//\//.}"
12 else
13     GROUP_ID="org.opendaylight.${KARAF_PROJECT}"
14 fi
15
16 echo "Bundle folder is ${BUNDLEFOLDER}"
17 echo "Bundle is ${BUNDLE}"
18 echo "Bundle path is ${BUNDLE_PATH}"
19 echo "Group ID is ${GROUP_ID}"
20
21 ls -l "${BUNDLE_PATH}"
22 LOG_FILE='integration-upload-distribution.log'
23 echo "Uploading distribution to Nexus..."
24 "$MVN" deploy:deploy-file \
25     --log-file ${LOG_FILE} \
26     --global-settings "$GLOBAL_SETTINGS_FILE" \
27     --settings "$SETTINGS_FILE" \
28     -Dfile="${BUNDLE_PATH}" \
29     -DrepositoryId=opendaylight-snapshot \
30     -Durl="$ODLNEXUSPROXY/content/repositories/opendaylight.snapshot/" \
31     -DgroupId="${GROUP_ID}" \
32     -DartifactId="${KARAF_ARTIFACT}" \
33     -Dversion="${BUNDLE_VERSION}" \
34     -Dpackaging=zip \
35     || true  # Sandbox is not allowed to uplad to Nexus.
36
37 cat "${LOG_FILE}"
38
39 BUNDLE_URL=$(grep "Uploaded.*${KARAF_ARTIFACT}/${BUNDLE_VERSION}.*.zip" ${LOG_FILE} | awk '{print $5}') || true
40 echo "Bundle uploaded to ${BUNDLE_URL}"
41
42 # Re-inject the new BUNDLE_URL for downstream jobs to pull from Nexus
43 cat > "${WORKSPACE}/integration-upload-distribution.env" <<EOF
44 BUNDLE_URL=${BUNDLE_URL}
45 BUNDLE_VERSION=${BUNDLE_VERSION}
46 BUNDLEFOLDER=${BUNDLEFOLDER}
47 BUNDLE=${BUNDLE}
48 BUNDLE_PATH=${BUNDLE_PATH}
49 EOF