Update cloud image Ubuntu18.04 docker x86_64
[releng/builder.git] / jjb / releng-maven-mri-stage.sh
index 9dd7b4e6cd17bebeca085934f3b2bba9df7d71e3..523650211042230c9799fb674462469b62b4f887 100644 (file)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 echo "---> releng-maven-mri-stage.sh"
 # This script publishes artifacts to a staging repo in Nexus and exports the karaf bundle URL.
@@ -8,6 +8,7 @@ echo "---> releng-maven-mri-stage.sh"
 # $STAGING_PROFILE_ID :  Provided by a job parameter.
 
 # Ensure we fail the job if any steps fail.
+# shellcheck disable=SC2039,SC3040
 set -xeu -o pipefail
 
 TMP_FILE="$(mktemp)"
@@ -18,7 +19,9 @@ staging_repo=$(sed -n -e 's/Staging repository \(.*\) created\./\1/p' "$TMP_FILE
 mkdir -p "$WORKSPACE/archives"
 echo "$staging_repo ${NEXUS_URL}/content/repositories/$staging_repo" | tee -a "$WORKSPACE/archives/staging-repo.txt"
 
-staged_version=$(find . -name '*karaf*.pom' -exec xpath {} '/project/version/text()' \; 2> /dev/null)
+# TODO: remove the second xpath command once the old version in CentOS 7 is not used any more
+staged_version=$(find . -name '*karaf*.pom' -exec \
+    sh -c 'xpath -e "/project/version/text()" "$1" 2>/dev/null || xpath "$1" "/project/version/text()" 2>/dev/null' xpath.sh {} \;)
 BUNDLE_URL="${NEXUS_URL}/content/repositories/$staging_repo/org/opendaylight/${PROJECT}/${KARAF_ARTIFACT}/${staged_version}/${KARAF_ARTIFACT}-${staged_version}.zip"
 
 # Cleanup
@@ -29,4 +32,5 @@ echo "Bundle url is ${BUNDLE_URL}"
 # Re-inject the new BUNDLE_URL for downstream jobs to pull from Nexus
 cat > "${WORKSPACE}/maven-staged-bundle.env" <<EOF
 BUNDLE_URL=${BUNDLE_URL}
+KARAF_VERSION=${KARAF_VERSION}
 EOF