Merge "Use latest Ubuntu 18.04 image for tools system"
[releng/builder.git] / jjb / releng-maven-mri-stage.sh
index d3920bb2f08fe7e8c93116c4876e4b9651a8808f..3b5ddd56d08ae141bf90e65e08b8d24e4919e28a 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.
@@ -18,7 +18,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 -q -e '/project/version/text()' {} +)
+# 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