Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CyrilRoelandteNovance/1af6a5a23112ce444bda0ca2010d3465 to your computer and use it in GitHub Desktop.
Save CyrilRoelandteNovance/1af6a5a23112ce444bda0ca2010d3465 to your computer and use it in GitHub Desktop.
Close OpenStack bugs on Launchpad that should have been closed automatically
#!/bin/bash
set -e
set -u
# Possible improvements:
# - Automagically set the bug status to "Fix Released"
# - Handle stable branches
old=$1
new=$2
project=$3
usage () {
echo "Usage: $(basename $0) <old version> <new version> <launchpad project name>"
echo ""
echo "Show bugs fixed between <old version> and <new version> whose LP statuses have not been set to \"Fix Released\""
exit 0
}
[[ "$#" -ne "3" ]] && usage
bug_status () {
curl -s https://api.launchpad.net/devel/bugs/$1/bug_tasks \
| jq -r '.entries[] | select(.bug_target_name == "'$project'").status'
}
for bugid in $(git log $old..$new | grep "^ Closes-Bug: #" | sed 's/.*#//')
do
status=$(bug_status $bugid)
[[ -z "$status" || "$status" == "Fix Released" ]] && continue
echo "https://bugs.launchpad.net/$project/+bug/$bugid (${status})"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment