add a script to build zuul commands to reenqueue jobs

This script only generates the commands as a convenience, we still
need someone with infra-root privileges to run them.

Change-Id: I9870230509ad9f532f486b0682786d136ded798a
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-01-26 16:27:08 -05:00
parent 8f2d33cac8
commit 186a2bed5a

View File

@ -0,0 +1,37 @@
#!/bin/bash
#
# Script to produce the zuul commands for reenqueuing a release if the
# jobs fail part way through. This command assumes that the tag has
# been applied to the repository already. If that is not true, we can
# revert and re-land the patch in openstack/releases.
if [[ $# -lt 2 ]]; then
echo "Usage: $(basename $0) <repo> <tag>"
echo "repo should be e.g. openstack/glance"
exit 1
fi
repo="$1"
tag="$2"
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASEDIR=$(dirname $TOOLSDIR)
source $TOOLSDIR/functions
setup_temp_space 'build-reenqueue-commands'
clone_repo $repo
hash=$(cd $repo && git show-ref -s $tag)
pipelines="tag"
if [[ $tag =~ (a|b|rc) ]]; then
pipelines="$pipelines pre-release"
else
pipelines="$pipelines release"
fi
for pipeline in $pipelines; do
echo "zuul enqueue-ref --tenant=openstack --trigger=gerrit --pipeline=$pipeline --project=$repo --ref=refs/tags/$tag --newrev=$hash"
done