Back to home page

OSCL-LXR

 
 

    


0001 #!/usr/bin/env bash
0002 
0003 #
0004 # Licensed to the Apache Software Foundation (ASF) under one or more
0005 # contributor license agreements.  See the NOTICE file distributed with
0006 # this work for additional information regarding copyright ownership.
0007 # The ASF licenses this file to You under the Apache License, Version 2.0
0008 # (the "License"); you may not use this file except in compliance with
0009 # the License.  You may obtain a copy of the License at
0010 #
0011 #    http://www.apache.org/licenses/LICENSE-2.0
0012 #
0013 # Unless required by applicable law or agreed to in writing, software
0014 # distributed under the License is distributed on an "AS IS" BASIS,
0015 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0016 # See the License for the specific language governing permissions and
0017 # limitations under the License.
0018 #
0019 
0020 set -e
0021 
0022 SELF=$(cd $(dirname $0) && pwd)
0023 . "$SELF/release-util.sh"
0024 
0025 while getopts ":b:n" opt; do
0026   case $opt in
0027     b) GIT_BRANCH=$OPTARG ;;
0028     n) DRY_RUN=1 ;;
0029     \?) error "Invalid option: $OPTARG" ;;
0030   esac
0031 done
0032 
0033 if [ "$RUNNING_IN_DOCKER" = "1" ]; then
0034   # Inside docker, need to import the GPG key stored in the current directory.
0035   echo $GPG_PASSPHRASE | $GPG --passphrase-fd 0 --import "$SELF/gpg.key"
0036 
0037   # We may need to adjust the path since JAVA_HOME may be overridden by the driver script.
0038   if [ -n "$JAVA_HOME" ]; then
0039     export PATH="$JAVA_HOME/bin:$PATH"
0040   else
0041     # JAVA_HOME for the openjdk package.
0042     export JAVA_HOME=/usr
0043   fi
0044 else
0045   # Outside docker, need to ask for information about the release.
0046   get_release_info
0047 fi
0048 
0049 function should_build {
0050   local WHAT=$1
0051   [ -z "$RELEASE_STEP" ] || [ "$WHAT" = "$RELEASE_STEP" ]
0052 }
0053 
0054 if should_build "tag" && [ $SKIP_TAG = 0 ]; then
0055   run_silent "Creating release tag $RELEASE_TAG..." "tag.log" \
0056     "$SELF/release-tag.sh"
0057 else
0058   echo "Skipping tag creation for $RELEASE_TAG."
0059 fi
0060 
0061 if should_build "build"; then
0062   run_silent "Building Spark..." "build.log" \
0063     "$SELF/release-build.sh" package
0064 else
0065   echo "Skipping build step."
0066 fi
0067 
0068 if should_build "docs"; then
0069   run_silent "Building documentation..." "docs.log" \
0070     "$SELF/release-build.sh" docs
0071 else
0072   echo "Skipping docs step."
0073 fi
0074 
0075 if should_build "publish"; then
0076   run_silent "Publishing release" "publish.log" \
0077     "$SELF/release-build.sh" publish-release
0078 else
0079   echo "Skipping publish step."
0080 fi
0081 
0082 if should_build "tag" && [ $SKIP_TAG = 0 ]; then
0083   git push origin $RELEASE_TAG
0084   if [[ $RELEASE_TAG != *"preview"* ]]; then
0085     git push origin HEAD:$GIT_BRANCH
0086   else
0087     echo "It's preview release. We only push $RELEASE_TAG to remote."
0088   fi
0089 fi