Check if patches remain opened on stale branches

Gerrit won't allow deletion of a branch with open reviews [1]. These changes
allow us to early detect that.

[1] http://lists.openstack.org/pipermail/openstack-discuss/2021-January/020034.html

Change-Id: I603b1ac864b5b34db7466007b1bb78a0887f87b5
This commit is contained in:
Hervé Beraud 2021-01-27 14:01:58 +01:00
parent 7bc492b709
commit dfb43b49ef
1 changed files with 7 additions and 0 deletions

View File

@ -46,6 +46,7 @@ for i in "$@"; do
done
GERRIT_URL="https://review.opendev.org"
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASEDIR=$(dirname $TOOLSDIR)
source $TOOLSDIR/functions
@ -64,6 +65,12 @@ function is_eol {
clone_repo ${repo} stable/${em_serie}
if [[ $? -eq 0 ]]; then
echo "${repo} contains eol stale branch (${em_serie})"
req="${GERRIT_URL}/changes/?q=status:open+project:${repo}+branch:stable/${em_serie}"
patches=$(curl -s ${req} | sed 1d | jq --raw-output '.[] | .change_id')
if [ ! -z "${patches}" ]; then
echo "Patches remain opened on stale branch:"
echo "https://review.opendev.org/q/status:open+project:${repo}+branch:stable/${em_serie}"
fi
fi
}