Handle yangtools nitrogen non-standard branch
[releng/builder.git] / jjb / autorelease / version-bump.sh
index 65f106354121758d7c1b9f1c71bb11f0ba10186a..cb1bd87b391d7e7e15acff40cf5320c728ff5508 100644 (file)
@@ -1,5 +1,5 @@
 #!/bin/bash
-# @License EPL-1.0 <http://spdx.org/licenses/EPL-1.0>
+# SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2017 The Linux Foundation and others.
 #
 # This script performs version bumping activities for an ODL release.
 echo "---> version-bump.sh"
 
+# The only purpose of RELEASE_TAG in this script is to set the Gerrit topic.
+# It is also used as a placeholder for version bumping but gets wiped out
+# immediately to bump versions by x.y.(z+1).
+RELEASE_TAG="${STREAM^}"
+
 mkdir -p "$WORKSPACE/archives"
 LOG_FILE="$WORKSPACE/archives/version-bump.log"
 BRANCH="$GERRIT_BRANCH"
@@ -43,7 +48,12 @@ mkdir -p "$patch_dir"
 for module in $(git submodule | awk '{ print $2 }')
 do
     pushd "$module"
-    git format-patch --stdout "origin/${BRANCH,,}" > "$patch_dir/${module//\//-}.patch"
+    # TODO: Remove once stable/nitrogen is no longer supported.
+    if [ "$GERRIT_BRANCH" == "stable/nitrogen" ] && [ "$module" == "yangtools" ]; then
+        git format-patch --stdout "origin/v1.2.x" > "$patch_dir/${module//\//-}.patch"
+    else
+        git format-patch --stdout "origin/${BRANCH,,}" > "$patch_dir/${module//\//-}.patch"
+    fi
     git bundle create "$patch_dir/${module//\//-}.bundle" "origin/${BRANCH,,}..HEAD"
     popd
 done