move release step for updating constraints to after the PyPI upload

We have a race condition in the jobs for patches to
openstack/requirements submitted by the release jobs because the
packages are not yet on PyPI when the patch is proposed to update the
constraints file. This change moves the constraint update portion of the
release job to a separate job and schedules it to run as a dependency of
the PyPI upload job.

Change-Id: Idce73ca3813858050e8f64ece44e838266aaf5d6
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-12-16 11:37:34 -05:00
parent e197900594
commit c9c277707e
4 changed files with 32 additions and 44 deletions

View File

@ -23,3 +23,4 @@
- '{name}-tarball'
- '{name}-tarball-signing'
- '{name}-announce-release'
- '{name}-update-constraints'

View File

@ -23,3 +23,32 @@
publishers:
- console-log
# This job runs after a repository has been tagged to update the
# upper-constraints.txt list in the openstack/requirements repository.
- job-template:
name: '{name}-update-constraints'
node: signing
builders:
- print-template-name:
template-name: "{template-name}"
- gerrit-git-prep
- revoke-sudo
- shell: |
#!/bin/bash
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/)
/usr/local/jenkins/slave_scripts/release-tools/update_constraints.sh $VERSION
publishers:
- test-results
- console-log

View File

@ -100,47 +100,4 @@ else
$BUGS
fi
# Apply the PEP 503 rules to turn the dist name into a canonical form,
# in case that's the version that appears in upper-constraints.txt. We
# have to try substituting both versions because we have a mix in that
# file and if we rename projects we'll end up with bad references to
# existing build artifacts.
function pep503 {
echo $1 | sed -e 's/[-_.]\+/-/g' | tr '[:upper:]' '[:lower:]'
}
# Try to propose a constraints update for libraries.
if [[ $INCLUDE_PYPI == "yes" ]]; then
echo "Proposing constraints update"
# NOTE(dhellmann): If the setup_requires dependencies are not
# installed yet, running setuptools commands will install
# them. Capturing the output of a setuptools command that includes
# the output from installing packages produces a bad dist_name, so
# we first ask for the name without saving the output and then we
# ask for it again and save the output to get a clean
# version. This is why we can't have nice things.
python setup.py --name
dist_name=$(python setup.py --name)
canonical_name=$(pep503 $dist_name)
if [[ -z "$dist_name" ]]; then
echo "Could not determine the name of the constraint to update"
else
cd $MYTMPDIR
clone_repo openstack/requirements stable/$SERIES
cd openstack/requirements
git checkout -b "$dist_name-$VERSION"
sed -e "s/^${dist_name}=.*/$dist_name===$VERSION/" --in-place upper-constraints.txt
sed -e "s/^${canonical_name}=.*/$canonical_name===$VERSION/" --in-place upper-constraints.txt
if git commit -a -m "update constraint for $dist_name to new release $VERSION
$TAGMSG
"; then
git show
git review -t 'new-release'
else
echo "Skipping git review because there are no updates."
fi
fi
fi
exit 0

View File

@ -717,7 +717,8 @@ project-templates:
pre-release:
- '{name}-tarball':
- '{name}-tarball-signing'
- '{name}-pypi-both-upload'
- '{name}-pypi-both-upload':
- '{name}-update-constraints'
release:
- '{name}-tarball':
- '{name}-tarball-signing'