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.
21 # Use the adjacent do-release-docker.sh instead, if you can.
22 # Otherwise, this runs core of the release creation.
23 # Will ask you questions on what to build and for logins
24 # and passwords to use building.
25 export PROJECT
="${PROJECT:-hbase}"
27 SELF
="$(cd "$
(dirname "${BASH_SOURCE[0]}")" && pwd)"
28 # shellcheck source=SCRIPTDIR/release-util.sh
29 .
"$SELF/release-util.sh"
31 while getopts "b:fs:" opt
; do
33 b
) export GIT_BRANCH
=$OPTARG ;;
34 f
) export DRY_RUN
=0 ;; # "force", ie actually publish this release (otherwise defaults to dry run)
35 s
) RELEASE_STEP
="$OPTARG" ;;
36 ?
) error
"Invalid option: $OPTARG" ;;
41 error
"Arguments can only be provided with option flags, invalid args: $*"
44 function gpg_agent_help
{
46 Trying to sign a test file using your GPG setup failed.
48 Please make sure you have a local gpg-agent running with access to your secret keys prior to
49 starting a release build. If you are creating release artifacts on a remote machine please check
50 that you have set up ssh forwarding to the gpg-agent extra socket.
52 For help on how to do this please see the README file in the create-release directory.
57 # If running in docker, import and then cache keys.
58 if [ "$RUNNING_IN_DOCKER" = "1" ]; then
59 # when Docker Desktop for mac is running under load there is a delay before the mounted volume
60 # becomes available. if we do not pause then we may try to use the gpg-agent socket before docker
61 # has got it ready and we will not think there is a gpg-agent.
62 if [ "${HOST_OS}" == "DARWIN" ]; then
65 # in docker our working dir is set to where all of our scripts are held
66 # and we want default output to go into the "output" directory that should be in there.
67 if [ -d "output" ]; then
70 echo "GPG Version: $("${GPG}" "${GPG_ARGS[@]}" --version)"
71 # Inside docker, need to import the GPG key stored in the current directory.
72 if ! $GPG "${GPG_ARGS[@]}" --import "$SELF/gpg.key.public" ; then
76 # We may need to adjust the path since JAVA_HOME may be overridden by the driver script.
77 if [ -n "$JAVA_HOME" ]; then
78 echo "Using JAVA_HOME from host."
79 export PATH
="$JAVA_HOME/bin:$PATH"
81 # JAVA_HOME for the openjdk package.
82 export JAVA_HOME
=/usr
/lib
/jvm
/java-8-openjdk-amd64
/
85 # Outside docker, need to ask for information about the release.
91 echo "Testing gpg signing."
92 echo "foo" > gpg_test.txt
93 if ! "${GPG}" "${GPG_ARGS[@]}" --detach --armor --sign gpg_test.txt
; then
96 # In --batch mode we have to be explicit about what we are verifying
97 if ! "${GPG}" "${GPG_ARGS[@]}" --verify gpg_test.txt.asc gpg_test.txt
; then
101 if [[ -z "$RELEASE_STEP" ]]; then
102 # If doing all stages, leave out 'publish-snapshot'
103 RELEASE_STEP
="tag_publish-dist_publish-release"
104 # and use shared maven local repo for efficiency
105 export REPO
="${REPO:-$(pwd)/$(mktemp -d hbase-repo-XXXXX)}"
108 function should_build
{
110 if [[ -z "$RELEASE_STEP" ]]; then
112 elif [[ "$RELEASE_STEP" == *"$WHAT"* ]]; then
119 if should_build
"tag" && [ "$SKIP_TAG" = 0 ]; then
120 if [ -z "${YETUS_HOME}" ] && [ "${RUNNING_IN_DOCKER}" != "1" ]; then
121 declare local_yetus
="/opt/apache-yetus/0.11.1/"
122 if [ "$(get_host_os)" = "DARWIN" ]; then
123 local_yetus
="/usr/local/Cellar/yetus/0.11.1/"
125 YETUS_HOME
="$(read_config "YETUS_HOME not defined. Absolute path to
local install of Apache Yetus
" "${local_yetus}")"
128 run_silent
"Creating release tag $RELEASE_TAG..." "tag.log" \
129 "$SELF/release-build.sh" tag
131 export TAG_SAME_DRY_RUN
="true";
134 echo "Skipping tag creation for $RELEASE_TAG."
137 if should_build
"publish-dist"; then
138 run_silent
"Publishing distribution packages (tarballs)" "publish-dist.log" \
139 "$SELF/release-build.sh" publish-dist
141 echo "Skipping publish-dist step."
144 if should_build
"publish-snapshot"; then
145 run_silent
"Publishing snapshot" "publish-snapshot.log" \
146 "$SELF/release-build.sh" publish-snapshot
148 elif should_build
"publish-release"; then
149 run_silent
"Publishing release" "publish-release.log" \
150 "$SELF/release-build.sh" publish-release
152 echo "Skipping publish-release step."