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
fi
function cleanup_and_exit {
cd ../..
rm -rf $MYTMPDIR
exit 0
}
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $TOOLSDIR/functions
@ -43,11 +49,21 @@ setup_temp_space branch-$PROJECT-$branch_as_path_entry
clone_repo $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
echo "A $NEW_BRANCH branch already exists !"
cd ../..
rm -rf $MYTMPDIR
exit 0
cleanup_and_exit
fi
# NOTE(dhellmann): We wait to set up git-review until after we have