[tool] Handle new branch name style in list_eom_stale_branches.sh
list_eom_stale_branches.sh does not work for antelope, where the branch name has the new style (stable/2023.1) as it tries to search for stable/antelope, which is wrong. This patch fixes this issue to use the new stable/<release-id> style. Change-Id: I6bac959e6346f333c07c31d15c19e6ed54e324b5
This commit is contained in:
parent
e004886d8b
commit
16105b99dc
@ -123,10 +123,11 @@ function series_to_branch {
|
|||||||
typeset series="$1"
|
typeset series="$1"
|
||||||
|
|
||||||
typeset default=$(python -c 'from openstack_releases import defaults; print(defaults.RELEASE)')
|
typeset default=$(python -c 'from openstack_releases import defaults; print(defaults.RELEASE)')
|
||||||
|
typeset branch_name=$(python -c "from openstack_releases import gitutils; print(gitutils.get_stable_branch_id(\"$series\"))")
|
||||||
if [ "$series" = "$default" ]; then
|
if [ "$series" = "$default" ]; then
|
||||||
echo "master"
|
echo "master"
|
||||||
else
|
else
|
||||||
echo "stable/$series"
|
echo "stable/$branch_name"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ Provide a list of repositories that contains eom stale branches on a
|
|||||||
series, and give option to delete them.
|
series, and give option to delete them.
|
||||||
|
|
||||||
Arguments:
|
Arguments:
|
||||||
<series> The <series> that is to move to Unmaintained
|
<series> The <series> that is to move to Unmaintained (e.g. antelope)
|
||||||
-d, --debug Turn on the debug mode
|
-d, --debug Turn on the debug mode
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
examples:
|
examples:
|
||||||
@ -66,31 +66,34 @@ export PAGER=
|
|||||||
|
|
||||||
setup_temp_space 'list-eom-stale-branches'
|
setup_temp_space 'list-eom-stale-branches'
|
||||||
|
|
||||||
branch=$(series_to_branch "$series")
|
# Get branch name from series name (stable/2023.1 for antelope)
|
||||||
|
branch=$(series_to_branch "$SERIES")
|
||||||
|
# Get branch id from full branch name (stable/2023.1 -> 2023.1)
|
||||||
|
branch_id=${branch#*/}
|
||||||
|
|
||||||
function no_open_patches {
|
function no_open_patches {
|
||||||
req="${GERRIT_URL}/changes/?q=status:open+project:${repo}+branch:stable/${SERIES}"
|
req="${GERRIT_URL}/changes/?q=status:open+project:${repo}+branch:${branch}"
|
||||||
patches=$(curl -s ${req} | sed 1d | jq --raw-output '.[] | .change_id')
|
patches=$(curl -s ${req} | sed 1d | jq --raw-output '.[] | .change_id')
|
||||||
[ -z "${patches}" ]
|
[ -z "${patches}" ]
|
||||||
no_opens=$?
|
no_opens=$?
|
||||||
if [[ "$no_opens" -eq 1 ]]; then
|
if [[ "$no_opens" -eq 1 ]]; then
|
||||||
echo "Patches remained open on stale branch (make sure to abandon them):"
|
echo "Patches remained open on stale branch (make sure to abandon them):"
|
||||||
echo "https://review.opendev.org/q/status:open+project:${repo}+branch:stable/${SERIES}"
|
echo "https://review.opendev.org/q/status:open+project:${repo}+branch:${branch}"
|
||||||
fi
|
fi
|
||||||
return $no_opens
|
return $no_opens
|
||||||
}
|
}
|
||||||
|
|
||||||
function eom_tag_matches_head {
|
function eom_tag_matches_head {
|
||||||
head=$(git log --oneline --decorate -1)
|
head=$(git log --oneline --decorate -1)
|
||||||
[[ "$head" =~ "${SERIES}-eom" ]] && [[ "$head" =~ "origin/stable/${SERIES}" ]]
|
[[ "$head" =~ "${branch_id}-eom" ]] && [[ "$head" =~ "origin/${branch}" ]]
|
||||||
matches=$?
|
matches=$?
|
||||||
if [[ "$matches" -eq 1 ]] ; then
|
if [[ "$matches" -eq 1 ]] ; then
|
||||||
tags=$(git tag)
|
tags=$(git tag)
|
||||||
[[ "$tags" =~ "${SERIES}-eom" ]]
|
[[ "$tags" =~ "${branch_id}-eom" ]]
|
||||||
eom_tag_exists=$?
|
eom_tag_exists=$?
|
||||||
if [[ "$eom_tag_exists" -eq 0 ]]; then
|
if [[ "$eom_tag_exists" -eq 0 ]]; then
|
||||||
echo "WARNING !!! stable/${SERIES} has patches on top of the ${SERIES}-eom tag."
|
echo "WARNING !!! ${branch} has patches on top of the ${branch_id}-eom tag."
|
||||||
echo "Please check the branch and ${SERIES}-eom tag manually."
|
echo "Please check the branch and ${branch_id}-eom tag manually."
|
||||||
echo "Do not delete the branch if you are not sure!"
|
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
|
read -p "> If you are sure the branch can be deleted, then press D + Enter: " DELETE
|
||||||
if [ "${DELETE,,}" == "d" ]; then
|
if [ "${DELETE,,}" == "d" ]; then
|
||||||
@ -99,26 +102,26 @@ function eom_tag_matches_head {
|
|||||||
echo "Skipping."
|
echo "Skipping."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "No ${SERIES}-eom tag found! Branch cannot be deleted. Skipping."
|
echo "No ${branch_id}-eom tag found! Branch cannot be deleted. Skipping."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return $matches
|
return $matches
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_eom {
|
function is_eom {
|
||||||
${TOOLSDIR}/delete_stable_branch.py check --quiet ${repo} ${SERIES}
|
${TOOLSDIR}/delete_stable_branch.py check --quiet ${repo} ${branch}
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
echo
|
echo
|
||||||
echo "${repo} contains eom stale branch (${SERIES})"
|
echo "${repo} contains eom stale branch (${branch})"
|
||||||
clone_repo ${repo} stable/${SERIES}
|
clone_repo ${repo} ${branch}
|
||||||
cd ${repo}
|
cd ${repo}
|
||||||
if no_open_patches && eom_tag_matches_head; then
|
if no_open_patches && eom_tag_matches_head; then
|
||||||
read -p "> Do you want to delete the branch stable/${SERIES} from ${repo} repository? [y/N]: " YN
|
read -p "> Do you want to delete the branch ${branch} from ${repo} repository? [y/N]: " YN
|
||||||
if [ "${YN,,}" == "y" ]; then
|
if [ "${YN,,}" == "y" ]; then
|
||||||
if [ -z "$gerrit_username" ]; then
|
if [ -z "$gerrit_username" ]; then
|
||||||
read -p "Gerrit username: " gerrit_username
|
read -p "Gerrit username: " gerrit_username
|
||||||
fi
|
fi
|
||||||
${TOOLSDIR}/delete_stable_branch.py delete ${gerrit_username} ${repo} ${SERIES}
|
${TOOLSDIR}/delete_stable_branch.py delete ${gerrit_username} ${repo} ${branch}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cd ..
|
cd ..
|
||||||
@ -131,7 +134,7 @@ repos=$(list-deliverables -r --series "${SERIES}" --is-eom)
|
|||||||
for repo in ${repos}; do
|
for repo in ${repos}; do
|
||||||
cd ${MYTMPDIR}
|
cd ${MYTMPDIR}
|
||||||
echo
|
echo
|
||||||
echo " --- $repo ($SERIES) --- "
|
echo " --- $repo (${branch}) --- "
|
||||||
is_eom "${repo}" "${SERIES}"
|
is_eom "${repo}" "${branch}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user