This is an automated email from the ASF dual-hosted git repository. chesnay pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink-shaded.git
commit 2014030963fe8e8a7414fd14afa86dd5c91e2745 Author: zentol <[email protected]> AuthorDate: Wed May 30 10:52:59 2018 +0200 [release] Add modular release scripts Reworks the release scripts to be module. This converges the release process for flink and flink-shaded. --- .gitignore | 3 +- pom.xml | 2 + tools/create_release_branch.sh | 57 +++++++++ tools/create_release_files.sh | 206 ------------------------------- tools/releasing/create_release_branch.sh | 57 +++++++++ tools/releasing/create_source_release.sh | 76 ++++++++++++ tools/releasing/deploy_staging_jars.sh | 43 +++++++ tools/releasing/update_branch_version.sh | 60 +++++++++ 8 files changed, 297 insertions(+), 207 deletions(-) diff --git a/.gitignore b/.gitignore index aac6e70..8f7a660 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .cache .idea target -*.iml \ No newline at end of file +*.iml +tools/release \ No newline at end of file diff --git a/pom.xml b/pom.xml index bbac628..900d71a 100644 --- a/pom.xml +++ b/pom.xml @@ -190,6 +190,8 @@ under the License. <exclude>**/target/**</exclude> <!-- the licenses that are re-bundled --> <exclude>**/packaged_licenses/LICENSE.*.txt</exclude> + <!-- release files --> + <exclude>**/release/**</exclude> </excludes> </configuration> </plugin> diff --git a/tools/create_release_branch.sh b/tools/create_release_branch.sh new file mode 100644 index 0000000..71fd87c --- /dev/null +++ b/tools/create_release_branch.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# +# 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. +# + +## +## Variables with defaults (if not overwritten by environment) +## +RELEASE_CANDIDATE=${RELEASE_CANDIDATE:-none} +MVN=${MVN:-mvn} + +# fail immediately +set -o errexit +set -o nounset +# print command before executing +set -o xtrace + +CURR_DIR=`pwd` +if [[ `basename ${CURR_DIR}` != "tools" ]] ; then + echo "You have to call the script from the tools/ dir" + exit 1 +fi + +########################### + +if [ -z "${RELEASE_VERSION}" ]; then + echo "RELEASE_VERSION is unset" + exit 1 +fi + +cd .. + +target_branch=release-${RELEASE_VERSION} +if [ "${RELEASE_CANDIDATE}" != "none" ]; then + target_branch=${target_branch}-rc${RELEASE_CANDIDATE} +fi + +git checkout -b ${target_branch} + +RELEASE_HASH=`git rev-parse HEAD` +echo "Echo created release hash $RELEASE_HASH" + +echo "Done. Don't forget to create the release tag on GitHub and push the changes." diff --git a/tools/create_release_files.sh b/tools/create_release_files.sh deleted file mode 100755 index 7d51f46..0000000 --- a/tools/create_release_files.sh +++ /dev/null @@ -1,206 +0,0 @@ -#!/usr/bin/env bash - -# -# 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. -# - -# Quick-and-dirty automation of making maven and binary releases. Not robust at all. -# Publishes releases to Maven and packages/copies binary release artifacts. -# Expects to be run in a totally empty directory. -# - -# -# NOTE: The code in this file is based on code from the Apache Spark -# project, licensed under the Apache License v 2.0 -# -# https://github.com/apache/spark/blob/branch-1.4/dev/create-release/create-release.sh -# - -## -# -# Flink-shaded release script -# =================== -# -# Can be called like this: -# -# sonatype_user=APACHEID sonatype_pw=APACHEIDPASSWORD \ -# RELEASE_CANDIDATE="rc1" RELEASE_BRANCH=release-2.0 -# RELEASE_VERSION=2.0 \ -# USER_NAME=APACHEID \ -# GPG_PASSPHRASE=XXX \ -# GPG_KEY=KEYID \ -# GIT_AUTHOR="`git config --get user.name` <`git config --get user.email`>" \ -# ./create_release_files.sh -# -## - - -# fail immediately -set -o errexit -set -o nounset -# print command before executing -set -o xtrace - -CURR_DIR=`pwd` -if [[ `basename $CURR_DIR` != "tools" ]] ; then - echo "You have to call the script from the tools/ dir" - exit 1 -fi - -## -## Variables with defaults (if not overwritten by environment) -## -GPG_PASSPHRASE=${GPG_PASSPHRASE:-XXX} -GPG_KEY=${GPG_KEY:-XXX} -GIT_AUTHOR=${GIT_AUTHOR:-"Your name <[email protected]>"} -RELEASE_VERSION=${RELEASE_VERSION:-none} -RELEASE_CANDIDATE=${RELEASE_CANDIDATE:-none} -RELEASE_BRANCH=${RELEASE_BRANCH:-master} -USER_NAME=${USER_NAME:-yourapacheidhere} -MVN=${MVN:-mvn} -GPG=${GPG:-gpg} -sonatype_user=${sonatype_user:-yourapacheidhere} -sonatype_pw=${sonatype_pw:-XXX} -# whether only build the dist local and don't release to apache -IS_LOCAL_DIST=${IS_LOCAL_DIST:-false} -GIT_REPO=${GIT_REPO:-github.com/apache/flink-shaded.git} - -if [ "$(uname)" == "Darwin" ]; then - SHASUM="shasum -a 512" - MD5SUM="md5 -r" -else - SHASUM="sha512sum" - MD5SUM="md5sum" -fi - -usage() { - set +x - echo "./create_release_files.sh" - echo "" - echo "usage:" - echo "" - echo "example 1: build apache release" - echo " sonatype_user=APACHEID sonatype_pw=APACHEIDPASSWORD \ " - echo " RELEASE_VERSION=2.0 RELEASE_CANDIDATE="rc1" RELEASE_BRANCH=release-2.0 \ " - echo " USER_NAME=APACHEID GPG_PASSPHRASE=XXX GPG_KEY=KEYID \ " - echo " GIT_AUTHOR=\"`git config --get user.name` <`git config --get user.email`>\" \ " - echo " GIT_REPO=github.com/apache/flink-shaded.git \ " - echo " ./create_release_files.sh" - echo "" - echo "example 2: build local release" - echo " RELEASE_VERSION=1.2.0 RELEASE_BRANCH=master \ " - echo " GPG_PASSPHRASE=XXX GPG_KEY=XXX IS_LOCAL_DIST=true \ " - echo " ./create_release_files.sh" - - exit 1 -} - -# Parse arguments -while (( "$#" )); do - case $1 in - --help) - usage - ;; - *) - break - ;; - esac - shift -done - -########################### - -prepare() { - # prepare - target_branch=release-$RELEASE_VERSION - if [ "$RELEASE_CANDIDATE" != "none" ]; then - target_branch=$target_branch-$RELEASE_CANDIDATE - fi - - if [ -d ./flink-shaded ]; then - rm -rf flink-shaded - fi - git clone http://$GIT_REPO flink-shaded - - cd flink-shaded - - git checkout -b $target_branch origin/$RELEASE_BRANCH - rm -rf .gitignore .gitattributes .travis.yml deploysettings.xml CHANGELOG .github - - cd .. -} - -# create source package -make_source_release() { - - cd flink-shaded - - # local dist have no need to commit to remote - if [ "$IS_LOCAL_DIST" == "false" ]; then - git commit --author="$GIT_AUTHOR" -am "Commit for release $RELEASE_VERSION" - git remote add asf_push https://$USER_NAME@$GIT_REPO - RELEASE_HASH=`git rev-parse HEAD` - echo "Echo created release hash $RELEASE_HASH" - fi - - cd .. - - echo "Creating source package" - rsync -a --exclude ".git" flink-shaded flink-shaded-$RELEASE_VERSION - tar czf flink-shaded-${RELEASE_VERSION}-src.tgz flink-shaded-$RELEASE_VERSION - echo $GPG_PASSPHRASE | $GPG --batch --default-key $GPG_KEY --passphrase-fd 0 --armour --output flink-shaded-$RELEASE_VERSION-src.tgz.asc \ - --detach-sig flink-shaded-$RELEASE_VERSION-src.tgz - $MD5SUM flink-shaded-$RELEASE_VERSION-src.tgz > flink-shaded-$RELEASE_VERSION-src.tgz.md5 - $SHASUM flink-shaded-$RELEASE_VERSION-src.tgz > flink-shaded-$RELEASE_VERSION-src.tgz.sha - rm -rf flink-shaded-$RELEASE_VERSION -} - -deploy_to_maven() { - echo "Deploying to repository.apache.org" - - cd flink-shaded - cp ../../deploysettings.xml . - - $MVN clean deploy -Prelease --settings deploysettings.xml -DskipTests -Dgpg.executable=$GPG -Dgpg.keyname=$GPG_KEY -Dgpg.passphrase=$GPG_PASSPHRASE -DretryFailedDeploymentCount=10 - -} - -copy_data() { - # Copy data - echo "Copying release tarballs" - folder=flink-shaded-$RELEASE_VERSION - # candidate is not none, append it - if [ "$RELEASE_CANDIDATE" != "none" ]; then - folder=$folder-$RELEASE_CANDIDATE - fi - sftp [email protected] <<EOF -mkdir public_html/$folder -put flink-*.tgz* public_html/$folder -bye -EOF - echo "copy done" -} - -prepare - -make_source_release - -if [ "$IS_LOCAL_DIST" == "false" ] ; then - copy_data - deploy_to_maven -fi - -echo "Done. Don't forget to commit the release version" diff --git a/tools/releasing/create_release_branch.sh b/tools/releasing/create_release_branch.sh new file mode 100644 index 0000000..71fd87c --- /dev/null +++ b/tools/releasing/create_release_branch.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash + +# +# 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. +# + +## +## Variables with defaults (if not overwritten by environment) +## +RELEASE_CANDIDATE=${RELEASE_CANDIDATE:-none} +MVN=${MVN:-mvn} + +# fail immediately +set -o errexit +set -o nounset +# print command before executing +set -o xtrace + +CURR_DIR=`pwd` +if [[ `basename ${CURR_DIR}` != "tools" ]] ; then + echo "You have to call the script from the tools/ dir" + exit 1 +fi + +########################### + +if [ -z "${RELEASE_VERSION}" ]; then + echo "RELEASE_VERSION is unset" + exit 1 +fi + +cd .. + +target_branch=release-${RELEASE_VERSION} +if [ "${RELEASE_CANDIDATE}" != "none" ]; then + target_branch=${target_branch}-rc${RELEASE_CANDIDATE} +fi + +git checkout -b ${target_branch} + +RELEASE_HASH=`git rev-parse HEAD` +echo "Echo created release hash $RELEASE_HASH" + +echo "Done. Don't forget to create the release tag on GitHub and push the changes." diff --git a/tools/releasing/create_source_release.sh b/tools/releasing/create_source_release.sh new file mode 100644 index 0000000..1df5994 --- /dev/null +++ b/tools/releasing/create_source_release.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash + +# +# 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. +# + +## +## Variables with defaults (if not overwritten by environment) +## +MVN=${MVN:-mvn} + +# fail immediately +set -o errexit +set -o nounset +# print command before executing +set -o xtrace + +CURR_DIR=`pwd` +if [[ `basename $CURR_DIR` != "tools" ]] ; then + echo "You have to call the script from the tools/ dir" + exit 1 +fi + +if [ "$(uname)" == "Darwin" ]; then + SHASUM="shasum -a 512" +else + SHASUM="sha512sum" +fi + +########################### + +RELEASE_VERSION=${RELEASE_VERSION} + +if [ -z "${RELEASE_VERSION}" ]; then + echo "RELEASE_VERSION is unset" + exit 1 +fi + +rm -rf release +mkdir release +cd .. + +echo "Creating source package" + +# create a temporary git clone to ensure that we have a pristine source release +git clone . tools/release/flink-shaded-tmp-clone +cd tools/release/flink-shaded-tmp-clone + +trap 'cd ${CURR_DIR};rm -rf release' ERR + +rsync -a \ + --exclude ".git" --exclude ".gitignore" --exclude ".gitattributes" \ + --exclude "deploysettings.xml" --exclude "target" \ + --exclude ".idea" --exclude "*.iml" --exclude ".DS_Store" \ + . flink-shaded-$RELEASE_VERSION + +tar czf flink-shaded-${RELEASE_VERSION}-src.tgz flink-shaded-$RELEASE_VERSION +gpg --armor --detach-sig flink-shaded-$RELEASE_VERSION-src.tgz +$SHASUM flink-shaded-$RELEASE_VERSION-src.tgz > flink-shaded-$RELEASE_VERSION-src.tgz.sha512 + +mv flink-shaded-$RELEASE_VERSION-src.* ../ +cd .. +rm -rf flink-shaded-tmp-clone diff --git a/tools/releasing/deploy_staging_jars.sh b/tools/releasing/deploy_staging_jars.sh new file mode 100644 index 0000000..8a5e229 --- /dev/null +++ b/tools/releasing/deploy_staging_jars.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash + +# +# 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. +# + +## +## Variables with defaults (if not overwritten by environment) +## +MVN=${MVN:-mvn} + +# fail immediately +set -o errexit +set -o nounset +# print command before executing +set -o xtrace + +CURR_DIR=`pwd` +if [[ `basename $CURR_DIR` != "tools" ]] ; then + echo "You have to call the script from the tools/ dir" + exit 1 +fi + +########################### + +cd .. + +echo "Deploying to repository.apache.org" +$MVN clean deploy -Prelease -DskipTests -DretryFailedDeploymentCount=10 + diff --git a/tools/releasing/update_branch_version.sh b/tools/releasing/update_branch_version.sh new file mode 100644 index 0000000..ef89fe2 --- /dev/null +++ b/tools/releasing/update_branch_version.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash + +# +# 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. +# + +## +## Variables with defaults (if not overwritten by environment) +## +MVN=${MVN:-mvn} + +# fail immediately +set -o errexit +set -o nounset +# print command before executing +set -o xtrace + +CURR_DIR=`pwd` +if [[ `basename $CURR_DIR` != "tools" ]] ; then + echo "You have to call the script from the tools/ dir" + exit 1 +fi + +########################### + +OLD_VERSION=${OLD_VERSION} +NEW_VERSION=${NEW_VERSION} + + +if [ -z "${OLD_VERSION}" ]; then + echo "OLD_VERSION is unset" + exit 1 +fi + +if [ -z "${NEW_VERSION}" ]; then + echo "NEW_VERSION is unset" + exit 1 +fi + +cd .. + +#change version in all pom files +find . -name 'pom.xml' -type f -exec perl -pi -e 's#<version>'$OLD_VERSION'</version>#<version>'$NEW_VERSION'</version>#' {} \; + +git commit -am "Update version to $NEW_VERSION" + +echo "Don't forget to push the change."
