Prevent recreate EOL'd branch

In case a branch is End of Life (marked with either $series-eol or
bugfix-<version>-eol) and was deleted before, then our script recreates
it based on the info in deliverable's yaml file.

This patch extends the script by checking if an *-eol tag exists and
in case it does then exits without creating again the already deleted
branch.

Change-Id: I1b763aa52703221d211156c060b8998282fcfc5d
This commit is contained in:
Előd Illés 2023-04-27 17:12:36 +02:00
parent 8f8be472dc
commit 306e2381ec

View File

@ -26,6 +26,12 @@ if [[ $# -lt 3 ]]; then
exit 2 exit 2
fi fi
function cleanup_and_exit {
cd ../..
rm -rf $MYTMPDIR
exit 0
}
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $TOOLSDIR/functions source $TOOLSDIR/functions
@ -43,11 +49,21 @@ setup_temp_space branch-$PROJECT-$branch_as_path_entry
clone_repo $REPO clone_repo $REPO
cd $REPO cd $REPO
# Skip branch creation in case bugfix-<version>-eol tag exists
if $(git tag | grep ${NEW_BRANCH/\//-}-eol > /dev/null); then
echo "A ${NEW_BRANCH/\//-}-eol tag already exists !"
cleanup_and_exit
fi
# Skip branch creation in case <series>-eol tag exists
if $(git tag | grep ${NEW_BRANCH#stable/}-eol >/dev/null); then
echo "A ${NEW_BRANCH#stable/}-eol tag already exists !"
cleanup_and_exit
fi
if $(git branch -r | grep $NEW_BRANCH > /dev/null); then if $(git branch -r | grep $NEW_BRANCH > /dev/null); then
echo "A $NEW_BRANCH branch already exists !" echo "A $NEW_BRANCH branch already exists !"
cd ../.. cleanup_and_exit
rm -rf $MYTMPDIR
exit 0
fi fi
# NOTE(dhellmann): We wait to set up git-review until after we have # NOTE(dhellmann): We wait to set up git-review until after we have