Update for Unmaintained transition

We no longer have branches in extended maintenance state, these have
been switched to Unmaintained (eom). So we need to check for the latter
state when listing branches that could be deleted since the are EOLed.

Add oslo.utils to requirements since it is now needed by the
tools/delete_stable_branch.py script.

Change-Id: Ib948befa6f2706dc5dc50009b021af3a1bb389a8
This commit is contained in:
Dr. Jens Harbott 2024-03-15 08:10:32 +01:00
parent 75146c9634
commit 97127bede1
5 changed files with 26 additions and 24 deletions

View File

@ -1014,11 +1014,11 @@ is equivalent to:
./list_unreleased_changes.sh stable/liberty $(list-deliverables --repos --series liberty)
list-em-series
--------------
list-eom-series
---------------
Command to list all series tagged as in extended maintenance.
Command to list all series tagged as in end of maintenance ("Unmaintained").
::
tox -e venv -- list-em-series
tox -e venv -- list-eom-series

View File

@ -19,10 +19,10 @@ BASE_PATH = os.path.dirname(os.path.realpath(__file__))
ROOT_DIR = f'{BASE_PATH}/../../data'
def em():
def eom():
series = series_status.SeriesStatus.from_directory(ROOT_DIR)
for serie in series:
if series.get(serie).is_em:
if series.get(serie).is_eom:
print(serie)

View File

@ -33,3 +33,5 @@ appdirs
packaging>=16.5
openstack-governance>=0.11.0 # Apache 2.0
oslo.utils

View File

@ -25,7 +25,7 @@ packages = openstack_releases
console_scripts =
validate-request = openstack_releases.cmds.validate:main
list-changes = openstack_releases.cmds.list_changes:main
list-em-series = openstack_releases.cmds.list_series:em
list-eom-series = openstack_releases.cmds.list_series:eom
list-maintained-series = openstack_releases.cmds.list_series:maintained
list-unreleased-changes = openstack_releases.cmds.list_unreleased_changes:main
list-constraints = openstack_releases.cmds.list_constraints:main

View File

@ -54,7 +54,7 @@ BASEDIR=$(dirname $TOOLSDIR)
source $TOOLSDIR/functions
enable_tox_venv
em_series=($(list-em-series))
eom_series=($(list-eom-series))
# Make sure no pager is configured so the output is not blocked
export PAGER=
@ -64,28 +64,28 @@ setup_temp_space 'list-eol-stale-branches'
branch=$(series_to_branch "$series")
function no_open_patches {
req="${GERRIT_URL}/changes/?q=status:open+project:${repo}+branch:stable/${em_branch}"
req="${GERRIT_URL}/changes/?q=status:open+project:${repo}+branch:stable/${eom_branch}"
patches=$(curl -s ${req} | sed 1d | jq --raw-output '.[] | .change_id')
[ -z "${patches}" ]
no_opens=$?
if [[ "$no_opens" -eq 1 ]]; then
echo "Patches remained open on stale branch (make sure to abandon them):"
echo "https://review.opendev.org/q/status:open+project:${repo}+branch:stable/${em_branch}"
echo "https://review.opendev.org/q/status:open+project:${repo}+branch:stable/${eom_branch}"
fi
return $no_opens
}
function eol_tag_matches_head {
head=$(git log --oneline --decorate -1)
[[ "$head" =~ "${em_branch}-eol" ]] && [[ "$head" =~ "origin/stable/${em_branch}" ]]
[[ "$head" =~ "${eom_branch}-eol" ]] && [[ "$head" =~ "origin/stable/${eom_branch}" ]]
matches=$?
if [[ "$matches" -eq 1 ]] ; then
tags=$(git tag)
[[ "$tags" =~ "${em_branch}-eol" ]]
[[ "$tags" =~ "${eom_branch}-eol" ]]
eol_tag_exists=$?
if [[ "$eol_tag_exists" -eq 0 ]]; then
echo "WARNING !!! stable/${em_branch} has patches on top of the ${em_branch}-eol tag."
echo "Please check the branch and ${em_branch}-eol tag manually."
echo "WARNING !!! stable/${eom_branch} has patches on top of the ${eom_branch}-eol tag."
echo "Please check the branch and ${eom_branch}-eol tag manually."
echo "Do not delete the branch if you are not sure!"
read -p "> If you are sure the branch can be deleted, then press D + Enter: " DELETE
if [ "${DELETE,,}" == "d" ]; then
@ -94,40 +94,40 @@ function eol_tag_matches_head {
echo "Skipping."
fi
else
echo "No ${em_branch}-eol tag found! Branch cannot be deleted. Skipping."
echo "No ${eom_branch}-eol tag found! Branch cannot be deleted. Skipping."
fi
fi
return $matches
}
function is_eol {
${TOOLSDIR}/delete_stable_branch.py check --quiet ${repo} ${em_branch}
${TOOLSDIR}/delete_stable_branch.py check --quiet ${repo} ${eom_branch}
if [[ $? -eq 0 ]]; then
echo
echo "${repo} contains eol stale branch (${em_branch})"
clone_repo ${repo} stable/${em_branch}
echo "${repo} contains eol stale branch (${eom_branch})"
clone_repo ${repo} stable/${eom_branch}
cd ${repo}
if no_open_patches && eol_tag_matches_head; then
read -p "> Do you want to delete the branch stable/${em_branch} from ${repo} repository? [y/N]: " YN
read -p "> Do you want to delete the branch stable/${eom_branch} from ${repo} repository? [y/N]: " YN
if [ "${YN,,}" == "y" ]; then
if [ -z "$gerrit_username" ]; then
read -p "Gerrit username: " gerrit_username
fi
${TOOLSDIR}/delete_stable_branch.py delete ${gerrit_username} ${repo} ${em_branch}
${TOOLSDIR}/delete_stable_branch.py delete ${gerrit_username} ${repo} ${eom_branch}
fi
fi
cd ..
fi
}
for em_branch in "${em_series[@]}"; do
repos=$(list-deliverables -r --series "${em_branch}" --is-eol)
for eom_branch in "${eom_series[@]}"; do
repos=$(list-deliverables -r --series "${eom_branch}" --is-eol)
# Show the eol stale branches for each repository.
for repo in ${repos}; do
cd ${MYTMPDIR}
echo
echo " --- $repo ($em_branch) --- "
is_eol "${repo}" "${em_branch}"
echo " --- $repo ($eom_branch) --- "
is_eol "${repo}" "${eom_branch}"
done
done