Merge "Setup constraints for release"

This commit is contained in:
Jenkins 2016-08-04 17:53:02 +00:00 committed by Gerrit Code Review
commit 470a383e93
2 changed files with 64 additions and 1 deletions

View File

@ -184,6 +184,69 @@
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
$BRANCH_ARG git://git.openstack.org $ZUUL_PROJECT
- builder:
# Use this macro in the release pipeline to get a tagged repo with
# tag checked out and requirements repo with the branch the tag is
# on.
# The macro also works in other pipelines.
name: zuul-release-git-prep-upper-constraints
builders:
- shell: |
#!/bin/bash -xe
function get_branch_tag {
BRANCHES=`git branch -a --contains $ZUUL_REFNAME`
TARGET_BRANCH=`echo "$BRANCHES"|grep '^ remotes/origin/stable'|cut -d/ -f3-|sort|head -n1`
if [ -z $TARGET_BRANCH ] ; then
TARGET_BRANCH=`echo "$BRANCHES"|grep '^ remotes/origin/'|cut -d/ -f3-|sort|grep -v ^HEAD|head -n1`
fi
# Nothing found.
# Note that zuul-cloner will also fallback to master if
# the TARGET_BRANCH does not exist.
if [ -z $TARGET_BRANCH ] ; then
echo "Tag not found, falling back to master"
TARGET_BRANCH=master
fi
}
CLONEMAP=`mktemp`
REQS_DIR=`mktemp -d`
function cleanup {
mkdir -p $WORKSPACE
rm -rf $CLONEMAP $REQS_DIR
}
trap cleanup EXIT
cat > $CLONEMAP << EOF
clonemap:
- name: $ZUUL_PROJECT
dest: .
EOF
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
git://git.openstack.org $ZUUL_PROJECT
if [[ "$ZUUL_PROJECT" != "openstack/requirements" ]]; then
# Figure out branch for requirements checkout
if [[ "$ZUUL_REFNAME" =~ ^refs/tags/ ]] ; then
get_branch_tag
else
TARGET_BRANCH=$ZUUL_REFNAME
fi
cat > $CLONEMAP << EOF
clonemap:
- name: openstack/requirements
dest: $REQS_DIR
EOF
/usr/zuul-env/bin/zuul-cloner -m $CLONEMAP --cache-dir /opt/git \
--branch $TARGET_BRANCH \
git://git.openstack.org openstack/requirements
cp $REQS_DIR/upper-constraints.txt ./
fi
- builder:
name: branch-git-prep
builders:

View File

@ -560,7 +560,7 @@
builders:
- print-template-name:
template-name: "{template-name}"
- gerrit-git-prep
- zuul-release-git-prep-upper-constraints
- install-distro-packages
- revoke-sudo
- tarball: