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 # Make a tmp dir into which we put files cleaned-up on exit.
22 trap "rm -rf $TMPDIR" EXIT
25 # Use the adjacent do-release-docker.sh instead, if you can.
26 # Otherwise, this runs core of the release creation.
27 # Will ask you questions on what to build and for logins
28 # and passwords to use building.
29 export PROJECT
="${PROJECT:-hbase}"
31 SELF
="$(cd "$
(dirname "${BASH_SOURCE[0]}")" && pwd)"
32 # shellcheck source=SCRIPTDIR/release-util.sh
33 .
"$SELF/release-util.sh"
35 while getopts "b:fs:" opt
; do
37 b
) export GIT_BRANCH
=$OPTARG ;;
38 f
) export DRY_RUN
=0 ;; # "force", ie actually publish this release (otherwise defaults to dry run)
39 s
) RELEASE_STEP
="$OPTARG" ;;
40 ?
) error
"Invalid option: $OPTARG" ;;
45 error
"Arguments can only be provided with option flags, invalid args: $*"
48 function gpg_agent_help
{
50 Trying to sign a test file using your GPG setup failed.
52 Please make sure you have a local gpg-agent running with access to your secret keys prior to
53 starting a release build. If you are creating release artifacts on a remote machine please check
54 that you have set up ssh forwarding to the gpg-agent extra socket.
56 For help on how to do this please see the README file in the create-release directory.
61 # If running in docker, import and then cache keys.
62 if [ "$RUNNING_IN_DOCKER" = "1" ]; then
63 # when Docker Desktop for mac is running under load there is a delay before the mounted volume
64 # becomes available. if we do not pause then we may try to use the gpg-agent socket before docker
65 # has got it ready and we will not think there is a gpg-agent.
66 if [ "${HOST_OS}" == "DARWIN" ]; then
69 # in docker our working dir is set to where all of our scripts are held
70 # and we want default output to go into the "output" directory that should be in there.
71 if [ -d "output" ]; then
74 echo "GPG Version: $("${GPG}" "${GPG_ARGS[@]}" --version)"
75 # Inside docker, need to import the GPG key stored in the current directory.
76 if ! $GPG "${GPG_ARGS[@]}" --import "$SELF/gpg.key.public" ; then
80 # We may need to adjust the path since JAVA_HOME may be overridden by the driver script.
81 if [ -n "$JAVA_HOME" ]; then
82 echo "Using JAVA_HOME from host."
83 export PATH
="$JAVA_HOME/bin:$PATH"
85 # JAVA_HOME for the openjdk package.
86 export JAVA_HOME
=/usr
/lib
/jvm
/java-8-openjdk-amd64
/
89 # Outside docker, need to ask for information about the release.
94 gpg_test_file
="${TMPDIR}/gpg_test.$$.txt"
95 echo "Testing gpg signing ${GPG} ${GPG_ARGS[@]} --detach --armor --sign ${gpg_test_file}"
96 echo "foo" > "${gpg_test_file}"
97 if ! "${GPG}" "${GPG_ARGS[@]}" --detach --armor --sign "${gpg_test_file}" ; then
100 # In --batch mode we have to be explicit about what we are verifying
101 if ! "${GPG}" "${GPG_ARGS[@]}" --verify "${gpg_test_file}.asc" "${gpg_test_file}" ; then
107 if [[ -z "$RELEASE_STEP" ]]; then
108 # If doing all stages, leave out 'publish-snapshot'
109 RELEASE_STEP
="tag_publish-dist_publish-release"
110 # and use shared maven local repo for efficiency
111 export REPO
="${REPO:-$(pwd)/$(mktemp -d hbase-repo-XXXXX)}"
114 function should_build
{
116 if [[ -z "$RELEASE_STEP" ]]; then
118 elif [[ "$RELEASE_STEP" == *"$WHAT"* ]]; then
125 if should_build
"tag" && [ "$SKIP_TAG" = 0 ]; then
126 if [ -z "${YETUS_HOME}" ] && [ "${RUNNING_IN_DOCKER}" != "1" ]; then
127 declare local_yetus
="/opt/apache-yetus/0.12.0/"
128 if [ "$(get_host_os)" = "DARWIN" ]; then
129 local_yetus
="/usr/local/Cellar/yetus/0.12.0/"
131 YETUS_HOME
="$(read_config "YETUS_HOME not defined. Absolute path to
local install of Apache Yetus
" "${local_yetus}")"
134 run_silent
"Creating release tag $RELEASE_TAG..." "tag.log" \
135 "$SELF/release-build.sh" tag
137 export TAG_SAME_DRY_RUN
="true";
140 echo "Skipping tag creation for $RELEASE_TAG."
143 if should_build
"publish-dist"; then
144 run_silent
"Publishing distribution packages (tarballs)" "publish-dist.log" \
145 "$SELF/release-build.sh" publish-dist
147 echo "Skipping publish-dist step."
150 if should_build
"publish-snapshot"; then
151 run_silent
"Publishing snapshot" "publish-snapshot.log" \
152 "$SELF/release-build.sh" publish-snapshot
154 elif should_build
"publish-release"; then
155 run_silent
"Publishing release" "publish-release.log" \
156 "$SELF/release-build.sh" publish-release
158 echo "Skipping publish-release step."