make release script repo cloning function more resilient

The release scripts had been assuming that a valid gerrit user was
always configured already, but this is not necessarily the case on all
nodes. Now that the constraint update job has moved to the proposal
nodes, we need to make the cloner code try to configure the gerrit user
if "git review -s" fails. We can't always take that step because it
would result in using the wrong user on the signing node and when users
run the scripts by hand (as we still do frequently to recover from
failures).

Change-Id: Ife8108f0bff4be9ab63befc5eff4289be78316f7
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-12-21 15:14:00 -05:00
parent 7fc9c616e1
commit bf142fa7b7
5 changed files with 19 additions and 5 deletions

View File

@ -41,8 +41,6 @@
set -x
SERIES="blah"
# Save the version that was just tagged by parsing
# ref/tags/VALUE to get VALUE.
VERSION=$(echo $ZUUL_REF | cut -f3 -d/)

View File

@ -11,10 +11,16 @@
# under the License.
# Setup git so that git review works
function setup_git {
function configure_git_review {
git config user.name "OpenStack Proposal Bot"
git config user.email "openstack-infra@lists.openstack.org"
git config gitreview.username "proposal-bot"
}
# Setup git so that git review works, including creating a branch in
# case the repo started with a detached head.
function setup_git {
configure_git_review
# Initial state of repository is detached, create a branch to work
# from. Otherwise git review will complain.

View File

@ -122,8 +122,16 @@ function clone_repo {
$zc $branch git://git.openstack.org $repo
# Configure git-review so we can propose patches to the repo if
# needed.
(cd $repo && git review -s)
# needed. Some of the release scripts are still run by hand to
# recover from failure, in which case we don't want to set the git
# review user. So try to make git review work by itself first, and
# only if that fails update the git configuration.
#
# NOTE(dhellmann): configure_git_review is in ../common.sh, which
# must be sourced by the script calling this function.
if ! (cd $repo && git review -s); then
(cd $repo && configure_git_review && git review -s)
fi
# Make sure we have all of the existing tags so we can refer to
# them for building the release notes.

View File

@ -22,6 +22,7 @@ set -ex
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $TOOLSDIR/functions
source $TOOLSDIR/../common.sh
function usage {
echo "Usage: release.sh [-a] repository series version diff_start SHA include_pypi first-full-release extra-metadata"

View File

@ -21,6 +21,7 @@ set -x
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $TOOLSDIR/functions
source $TOOLSDIR/../common.sh
function usage {
echo "Usage: update_constraints.sh version"