4 # Licensed to the Apache Software Foundation (ASF) under one or more
5 # contributor license agreements. See the NOTICE file distributed with
6 # this work for additional information regarding copyright ownership.
7 # The ASF licenses this file to You under the Apache License, Version 2.0
8 # (the "License"); you may not use this file except in compliance with
9 # the License. You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 # Tags release. Updates releasenotes and changes.
21 SELF
=$
(cd $
(dirname $0) && pwd)
22 .
"$SELF/release-util.sh"
24 function exit_with_usage
{
25 local NAME
=$
(basename $0)
28 Tags an $PROJECT release on a particular branch.
30 Inputs are specified with the following environment variables:
31 ASF_USERNAME - Apache Username
32 ASF_PASSWORD - Apache Password
33 GIT_NAME - Name to use with git
34 GIT_EMAIL - E-mail address to use with git
35 GIT_BRANCH - Git branch on which to make release
36 RELEASE_VERSION - Version used in pom files for release
37 RELEASE_TAG - Name of release tag
38 NEXT_VERSION - Development version after release
46 if [[ $@
== *"help"* ]]; then
50 if [[ -z "$ASF_PASSWORD" ]]; then
51 echo 'The environment variable ASF_PASSWORD is not set. Enter the password.'
53 stty
-echo && printf "ASF password: " && read ASF_PASSWORD
&& printf '\n' && stty
echo
56 for env
in ASF_USERNAME ASF_PASSWORD RELEASE_VERSION RELEASE_TAG NEXT_VERSION GIT_EMAIL \
57 GIT_NAME GIT_BRANCH GPG_KEY
; do
58 if [ -z "${!env}" ]; then
59 echo "$env must be set to run this script"
69 ASF_REPO
="gitbox.apache.org/repos/asf/${PROJECT}.git"
71 encoded_username
=$
(python
-c "import urllib; print urllib.quote('''$ASF_USERNAME''')")
72 encoded_password
=$
(python
-c "import urllib; print urllib.quote('''$ASF_PASSWORD''')")
73 git clone
"https://$encoded_username:$encoded_password@$ASF_REPO" -b $GIT_BRANCH
74 # NOTE: Here we are prepending project name on version for fetching
75 # changes from the HBASE JIRA. It has issues for hbase, hbase-conectors,
76 # hbase-operator-tools, etc.
78 if [ "${PROJECT}" != "hbase" ]; then
79 # Needs the '-' on the end.
83 update_releasenotes
`pwd`/${PROJECT} "${prefix}${RELEASE_VERSION}"
87 git config user.name "$GIT_NAME"
88 git config user.email $GIT_EMAIL
90 # Create release version
91 $MVN versions:set -DnewVersion=$RELEASE_VERSION | grep -v "no value
" # silence logs
92 git add RELEASENOTES.md CHANGES.md
94 git commit -a -m "Preparing
${PROJECT} release
$RELEASE_TAG; tagging and updates to CHANGES.md and RELEASENOTES.md
"
95 echo "Creating tag
$RELEASE_TAG at the
head of
$GIT_BRANCH"
99 $MVN versions:set -DnewVersion=$NEXT_VERSION | grep -v "no value
" # silence logs
101 git commit -a -m "Preparing development version
$NEXT_VERSION"
103 if ! is_dry_run; then
105 git push origin $RELEASE_TAG
106 git push origin HEAD:$GIT_BRANCH
111 mv ${PROJECT} ${PROJECT}.tag
112 echo "Clone with version changes and tag available as
${PROJECT}.tag
in the output directory.
"