From dfb43b49efd55d76892efd95b3b6abd13abc88b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Wed, 27 Jan 2021 14:01:58 +0100 Subject: [PATCH] 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 --- tools/list_eol_stale_branches.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/list_eol_stale_branches.sh b/tools/list_eol_stale_branches.sh index 6c9a9d80bc..051a25da4d 100755 --- a/tools/list_eol_stale_branches.sh +++ b/tools/list_eol_stale_branches.sh @@ -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 }