#!/bin/bash
-set -e
+set -ex
# create a fresh empty place to build this custom distribution
BUILD_DIR=${WORKSPACE}/patch_tester
cd "$BUILD_DIR"
# Download distribution pom.xml
-wget "http://git.opendaylight.org/gerrit/gitweb?p=integration/distribution.git;a=blob_plain;f=artifacts/upstream/properties/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
+wget "https://git.opendaylight.org/gerrit/gitweb?p=integration/distribution.git;a=blob_plain;f=artifacts/upstream/properties/pom.xml;hb=refs/heads/$DISTROBRANCH" -O "pom.xml"
cat pom.xml
# Set up git committer name and email, needed for commit creation when cherry-picking.
-export EMAIL="sandbox@jenkins.opendaylight.org"
+export EMAIL="jenkins-$SILO@opendaylight.org"
export GIT_COMMITTER_NAME="Multipatch Job"
# Extract a list of patches per project from an comment trigger. An example is:
# multipatch-build:openflowplugin:45/69445/1,genius:46/69446/1,netvirt:47/69447/1
if [ -n "$GERRIT_EVENT_COMMENT_TEXT" ]; then
+ # Decode Base64 before parsing text.
+ GERRIT_EVENT_COMMENT_TEXT=$(echo "$GERRIT_EVENT_COMMENT_TEXT" | base64 -d)
+
if [[ "$GERRIT_EVENT_COMMENT_TEXT" == *fast* ]]; then
BUILD_FAST="true"
PATCHES_TO_BUILD=$(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep 'multipatch-build-fast:')
git checkout FETCH_HEAD
# If the patch is for MRI project, adjust the MRI versions
# shellcheck disable=SC2235
- if [ "${PROJECT}" == "odlparent" ] || [ "${PROJECT}" == "yangtools" ] || ([ "${PROJECT}" == "mdsal" ] && [ "${DISTROSTREAM}" != "fluorine" ]); then
+ if [ "${PROJECT}" == "odlparent" ] || [ "${PROJECT}" == "yangtools" ] || [ "${PROJECT}" == "mdsal" ] || ([ "${PROJECT}" == "controller" ] && [ "${DISTROSTREAM}" != "magnesium" ] && [ "${DISTROSTREAM}" != "sodium" ]); then
ODLPARENT_VERSION="$(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -v //x:odlparent.version ../pom.xml)"
echo "change odlparent version to ${ODLPARENT_VERSION}"
find . -name "pom.xml" -print0 | xargs -0 xmlstarlet ed --inplace -P -N x=http://maven.apache.org/POM/4.0.0 -u //x:version\[../x:parent/x:groupId=\"org.opendaylight.odlparent\"\] -v "${ODLPARENT_VERSION}"
find . -name "pom.xml" -print0 | xargs -0 xmlstarlet ed --inplace -P -N x=http://maven.apache.org/POM/4.0.0 -u //x:version\[../x:groupId=\"org.opendaylight.odlparent\"\] -v "${ODLPARENT_VERSION}"
fi
# shellcheck disable=SC2235
- if [ "${PROJECT}" == "yangtools" ] || ([ "${PROJECT}" == "mdsal" ] && [ "${DISTROSTREAM}" != "fluorine" ]); then
+ if [ "${PROJECT}" == "yangtools" ] || [ "${PROJECT}" == "mdsal" ] || ([ "${PROJECT}" == "controller" ] && [ "${DISTROSTREAM}" != "magnesium" ] && [ "${DISTROSTREAM}" != "sodium" ]); then
YANGTOOLS_VERSION="$(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -v //x:yangtools.version ../pom.xml)"
echo "change yangtools version to ${YANGTOOLS_VERSION}"
find . -name "pom.xml" -print0 | xargs -0 xmlstarlet ed --inplace -P -N x=http://maven.apache.org/POM/4.0.0 -u //x:version\[../x:parent/x:groupId=\"org.opendaylight.yangtools\"\] -v "${YANGTOOLS_VERSION}"
find . -name "pom.xml" -print0 | xargs -0 xmlstarlet ed --inplace -P -N x=http://maven.apache.org/POM/4.0.0 -u //x:version\[../x:groupId=\"org.opendaylight.yangtools\"\] -v "${YANGTOOLS_VERSION}"
fi
- if [ "${PROJECT}" == "mdsal" ] && [ "${DISTROSTREAM}" != "fluorine" ]; then
+ # shellcheck disable=SC2235
+ if [ "${PROJECT}" == "mdsal" ] || ([ "${PROJECT}" == "controller" ] && [ "${DISTROSTREAM}" != "magnesium" ] && [ "${DISTROSTREAM}" != "sodium" ]); then
MDSAL_VERSION="$(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -v //x:mdsal.version ../pom.xml)"
echo "change mdsal version to ${MDSAL_VERSION}"
find . -name "pom.xml" -print0 | xargs -0 xmlstarlet ed --inplace -P -N x=http://maven.apache.org/POM/4.0.0 -u //x:version\[../x:parent/x:groupId=\"org.opendaylight.mdsal\"\] -v "${MDSAL_VERSION}"
find . -name "pom.xml" -print0 | xargs -0 xmlstarlet ed --inplace -P -N x=http://maven.apache.org/POM/4.0.0 -u //x:version\[../x:groupId=\"org.opendaylight.mdsal\"\] -v "${MDSAL_VERSION}"
fi
+ if [ "${PROJECT}" == "controller" ] && [ "${DISTROSTREAM}" != "magnesium" ] && [ "${DISTROSTREAM}" != "sodium" ]; then
+ CONTROLLER_VERSION="$(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -v //x:controller.version ../pom.xml)"
+ echo "change controller version to ${CONTROLLER_VERSION}"
+ find . -name "pom.xml" -print0 | xargs -0 xmlstarlet ed --inplace -P -N x=http://maven.apache.org/POM/4.0.0 -u //x:version\[../x:parent/x:groupId=\"org.opendaylight.controller\"\] -v "${CONTROLLER_VERSION}"
+ find . -name "pom.xml" -print0 | xargs -0 xmlstarlet ed --inplace -P -N x=http://maven.apache.org/POM/4.0.0 -u //x:version\[../x:groupId=\"org.opendaylight.controller\"\] -v "${CONTROLLER_VERSION}"
+ fi
else
# If project with no patch is MRI, download release tag:
# shellcheck disable=SC2235
- if [ "${PROJECT}" == "odlparent" ] || [ "${PROJECT}" == "yangtools" ] || ([ "${PROJECT}" == "mdsal" ] && [ "${DISTROSTREAM}" != "fluorine" ]); then
+ if [ "${PROJECT}" == "odlparent" ] || [ "${PROJECT}" == "yangtools" ] || [ "${PROJECT}" == "mdsal" ] || ([ "${PROJECT}" == "controller" ] && [ "${DISTROSTREAM}" != "magnesium" ] && [ "${DISTROSTREAM}" != "sodium" ]); then
# shellcheck disable=SC2086
PROJECT_VERSION="$(xmlstarlet sel -N x=http://maven.apache.org/POM/4.0.0 -t -v //x:${PROJECT_SHORTNAME}.version ../pom.xml)"
echo "2. checking out tag v${PROJECT_VERSION}"
fi
pushd "${PROJECT_SHORTNAME}"
# Build project
+ # shellcheck disable=SC2086
"$MVN" clean install \
-e ${fast_option} \
-Dstream="$DISTROSTREAM" \
-Dmaven.gitcommitid.skip=false \
--global-settings "$GLOBAL_SETTINGS_FILE" \
--settings "$SETTINGS_FILE" \
- "$MAVEN_OPTIONS"
- # Since we've installed the artifacts, we can clean the build and save
- # disk space
+ $MAVEN_OPTIONS
+ # Since we've installed the artifacts, we can clean the build and save disk space
+ # shellcheck disable=SC2086
"$MVN" clean \
-e ${fast_option} \
-Dstream="$DISTROSTREAM" \
-Dmaven.gitcommitid.skip=false \
--global-settings "$GLOBAL_SETTINGS_FILE" \
--settings "$SETTINGS_FILE" \
- "$MAVEN_OPTIONS"
+ $MAVEN_OPTIONS
popd
done