jerqi commented on code in PR #4518: URL: https://github.com/apache/gravitino/pull/4518#discussion_r1722866251
########## dev/release/release-build.sh: ########## @@ -0,0 +1,357 @@ +#!/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. +# + +# Referred from Apache Spark's release script +# dev/create-release/release-build.sh + +SELF=$(cd $(dirname $0) && pwd) +. "$SELF/release-util.sh" + +function exit_with_usage { + cat << EOF +usage: release-build.sh <package|docs|publish-release|finalize> +Creates build deliverables from a Apache Gravitino commit. + +Top level targets are + package: Create binary packages and commit them to dist.apache.org/repos/dist/dev/incubator/gravitino/ + docs: Build docs and commit them to dist.apache.org/repos/dist/dev/incubator/gravitino/ + publish-release: Publish a release to Apache release repo + finalize: Finalize the release after an RC passes vote + +All other inputs are environment variables + +GIT_REF - Release tag or commit to build from +GRAVITINO_PACKAGE_VERSION - Release identifier in top level package directory (e.g. 0.6.0-incubating-rc1) +GRAVITINO_VERSION - (optional) Version of Gravitino being built (e.g. 0.6.0-incubating) + +ASF_USERNAME - Username of ASF committer account +ASF_PASSWORD - Password of ASF committer account + +GPG_KEY - GPG key used to sign release artifacts +GPG_PASSPHRASE - Passphrase for GPG key +EOF + exit 1 +} + +set -e + +if [ $# -eq 0 ]; then + exit_with_usage +fi + +if [[ $@ == *"help"* ]]; then + exit_with_usage +fi + +if [[ -z "$ASF_PASSWORD" ]]; then + echo 'The environment variable ASF_PASSWORD is not set. Enter the password.' + echo + stty -echo && printf "ASF password: " && read ASF_PASSWORD && printf '\n' && stty echo +fi + +if [[ -z "$GPG_PASSPHRASE" ]]; then + echo 'The environment variable GPG_PASSPHRASE is not set. Enter the passphrase to' + echo 'unlock the GPG signing key that will be used to sign the release!' + echo + stty -echo && printf "GPG passphrase: " && read GPG_PASSPHRASE && printf '\n' && stty echo +fi + +for env in ASF_USERNAME GPG_PASSPHRASE GPG_KEY; do + if [ -z "${!env}" ]; then + echo "ERROR: $env must be set to run this script" + exit_with_usage + fi +done + +export LC_ALL=C.UTF-8 +export LANG=C.UTF-8 + +# Commit ref to checkout when building +GIT_REF=${GIT_REF:-main} + +RELEASE_STAGING_LOCATION="https://dist.apache.org/repos/dist/dev/incubator/gravitino" +RELEASE_LOCATION="https://dist.apache.org/repos/dist/release/incubator/gravitino" + +GPG="gpg -u $GPG_KEY --no-tty --batch --pinentry-mode loopback" +NEXUS_ROOT=https://repository.apache.org/service/local/staging +NEXUS_PROFILE=170bb01395e84a # Profile for Gravitino staging uploads +BASE_DIR=$(pwd) + +init_java +init_gradle + +if [[ "$1" == "finalize" ]]; then + if [[ -z "$PYPI_API_TOKEN" ]]; then + error 'The environment variable PYPI_API_TOKEN is not set. Exiting.' + fi + + git config --global user.name "$GIT_NAME" Review Comment: Why do you use global? Does it will release manager local configuration? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
