Support swift and oslo milestone releases

For intermediary releases of Swift, first a RC tag is pushed on master
and bugs get fixreleased (using swiftrc.sh) then we use milestone.sh
in SKIPBUGS mode to push the final tag and upload the resulting tarball
without affecting bugs.

oslo-incubator does not produce tarballs, but we still want tags and
mark the 'oslo' Launchpad project milestone "released". We use
milestone.sh in SKIPTARBALL mode to just skip tarball wait and call
upload_release.py with the --nop argument to skip tarball upload.

oslo.messaging is not tagged at milestones, but we still want to mark
the milestone "released". We use milestone.sh in SKIPTARBALL and SKIPTAG
mode to skip tagging completely, skip tarball wait and call
upload_release.py with the --nop argument to skip tarball upload.

Change-Id: I7e670d2dd5052460a593a06e82dc212d176a395d
This commit is contained in:
Thierry Carrez 2014-06-13 12:02:29 +02:00
parent eeb762dadb
commit c632605a64
3 changed files with 215 additions and 97 deletions

View File

@ -29,6 +29,7 @@ fi
MILESTONE=$1
SHA=$2
PROJECT=$3
LPROJECT="$PROJECT"
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
@ -37,47 +38,75 @@ function title {
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
}
if [[ "$PROJECT" == "swift" ]]; then
echo "Swift mode: skipping fixreleasing (bugs should be set at RC time)"
SKIPBUGS=1
fi
if [[ "$PROJECT" == "oslo-incubator" ]]; then
echo "Oslo-incubator mode: skipping tarball generation and upload"
SKIPTARBALL=1
LPROJECT="oslo"
fi
if [[ "$PROJECT" == "oslo.messaging" ]]; then
echo "oslo.messaging mode: skipping tag, tarball generation and upload"
SKIPTAG=1
SKIPTARBALL=1
fi
title "Resolving $MILESTONE to version"
VERSION=`$TOOLSDIR/ms2version.py $PROJECT $MILESTONE`
VERSION=`$TOOLSDIR/ms2version.py $LPROJECT $MILESTONE`
RELVERSION=${VERSION:0:6}
echo "$MILESTONE is $VERSION (final being $RELVERSION)"
title "Cloning repository for $PROJECT"
MYTMPDIR=`mktemp -d`
cd $MYTMPDIR
git clone git://git.openstack.org/openstack/$PROJECT
cd $PROJECT
LANG=C git review -s
TARGETSHA=`git log -1 $SHA --format='%H'`
HEADSHA=`git log -1 HEAD --format='%H'`
if [[ "$SKIPTAG" != "1" ]]; then
title "Cloning repository for $PROJECT"
MYTMPDIR=`mktemp -d`
cd $MYTMPDIR
git clone git://git.openstack.org/openstack/$PROJECT
cd $PROJECT
LANG=C git review -s
TARGETSHA=`git log -1 $SHA --format='%H'`
HEADSHA=`git log -1 HEAD --format='%H'`
title "Tagging $TARGETSHA as $VERSION"
TAGMSG="${PROJECT^} $MILESTONE milestone ($VERSION)"
echo "Tag message is '$TAGMSG'"
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
echo "Warning: target SHA does not correspond to HEAD"
title "Tagging $TARGETSHA as $VERSION"
TAGMSG="${PROJECT^} $MILESTONE milestone ($VERSION)"
echo "Tag message is '$TAGMSG'"
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
echo "Warning: target SHA does not correspond to HEAD"
fi
git tag -m "$TAGMSG" -s "$VERSION" $TARGETSHA
git push gerrit $VERSION
REALSHA=`git show-ref -s "$VERSION"`
title "Cleaning up"
cd ../..
rm -rf $MYTMPDIR
fi
git tag -m "$TAGMSG" -s "$VERSION" $TARGETSHA
git push gerrit $VERSION
REALSHA=`git show-ref -s "$VERSION"`
title "Waiting for tarball from $REALSHA"
$TOOLSDIR/wait_for_tarball.py $REALSHA
if [[ "$SKIPTARBALL" != "1"]]; then
title "Waiting for tarball from $REALSHA"
$TOOLSDIR/wait_for_tarball.py $REALSHA
title "Checking tarball is similar to last master.tar.gz"
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
echo "It will probably be a bit different since target is not HEAD."
title "Checking tarball is similar to last master.tar.gz"
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
echo "It will probably be a bit different since target is not HEAD."
fi
$TOOLSDIR/similar_tarballs.sh $PROJECT master $VERSION
read -sn 1 -p "Press any key to continue..."
fi
$TOOLSDIR/similar_tarballs.sh $PROJECT master $VERSION
read -sn 1 -p "Press any key to continue..."
title "Setting FixCommitted bugs to FixReleased"
$TOOLSDIR/process_bugs.py $PROJECT --settarget=$MILESTONE --fixrelease
read -sn 1 -p "Fix any leftover bugs manually and press key to continue..."
if [[ "$SKIPBUGS" != "1" ]]; then
title "Setting FixCommitted bugs to FixReleased"
$TOOLSDIR/process_bugs.py $LPROJECT --settarget=$MILESTONE --fixrelease
read -sn 1 -p "Fix any leftover bugs manually and press key to continue..."
fi
title "Uploading tarball to Launchpad"
$TOOLSDIR/upload_release.py $PROJECT $RELVERSION --milestone=$MILESTONE
title "Cleaning up"
cd ../..
rm -rf $MYTMPDIR
if [[ "$SKIPTARBALL" != "1" ]]; then
title "Uploading tarball to Launchpad"
$TOOLSDIR/upload_release.py $LPROJECT $RELVERSION --milestone=$MILESTONE
else
title "Marking milestone as released in Launchpad"
$TOOLSDIR/upload_release.py $LPROJECT $RELVERSION --milestone=$MILESTONE --nop
fi

78
swiftrc.sh Executable file
View File

@ -0,0 +1,78 @@
#!/bin/bash
#
# Script to tag RC for intermediary swift release
#
# Copyright 2014 Thierry Carrez <thierry@openstack.org>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
set -e
if [ $# -lt 2 ]; then
echo "Usage: $0 SHA VERSION"
echo
echo "Example: $0 d0e1a2db 1.13.0"
exit 2
fi
SHA=$1
VERSION=$2
RCVERSION="${VERSION}.rc1"
PROJECT="swift"
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function title {
echo
echo "$(tput bold)$(tput setaf 1)[ $1 ]$(tput sgr0)"
}
title "Checking that milestone exists for $VERSION"
$TOOLSDIR/ms2version.py swift $VERSION --onlycheck
title "Cloning repository for $PROJECT"
MYTMPDIR=`mktemp -d`
cd $MYTMPDIR
git clone git://git.openstack.org/openstack/$PROJECT
cd $PROJECT
LANG=C git review -s
TARGETSHA=`git log -1 $SHA --format='%H'`
HEADSHA=`git log -1 HEAD --format='%H'`
title "Tagging $TARGETSHA as $RCVERSION"
TAGMSG="${PROJECT^} $RCVERSION"
echo "Tag message is '$TAGMSG'"
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
echo "Warning: target SHA does not correspond to HEAD"
fi
git tag -m "$TAGMSG" -s "$RCVERSION" $TARGETSHA
git push gerrit $RCVERSION
REALSHA=`git show-ref -s "$RCVERSION"`
title "Waiting for tarball from $REALSHA"
$TOOLSDIR/wait_for_tarball.py $REALSHA
title "Checking tarball is similar to last master.tar.gz"
if [[ "$TARGETSHA" != "$HEADSHA" ]]; then
echo "It will probably be a bit different since target is not HEAD."
fi
$TOOLSDIR/similar_tarballs.sh $PROJECT master $RCVERSION
read -sn 1 -p "Press any key to continue..."
title "Setting FixCommitted bugs to FixReleased"
$TOOLSDIR/process_bugs.py $PROJECT --settarget=$VERSION --fixrelease
title "Cleaning up"
cd ../..
rm -rf $MYTMPDIR

View File

@ -40,6 +40,8 @@ parser = argparse.ArgumentParser(description='Grab tarball and release it '
parser.add_argument('project', help='Project to publish release for (nova)')
parser.add_argument('version', help='Version under development (2013.1)')
parser.add_argument("--milestone", help='Milestone to publish (grizzly-3)')
parser.add_argument("--nop", action='store_true',
help='Only create release, do not upload tarball')
parser.add_argument("--tarball",
help='Tarball to fetch (defaults to version[~milestone])')
parser.add_argument("--test", action='store_const', const='staging',
@ -79,89 +81,98 @@ for lp_milestone in lp_proj.all_milestones:
else:
abort(2, 'Could not find milestone: %s' % milestone)
# Retrieve tgz, check contents and MD5
print "Downloading tarball..."
tmpdir = tempfile.mkdtemp()
if args.tarball is None:
if args.milestone is None:
base_tgz = "%s-%s.tar.gz" % (args.project, args.version)
if not args.nop:
# Retrieve tgz, check contents and MD5
print "Downloading tarball..."
tmpdir = tempfile.mkdtemp()
if args.tarball is None:
if args.milestone is None:
base_tgz = "%s-%s.tar.gz" % (args.project, args.version)
else:
base_tgz = "%s-%s.%s.tar.gz" \
% (args.project, args.version, short_ms)
else:
base_tgz = "%s-%s.%s.tar.gz" % (args.project, args.version, short_ms)
else:
base_tgz = "%s-%s.tar.gz" % (args.project, args.tarball)
url_tgz = "http://tarballs.openstack.org/%s/%s" % (args.project, base_tgz)
tgz = os.path.join(tmpdir, base_tgz)
base_tgz = "%s-%s.tar.gz" % (args.project, args.tarball)
url_tgz = "http://tarballs.openstack.org/%s/%s" % (args.project, base_tgz)
tgz = os.path.join(tmpdir, base_tgz)
(tgz, message) = urllib.urlretrieve(url_tgz, filename=tgz)
(tgz, message) = urllib.urlretrieve(url_tgz, filename=tgz)
try:
subprocess.check_call(['tar', 'ztvf', tgz])
except subprocess.CalledProcessError, e:
abort(2, '%s is not a tarball. Bad revision specified ?' % base_tgz)
try:
subprocess.check_call(['tar', 'ztvf', tgz])
except subprocess.CalledProcessError, e:
abort(2, '%s is not a tarball. Bad revision specified ?' % base_tgz)
md5 = subprocess.check_output(['md5sum', tgz]).split()[0]
md5 = subprocess.check_output(['md5sum', tgz]).split()[0]
# Sign tgz
print "Signing tarball..."
sig = tgz + '.asc'
if not os.path.exists(sig):
print 'Calling GPG to create tgz signature...'
subprocess.check_call(['gpg', '--armor', '--sign', '--detach-sig', tgz])
# Sign tgz
print "Signing tarball..."
sig = tgz + '.asc'
if not os.path.exists(sig):
print 'Calling GPG to create tgz signature...'
subprocess.check_call(
['gpg', '--armor', '--sign', '--detach-sig', tgz])
# Read contents
with open(tgz) as tgz_file:
tgz_content = tgz_file.read()
with open(sig) as sig_file:
sig_content = sig_file.read()
# Read contents
with open(tgz) as tgz_file:
tgz_content = tgz_file.read()
with open(sig) as sig_file:
sig_content = sig_file.read()
# Mark milestone released
print "Marking milestone released..."
if args.milestone:
release_notes = "This is another milestone (%s) on the road to %s %s." \
% (args.milestone, args.project.capitalize(), args.version)
if args.nop:
rel_notes = ""
else:
release_notes = "This is %s %s release." \
% (args.project.capitalize(), args.version)
if args.milestone:
rel_notes = "This is another milestone (%s) on the road to %s %s." \
% (args.milestone, args.project.capitalize(), args.version)
else:
rel_notes = "This is %s %s release." \
% (args.project.capitalize(), args.version)
lp_release = lp_milestone.createProductRelease(
date_released=datetime.datetime.utcnow(),
release_notes=release_notes)
date_released=datetime.datetime.utcnow(),
release_notes=rel_notes)
# Mark milestone inactive
print "Marking milestone inactive..."
lp_milestone.is_active = False
lp_milestone.lp_save()
# Upload file
print "Uploading release files..."
if args.milestone:
final_tgz = "%s-%s.%s.tar.gz" % (args.project, args.version, short_ms)
description = '%s "%s" milestone' % \
(args.project.capitalize(), args.milestone)
else:
final_tgz = "%s-%s.tar.gz" % (args.project, args.version)
description = '%s %s release' % (args.project.capitalize(), args.version)
if not args.nop:
# Upload file
print "Uploading release files..."
if args.milestone:
final_tgz = "%s-%s.%s.tar.gz" % (args.project, args.version, short_ms)
description = '%s "%s" milestone' % \
(args.project.capitalize(), args.milestone)
else:
final_tgz = "%s-%s.tar.gz" % (args.project, args.version)
description = '%s %s release' % \
(args.project.capitalize(), args.version)
lp_file = lp_release.add_file(file_type='Code Release Tarball',
description=description,
file_content=tgz_content,
filename=final_tgz,
signature_content=sig_content,
signature_filename=final_tgz + '.asc',
content_type="application/x-gzip; "
"charset=binary")
lp_file = lp_release.add_file(file_type='Code Release Tarball',
description=description,
file_content=tgz_content,
filename=final_tgz,
signature_content=sig_content,
signature_filename=final_tgz + '.asc',
content_type="application/x-gzip; "
"charset=binary")
# Check LP-reported MD5
print "Checking MD5s..."
time.sleep(2)
result_md5_url = "http://launchpad.net/%s/+download/%s/+md5" % \
(lp_release.self_link[30:], final_tgz)
result_md5_file = urllib.urlopen(result_md5_url)
result_md5 = result_md5_file.read().split()[0]
result_md5_file.close()
if md5 != result_md5:
abort(3, 'MD5sums (%s/%s) do not match !' % (md5, result_md5))
# Check LP-reported MD5
print "Checking MD5s..."
time.sleep(2)
result_md5_url = "http://launchpad.net/%s/+download/%s/+md5" % \
(lp_release.self_link[30:], final_tgz)
result_md5_file = urllib.urlopen(result_md5_url)
result_md5 = result_md5_file.read().split()[0]
result_md5_file.close()
if md5 != result_md5:
abort(3, 'MD5sums (%s/%s) do not match !' % (md5, result_md5))
# Finished
print md5
# Finished
print md5
print "Done!"