From 02d34c2d2105aa4f2f33c8b86d14661f6ea8a6bd Mon Sep 17 00:00:00 2001 From: Doug Hellmann Date: Tue, 29 Dec 2015 17:57:59 +0000 Subject: [PATCH] use send-announcements-to metadata for deliverables Pull send-announcements-to out of the deliverable file and put it into the commit message for the new tag. Then when generating the announcement, look for the metadata value and use it if found. Change-Id: I8fac9f33973df07f6d716fab09fe51381f07b504 Depends-On: I41f3f4874464b37ff95ec1e41a0b6993b62dcf1d --- announce.sh | 8 ++++++++ release.sh | 8 +++++--- release_from_yaml.sh | 5 +++-- releasetools/cmds/list_deliverable_changes.py | 5 ++--- releasetools/gitutils.py | 11 ++++++++++- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/announce.sh b/announce.sh index b3a5f60..8f3db29 100755 --- a/announce.sh +++ b/announce.sh @@ -94,6 +94,13 @@ function get_tag_meta { # The series name is part of the commit message left by release.sh. SERIES=$(get_tag_meta series) +# The recipient for announcements is part of the commit message left +# by release.sh. +ANNOUNCE=$(get_tag_meta announce) +if [[ ! -z "$ANNOUNCE" ]]; then + email_to="--email-to $ANNOUNCE" +fi + # Figure out if that series is a stable branch or not. if git branch -a | grep -q origin/stable/$SERIES; then stable="--stable" @@ -111,6 +118,7 @@ relnotes_file="$RELNOTESDIR/$SHORTNAME-$VERSION" release-notes \ --email \ + $email_to \ $email_tags \ --series $SERIES \ $stable \ diff --git a/release.sh b/release.sh index abfb11f..802e530 100755 --- a/release.sh +++ b/release.sh @@ -24,9 +24,9 @@ TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" source $TOOLSDIR/functions function usage { - echo "Usage: release.sh [-a] repository series version SHA" + echo "Usage: release.sh [-a] repository series version SHA announce" echo - echo "Example: release.sh openstack/oslo.rootwrap mitaka 3.0.3 gerrit/master" + echo "Example: release.sh openstack/oslo.rootwrap mitaka 3.0.3 gerrit/master openstack-dev@lists.openstack.org" } announce=false @@ -40,7 +40,7 @@ while getopts "a" opt "$@"; do done shift $((OPTIND-1)) -if [ $# -lt 4 ]; then +if [ $# -lt 5 ]; then usage exit 2 fi @@ -49,6 +49,7 @@ REPO=$1 SERIES=$2 VERSION=$3 SHA=$4 +ANNOUNCE=$5 SHORTNAME=`basename $REPO` @@ -87,6 +88,7 @@ else meta:version: $VERSION meta:series: $SERIES meta:release-type: $RELEASETYPE +meta:announce: $ANNOUNCE " echo "Tag message is '$TAGMSG'" git tag -m "$TAGMSG" -s "$VERSION" $TARGETSHA diff --git a/release_from_yaml.sh b/release_from_yaml.sh index b0b0865..dd058e5 100755 --- a/release_from_yaml.sh +++ b/release_from_yaml.sh @@ -57,8 +57,9 @@ if [[ -z "$VIRTUAL_ENV" ]]; then fi list-deliverable-changes -r $RELEASES_REPO $DELIVERABLES \ -| while read deliverable series version repo hash; do - $TOOLSDIR/release.sh $announce $repo $series $version $hash +| while read deliverable series version repo hash announce_to; do + title "$repo $series $version $hash $announce_to" + $TOOLSDIR/release.sh $announce $repo $series $version $hash $announce_to done exit 0 diff --git a/releasetools/cmds/list_deliverable_changes.py b/releasetools/cmds/list_deliverable_changes.py index 1f3a7e8..3e6d2d5 100644 --- a/releasetools/cmds/list_deliverable_changes.py +++ b/releasetools/cmds/list_deliverable_changes.py @@ -40,9 +40,8 @@ def main(): args.releases_repo, args.deliverable_file, ) - for deliverable_name, series_name, version, repo, hash in results: - print('%s %s %s %s %s' % - (deliverable_name, series_name, version, repo, hash)) + for r in results: + print(' '.join(r)) return 0 diff --git a/releasetools/gitutils.py b/releasetools/gitutils.py index 4fc5ff4..8daf8a0 100644 --- a/releasetools/gitutils.py +++ b/releasetools/gitutils.py @@ -52,6 +52,14 @@ def get_modified_deliverable_file_content(reporoot, filenames): with open(filename, 'r') as f: deliverable_data = yaml.load(f.read()) + # Determine where to send email announcements of + # releases. Default to the development list, to cut down on + # excessive emails to the announcement list. + send_announcements_to = deliverable_data.get( + 'send-announcements-to', + 'openstack-dev@lists.openstack.org', + ) + # The series name is part of the filename, rather than the file # body. That causes release.sh to be called with series="_independent" # for release:independent projects, and release.sh to use master branch @@ -68,4 +76,5 @@ def get_modified_deliverable_file_content(reporoot, filenames): this_version = all_versions[version] for project in this_version['projects']: yield (deliverable_name, series_name, version, - project['repo'], project['hash']) + project['repo'], project['hash'], + send_announcements_to)