forked from apache/zeppelin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ZEPPELIN-986] Create publish release script
### What is this PR for? This PR is to automate release publish to maven repository. We used to use maven-deploy-plugin and maven-release-plugin for release but somehow it didn't work well with Zeppelin so 0.5.5 and 0.5.6 haven't been published to maven repository. Publishing release to maven repository will eventually help zeppelin to reduce binary package size by leading users to use Dynamic interpreter loading(apache#908). Originally below modules were skipped for maven release - all interpreters(except spark) - zeppelin-display - zeppelin-server - zeppelin-distribution on the other hand this pr will skip only: - zeppelin-distribution ### What type of PR is it? Infra ### Todos - [x] Include SparkR/R interpreter in release - [x] Create common_release.sh to remove build configuration duplication - [x] Check curl networking failure ### What is the Jira issue? [ZEPPELIN-986](https://issues.apache.org/jira/browse/ZEPPELIN-986) ### Questions: * Does the licenses files need update? No * Is there breaking changes for older versions? No * Does this needs documentation? Yes, https://cwiki.apache.org/confluence/display/ZEPPELIN/Preparing+Zeppelin+Release will be updated accordingly once this pr is merged. Author: Mina Lee <[email protected]> Closes apache#994 from minahlee/ZEPPELIN-986 and squashes the following commits: b0e8e67 [Mina Lee] Revert "Add geode, scalding profile in maven artifact build" cd4cbcd [Mina Lee] curl failure check c0ea07c [Mina Lee] Fix wrong indentation a88bc1d [Mina Lee] Add geode, scalding profile in maven artifact build 2cced61 [Mina Lee] Add r to binary package and maven build 903bc12 [Mina Lee] Move duplicate code to common_release.sh a3eb676 [Mina Lee] Include zeppelin-server module in publish artifiact 48d338f [Mina Lee] Rollback mistakenly removed plugin aafaf42 [Mina Lee] Follow google shell style guide 30dcc65 [Mina Lee] remove deploy plugin from pom since custom script will be used instead for deploy cd1f08c [Mina Lee] Refactor create release script e764f5f [Mina Lee] Add maven publish release script
- Loading branch information
Showing
27 changed files
with
300 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/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. | ||
# | ||
|
||
# common fucntions | ||
|
||
if [[ -z "${TAR}" ]]; then | ||
TAR="/usr/bin/tar" | ||
fi | ||
|
||
if [[ -z "${SHASUM}" ]]; then | ||
SHASUM="/usr/bin/shasum" | ||
fi | ||
|
||
if [[ -z "${WORKING_DIR}" ]]; then | ||
WORKING_DIR="/tmp/zeppelin-release" | ||
fi | ||
|
||
mkdir "${WORKING_DIR}" | ||
|
||
usage() { | ||
echo "usage) $0 [Release version] [Branch or Tag]" | ||
echo " ex. $0 0.6.0 v0.6.0" | ||
exit 1 | ||
} | ||
|
||
function git_clone() { | ||
echo "Clone the source" | ||
# clone source | ||
git clone https://git-wip-us.apache.org/repos/asf/zeppelin.git "${WORKING_DIR}/zeppelin" | ||
|
||
if [[ $? -ne 0 ]]; then | ||
echo "Can not clone source repository" | ||
exit 1 | ||
fi | ||
|
||
cd "${WORKING_DIR}/zeppelin" | ||
git checkout "${GIT_TAG}" | ||
echo "Checked out ${GIT_TAG}" | ||
|
||
# remove unnecessary files | ||
rm "${WORKING_DIR}/zeppelin/.gitignore" | ||
rm -rf "${WORKING_DIR}/zeppelin/.git" | ||
rm -rf "${WORKING_DIR}/zeppelin/.github" | ||
rm -rf "${WORKING_DIR}/zeppelin/docs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,114 +18,93 @@ | |
# | ||
|
||
# The script helps making a release. | ||
# You need specify a release name and branch|tag name. | ||
# You need to specify release version and branch|tag name. | ||
# | ||
# Here's some helpful documents for the release | ||
# Here are some helpful documents for the release. | ||
# http://www.apache.org/dev/release.html | ||
# http://www.apache.org/dev/release-publishing | ||
# http://www.apache.org/dev/release-signing.html | ||
# http://www.apache.org/dev/publishing-maven-artifacts.html | ||
|
||
if [[ -z "${TAR}" ]]; then | ||
TAR=/usr/bin/tar | ||
fi | ||
|
||
if [[ -z "${SHASUM}" ]]; then | ||
SHASUM="/usr/bin/shasum -a 512" | ||
fi | ||
|
||
|
||
if [[ -z "${WORKING_DIR}" ]]; then | ||
WORKING_DIR=/tmp/zeppelin-release | ||
fi | ||
|
||
if [[ -z "${GPG_PASSPHRASE}" ]]; then | ||
echo "You need GPG_PASSPHRASE variable set" | ||
exit 1 | ||
fi | ||
|
||
BASEDIR="$(dirname "$0")" | ||
. "${BASEDIR}/common_release.sh" | ||
echo "${BASEDIR}/common_release.sh" | ||
|
||
if [[ $# -ne 2 ]]; then | ||
echo "usage) $0 [Release name] [Branch or Tag]" | ||
echo " ex. $0 0.6.0 branch-0.6" | ||
exit 1 | ||
usage | ||
fi | ||
|
||
RELEASE_NAME="${1}" | ||
BRANCH="${2}" | ||
|
||
|
||
if [[ -d "${WORKING_DIR}" ]]; then | ||
echo "Dir ${WORKING_DIR} already exists" | ||
exit 1 | ||
fi | ||
|
||
mkdir ${WORKING_DIR} | ||
|
||
echo "Cloning the source and packaging" | ||
# clone source | ||
git clone -b ${BRANCH} [email protected]:apache/zeppelin.git ${WORKING_DIR}/zeppelin | ||
if [[ $? -ne 0 ]]; then | ||
echo "Can not clone source repository" | ||
exit 1 | ||
if [[ -z "${GPG_PASSPHRASE}" ]]; then | ||
echo "You need GPG_PASSPHRASE variable set" | ||
exit 1 | ||
fi | ||
|
||
# remove unnecessary files | ||
rm ${WORKING_DIR}/zeppelin/.gitignore | ||
rm -rf ${WORKING_DIR}/zeppelin/.git | ||
|
||
|
||
|
||
# create source package | ||
cd ${WORKING_DIR} | ||
cp -r zeppelin zeppelin-${RELEASE_NAME} | ||
${TAR} cvzf zeppelin-${RELEASE_NAME}.tgz zeppelin-${RELEASE_NAME} | ||
|
||
echo "Signing the source package" | ||
cd ${WORKING_DIR} | ||
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --armor --output zeppelin-${RELEASE_NAME}.tgz.asc --detach-sig ${WORKING_DIR}/zeppelin-${RELEASE_NAME}.tgz | ||
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --print-md MD5 zeppelin-${RELEASE_NAME}.tgz > ${WORKING_DIR}/zeppelin-${RELEASE_NAME}.tgz.md5 | ||
${SHASUM} zeppelin-${RELEASE_NAME}.tgz > ${WORKING_DIR}/zeppelin-${RELEASE_NAME}.tgz.sha512 | ||
|
||
RELEASE_VERSION="$1" | ||
GIT_TAG="$2" | ||
|
||
function make_source_package() { | ||
# create source package | ||
cd ${WORKING_DIR} | ||
cp -r "zeppelin" "zeppelin-${RELEASE_VERSION}" | ||
${TAR} cvzf "zeppelin-${RELEASE_VERSION}.tgz" "zeppelin-${RELEASE_VERSION}" | ||
|
||
echo "Signing the source package" | ||
cd "${WORKING_DIR}" | ||
echo "${GPG_PASSPHRASE}" | gpg --passphrase-fd 0 --armor \ | ||
--output "zeppelin-${RELEASE_VERSION}.tgz.asc" \ | ||
--detach-sig "${WORKING_DIR}/zeppelin-${RELEASE_VERSION}.tgz" | ||
echo "${GPG_PASSPHRASE}" | gpg --passphrase-fd 0 \ | ||
--print-md MD5 "zeppelin-${RELEASE_VERSION}.tgz" > \ | ||
"${WORKING_DIR}/zeppelin-${RELEASE_VERSION}.tgz.md5" | ||
echo "${GPG_PASSPHRASE}" | gpg --passphrase-fd 0 \ | ||
--print-md SHA512 "zeppelin-${RELEASE_VERSION}.tgz" > \ | ||
"${WORKING_DIR}/zeppelin-${RELEASE_VERSION}.tgz.sha512" | ||
} | ||
|
||
function make_binary_release() { | ||
BIN_RELEASE_NAME="${1}" | ||
BUILD_FLAGS="${2}" | ||
|
||
cp -r ${WORKING_DIR}/zeppelin ${WORKING_DIR}/zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME} | ||
cd ${WORKING_DIR}/zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME} | ||
echo "mvn clean package -Pbuild-distr -DskipTests ${BUILD_FLAGS}" | ||
mvn clean package -Pbuild-distr -DskipTests ${BUILD_FLAGS} | ||
if [[ $? -ne 0 ]]; then | ||
echo "Build failed. ${BUILD_FLAGS}" | ||
exit 1 | ||
fi | ||
|
||
# re-create package with proper dir name with binary license | ||
cd zeppelin-distribution/target/zeppelin-* | ||
mv zeppelin-* zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME} | ||
cat ../../src/bin_license/LICENSE >> zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}/LICENSE | ||
cat ../../src/bin_license/NOTICE >> zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}/NOTICE | ||
cp ../../src/bin_license/licenses/* zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}/licenses/ | ||
${TAR} cvzf zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME} | ||
|
||
# sign bin package | ||
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --armor --output zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz.asc --detach-sig zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz | ||
echo $GPG_PASSPHRASE | gpg --passphrase-fd 0 --print-md MD5 zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz > zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz.md5 | ||
${SHASUM} zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz > zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz.sha512 | ||
|
||
mv zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz ${WORKING_DIR}/ | ||
mv zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz.asc ${WORKING_DIR}/ | ||
mv zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz.md5 ${WORKING_DIR}/ | ||
mv zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME}.tgz.sha512 ${WORKING_DIR}/ | ||
|
||
# clean up build dir | ||
rm -rf ${WORKING_DIR}/zeppelin-${RELEASE_NAME}-bin-${BIN_RELEASE_NAME} | ||
BIN_RELEASE_NAME="$1" | ||
BUILD_FLAGS="$2" | ||
|
||
cp -r "${WORKING_DIR}/zeppelin" "${WORKING_DIR}/zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}" | ||
cd "${WORKING_DIR}/zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}" | ||
echo "mvn clean package -Pbuild-distr -DskipTests ${BUILD_FLAGS}" | ||
mvn clean package -Pbuild-distr -DskipTests ${BUILD_FLAGS} | ||
if [[ $? -ne 0 ]]; then | ||
echo "Build failed. ${BUILD_FLAGS}" | ||
exit 1 | ||
fi | ||
|
||
# re-create package with proper dir name with binary license | ||
cd zeppelin-distribution/target/zeppelin-* | ||
mv zeppelin-* "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}" | ||
cat ../../src/bin_license/LICENSE >> "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}/LICENSE" | ||
cat ../../src/bin_license/NOTICE >> "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}/NOTICE" | ||
cp ../../src/bin_license/licenses/* "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}/licenses/" | ||
${TAR} cvzf "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz" "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}" | ||
|
||
# sign bin package | ||
echo "${GPG_PASSPHRASE}" | gpg --passphrase-fd 0 --armor \ | ||
--output "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz.asc" \ | ||
--detach-sig "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz" | ||
echo "${GPG_PASSPHRASE}" | gpg --passphrase-fd 0 --print-md MD5 \ | ||
"zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz" > \ | ||
"zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz.md5" | ||
${SHASUM} -a 512 "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz" > \ | ||
"zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz.sha512" | ||
|
||
mv "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz" "${WORKING_DIR}/" | ||
mv "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz.asc" "${WORKING_DIR}/" | ||
mv "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz.md5" "${WORKING_DIR}/" | ||
mv "zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}.tgz.sha512" "${WORKING_DIR}/" | ||
|
||
# clean up build dir | ||
rm -rf "${WORKING_DIR}/zeppelin-${RELEASE_VERSION}-bin-${BIN_RELEASE_NAME}" | ||
} | ||
|
||
make_binary_release all "-Pspark-1.6 -Phadoop-2.4 -Pyarn -Ppyspark" | ||
git_clone | ||
make_source_package | ||
make_binary_release all "-Pspark-1.6 -Phadoop-2.4 -Pyarn -Ppyspark -Psparkr -Pr" | ||
|
||
# remove non release files and dirs | ||
rm -rf ${WORKING_DIR}/zeppelin | ||
rm -rf ${WORKING_DIR}/zeppelin-${RELEASE_NAME} | ||
rm -rf "${WORKING_DIR}/zeppelin" | ||
rm -rf "${WORKING_DIR}/zeppelin-${RELEASE_VERSION}" | ||
echo "Release files are created under ${WORKING_DIR}" |
Oops, something went wrong.