This is an automated email from the ASF dual-hosted git repository. dgrove pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-release.git
The following commit(s) were added to refs/heads/master by this push: new 931fb8e Mailer (#256) 931fb8e is described below commit 931fb8e9be9493d02b5c5784a629f0dcfdd51fe8 Author: rodric rabbah <rod...@gmail.com> AuthorDate: Fri Mar 29 13:20:48 2019 -0400 Mailer (#256) * Add script to generate release vote email. --- .gitignore | 5 ++ tools/checkout_svn.sh | 7 +- tools/config.json | 4 +- tools/gen-release-vote.py | 160 ++++++++++++++++++++++++++++++++++++++++ tools/mail-config-template.yaml | 7 ++ tools/requirements.txt | 1 + 6 files changed, 181 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8a75a --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +#* +*~ +openwhisk_release/ +tools/key_sec.gpg +tools/mail-config.yaml diff --git a/tools/checkout_svn.sh b/tools/checkout_svn.sh index 8e11eef..03d3cab 100755 --- a/tools/checkout_svn.sh +++ b/tools/checkout_svn.sh @@ -23,6 +23,8 @@ echo "Checkout the SVN to the local directory." SCRIPTDIR="$(cd $(dirname "$0")/ && pwd)" source "$SCRIPTDIR/load_config.sh" $1 $2 +: ${OPENWHISK_SVN?"Need is not set OPENWHISK_SVN"} + if [[ `wget -S --spider $CURRENT_VERSION_URL 2>&1 | grep 'HTTP/1.1 404 Not Found'` ]]; then # Create an empty folder named ${REMOTE_PATH} in the remote staging folder svn mkdir -m "Create the directory for ${full_version} in staging." $CURRENT_VERSION_URL $CREDENTIALS @@ -36,4 +38,7 @@ rm -rf $OPENWHISK_SVN/* cd $OPENWHISK_SVN # Make sure the folder $REMOTE_PATH is connected to the svn staging server. -svn co $CURRENT_VERSION_URL $REMOTE_PATH +CMD="svn co $CURRENT_VERSION_URL $REMOTE_PATH" +echo $CMD +$CMD +echo svn repo checked out to... $OPENWHISK_SVN diff --git a/tools/config.json b/tools/config.json index 3b8986d..6c0ac74 100644 --- a/tools/config.json +++ b/tools/config.json @@ -1,6 +1,6 @@ { - "publish_stage": "true", - "update_doc": "false", + "publish_stage": true, + "update_doc": false, "stage_url": "https://dist.apache.org/repos/dist/dev/incubator/openwhisk", "release_url": "https://dist.apache.org/repos/dist/release/incubator/openwhisk", "versioning": { diff --git a/tools/gen-release-vote.py b/tools/gen-release-vote.py new file mode 100755 index 0000000..e96dfa0 --- /dev/null +++ b/tools/gen-release-vote.py @@ -0,0 +1,160 @@ +#!/usr/bin/env python +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +import argparse +try: + import argcomplete +except ImportError: + argcomplete = False +import os +import yaml +import json +import sys +import smtplib +from email.mime.text import MIMEText + +class objectify(object): + def __init__(self, d): + self.__dict__ = d + +def parseArgsAndConfig(): + parser = argparse.ArgumentParser(description='Generates Release Candidate Vote Email') + parser.add_argument('-v', '--verbose', help='verbose output', action='store_true') + parser.add_argument('-n', '--dryrun', help='verbose output', action='store_true') + parser.add_argument('-mc', '--mail-conf', help='YAML configuration file for mailer', metavar='YAML', type=argparse.FileType('r'), required=False) + parser.add_argument('-rc', '--rc-conf', help='JSON configuration file for release candidate', metavar='JSON', type=argparse.FileType('r'), required=True) + + if argcomplete: + argcomplete.autocomplete(parser) + + args = parser.parse_args() + + args.rcConfig = json.load(args.rc_conf) + if not args.dryrun: + if 'mail_config' not in args: + parser.error("--mail-config required except for a dryrun.") + + args.mailConfig = yaml.load(args.mail_conf) + if 'mail' not in args.mailConfig: + print('Error: bad configuration, need "mail" properties.') + return + else: + args.mailConfig = args.mailConfig['mail'] + else: + args.mailConfig = None + return args + +def componentList(config): + for r in config['RepoList']: + key = r.replace('-', '_') + hash = config[key]['hash'] + name = config[key]['name'] if 'name' in config[key] else '???' + yield objectify({ + 'id': r, + 'hash': hash, + 'name': name + }) + +def gitHashes(components): + s = map(lambda r: "* %s: %s" % (r.name, r.hash), components) + return '\n'.join(list(s)) + +def rcverify(components, version): + s = map(lambda r: "rcverify.sh %s '%s' %s" % (r.id, r.name, version), components) + return '\n'.join(list(s)) + +def releaseVersion(config): + return objectify({ + 'v': config['versioning']['version'], + 'rc': config['versioning']['pre_release_version'] + }) + +def sendVoteEmail(mailConfig, rcConfig, dryrun): + components = list(componentList(rcConfig)) + componentsString = ', '.join(map(lambda c: c.name, components)) + version = releaseVersion(rcConfig) + subject = '[VOTE] Release Apache OpenWhisk %s (v%s, %s)' % (componentsString, version.v, version.rc) + content = """Hi, + +This is a call to vote on releasing version {version} release +candidate {rc} of the following {N} project modules with artifacts +built from the Git repositories and commit IDs listed below. + +{githashes} + +This release comprises of source code distribution only. + +You can use this UNIX script to download the release and verify the checklist below: +https://gitbox.apache.org/repos/asf?p=incubator-openwhisk-release.git;a=blob_plain;f=tools/rcverify.sh;hb=HEAD + +Usage: +curl -s "https://gitbox.apache.org/repos/asf?p=incubator-openwhisk-release.git;a=blob_plain;f=tools/rcverify.sh;hb=HEAD" -o rcverify.sh +chmod +x rcverify.sh +{rcverifies} + +Please vote to approve this release: + + [ ] +1 Approve the release + [ ] 0 Don't care + [ ] -1 Don't release, because ... + +Release verification checklist for reference: + [ ] Download links are valid. + [ ] Checksums and PGP signatures are valid. + [ ] DISCLAIMER is included. + [ ] Source code artifacts have correct names matching the current release. + [ ] LICENSE and NOTICE files are correct for each OpenWhisk repository. + [ ] All files have license headers if necessary. + [ ] No compiled archives bundled in source archive. + +This majority vote is open for at least 72 hours. +""".format(version = version.v, + rc = version.rc, + N = len(components), + githashes = gitHashes(components), + rcverifies = rcverify(components, version.v)) + + if (dryrun): + print(subject) + print(content) + return + + print('Sending email: %s -> %s' % (frm, to)) + + msg = MIMEText(content, _charset='utf-8') + msg['From'] = mailConfig['from'] + msg['To'] = mailConfig['to'] + msg['Subject'] = subject + server = smtplib.SMTP(mailConfig['smtp']) + if mailConfig['useTLS']: + server.starttls() + if 'username' in mailConfig: + server.login(mailConfig['username'], mailConfig['password']) + + server.sendmail(mailConfig['from'], mailConfig['to'], msg.as_string()) + server.quit() + +def main(args): + sendVoteEmail(args.mailConfig, args.rcConfig, args.dryrun) + +if __name__ == "__main__": + args = parseArgsAndConfig() + if args: + main(args) + else: + sys.exit(-1) diff --git a/tools/mail-config-template.yaml b/tools/mail-config-template.yaml new file mode 100644 index 0000000..f870d50 --- /dev/null +++ b/tools/mail-config-template.yaml @@ -0,0 +1,7 @@ +mail: + from: '"OpenWhisk Release" <your...@apache.org>' + to: 'd...@openwhisk.apache.org' + smtp: mail-relay.apache.org:587 + useTLS: true + username: YOUR-ID + password: YOUR-PASSWORD diff --git a/tools/requirements.txt b/tools/requirements.txt new file mode 100644 index 0000000..5500f00 --- /dev/null +++ b/tools/requirements.txt @@ -0,0 +1 @@ +PyYAML