From 881f3cc66620c7b8f63dfaa18cc728273b1adb08 Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 2 Aug 2016 14:12:16 -0400 Subject: [PATCH] update tag-release git command to fall back to master The release tagging script relied on the zuul-cloner behavior of falling back to master if the requested branch did not exist. Add logic to the shell command replacement to do the same thing, with a warning. I tested this locally on the Oslo releases today, and it worked. Before the change release.sh failed because it could not check out the stable/newton branch of openstack/requirements to submit the patch to update the constraints list. Change-Id: Ib29a68edbb5bfea64625128da35ddad61098dd9c Signed-off-by: Doug Hellmann --- jenkins/scripts/release-tools/functions | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jenkins/scripts/release-tools/functions b/jenkins/scripts/release-tools/functions index d093345cf1..778e0a81e9 100644 --- a/jenkins/scripts/release-tools/functions +++ b/jenkins/scripts/release-tools/functions @@ -93,9 +93,14 @@ function clone_repo { # them for building the release notes. (cd $repo && git fetch -v --tags) - # Make sure the active branch is set correctly. + # Make sure the active branch is set correctly, if the branch + # exists. if [ ! -z "$branch" ]; then - (cd $repo && git checkout $branch) + if git show origin/$branch; then + (cd $repo && git checkout $branch) + else + echo "Branch $branch does not exist, using master." + fi fi return 0