You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@submarine.apache.org by zh...@apache.org on 2020/02/13 03:14:11 UTC

[submarine] branch master updated: SUBMARINE-323. Add how to release guide and scripts.

This is an automated email from the ASF dual-hosted git repository.

zhouquan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/submarine.git


The following commit(s) were added to refs/heads/master by this push:
     new 9cff5f4  SUBMARINE-323. Add how to release guide and scripts.
9cff5f4 is described below

commit 9cff5f4442fcbd30ee29e4b213d0d99ac4d5d27e
Author: Zhankun Tang <zt...@apache.org>
AuthorDate: Fri Feb 7 11:15:56 2020 +0800

    SUBMARINE-323. Add how to release guide and scripts.
    
    ### What is this PR for?
    Submarine release scripts and guide
    
    ### What type of PR is it?
    Feature
    
    ### Todos
    * [1] - Automate steps in cicd images
    
    ### What is the Jira issue?
    https://issues.apache.org/jira/browse/SUBMARINE-323
    
    ### How should this be tested?
    When a committer is preparing a new release, this can be verified.
    Zhankun has gone through the guide with the scripts. No big issue found yet.
    
    ### Questions:
    * Does the licenses files need update? No
    * Is there breaking changes for older versions? No
    * Does this needs documentation? Yes
    
    Author: Zhankun Tang <zt...@apache.org>
    
    Closes #175 from tangzhankun/SUBMARINE-323 and squashes the following commits:
    
    621eb39 [Zhankun Tang] discard TonY submodule commmand when publishing to mvn
    fe2119e [Zhankun Tang] discard TonY submodule commmand when creating release
    026d435 [Zhankun Tang] SUBMRINE-323. How to release guide and scripts.
---
 dev-support/cicd/HowToRelease.md    | 185 ++++++++++++++++++++++++++++++++++++
 dev-support/cicd/README.md          |   3 +-
 dev-support/cicd/common_release.sh  |  65 +++++++++++++
 dev-support/cicd/create_release.sh  | 106 +++++++++++++++++++++
 dev-support/cicd/publish_release.sh | 172 +++++++++++++++++++++++++++++++++
 5 files changed, 530 insertions(+), 1 deletion(-)

diff --git a/dev-support/cicd/HowToRelease.md b/dev-support/cicd/HowToRelease.md
new file mode 100644
index 0000000..5cd77e4
--- /dev/null
+++ b/dev-support/cicd/HowToRelease.md
@@ -0,0 +1,185 @@
+# How To Release Apache Submarine
+This document is for Apache Submarine committer and PMCs to do a new release.
+
+## Preparation
+If you have not already done so, generate your PGP key and append your [signing key](http://www.apache.org/dev/release-signing.html#keys-policy) to the [KEYS](https://dist.apache.org/repos/dist/release/submarine/KEYS) file. Once you commit your changes (ask for PMC's help if you cannot), they will automatically be propagated to the website. Also upload your key to a public key server if you haven't.
+End users use the KEYS file to validate that releases were done by an Apache committer.
+
+```
+# generate key and upload to the public
+gpg --gen-key
+gpg --list-sigs <your name>
+gpg --keyserver pgp.mit.edu --send-key <your publish key RSA string like B3097AC in the above cmd output>
+gpg --refresh-keys --keyserver pgp.mit.edu
+# adding your key to submarine KEYS
+gpg --list-sigs <your name> >> ~/key.txt
+gpg --armor --export <your name> >> ~/key.txt
+svn co --depth immediates https://dist.apache.org/repos/dist apache-dist
+cd apache-dist
+svn update --set-depth infinity release/submarine
+cd release/submarine
+echo ~/key.txt >> KEYS
+svn add KEYS
+svn ci -m "Add <your name>'s key"
+```
+
+## Release Plan
+It's better to send a release plan email informing code freeze date and release date.
+
+## Clean up the JIRA
+Bulk update JIRA to unassign from this release all issues that are open non-blockers.
+Assuming we're releasing version X, use below advanced filter in [submarine issue page](https://issues.apache.org/jira/projects/SUBMARINE). For instance, if we're releasing 0.3.0.
+```
+project in ("Apache Submarine") AND  "Target Version" = 0.3.0 AND statusCategory != Done
+```
+Click "tools"-> "bulk update" to edit all issues:
+1. Change the target version to X+1. Here it is 0.4.0
+2. Add a comment to inform contributors. Like this "Bulk update due to releasing 0.3.0. Please change it back if you think this is a blocker."
+
+Do a double-check to confirm that there's no issues found with the above filter. And send mail to the develeper list informing that we should mark "Target version" to 0.4.0 when creating new JIRAs.
+
+## Tagging
+Once the JIRA is cleaned up, we can tag the candidate release with below steps:
+```
+export version=0.3.0
+export cversion=0.3.0-RC0
+export tag=release-$cversion
+git tag -s release-$version -m "Release candidate - $version"
+# Verify the tag is signed with your GPG key
+git tag -v release-$cversion
+# Push the tag to upstream
+git push origin release-$cversion
+```
+
+## Build Artifacts
+
+The submarine artifacts consists of GPG signed source code tarball, binary tarball and docker images.
+```
+cd submarine/dev-support/cicd/
+./create_release.sh $version $tag
+#Move the artifacts to a folder instead of /tmp/
+mv /tmp/submarine-release ~/
+```
+
+## Upload Artifacts For Vote
+Before the uploading, we need to do some basic testing for the release candidates. For instance, build from the source tarball and run feature test using the binary tarball.
+
+### Staging Source and Binary Tarball to self FTP server
+```
+cd ~/submarine-release
+sftp home.apache.org
+cd public_html
+mkdir submarine-0.3.0-RC0
+put -r .
+exit
+```
+### Staging Docker Images
+#### Package An Existing Release Candidates
+When doing release, the release manager might needs to package a artifact candidatesin this docker image and public the image candidate for a vote.
+In this scenario, we can do this:
+
+Put submarine candidate aritifacts to a folder like "~/releases/submarine-release"
+```
+$ ls $release_candidates_path
+submarine-dist-0.3.0-hadoop-2.9.tar.gz        submarine-dist-0.3.0-src.tar.gz.asc
+submarine-dist-0.3.0-hadoop-2.9.tar.gz.asc    submarine-dist-0.3.0-src.tar.gz.sha512
+submarine-dist-0.3.0-hadoop-2.9.tar.gz.sha512 submarine-dist-0.3.0-src.tar.gz
+```
+```
+export submarine_version=0.3.0
+export release_candidates_path=~/releases/submarine-release
+./build_mini-submarine.sh
+#docker run -it -h submarine-dev --net=bridge --privileged -P local/mini-submarine:0.3.0 /bin/bash
+docker tag local/mini-submarine:0.3.0 apache/submarine:mini-0.3.0-RC0
+```
+In the container, we can verify that the submarine jar version is the expected 0.3.0. Then we can upload this image with a "RC" tag for a vote.
+```
+docker push apache/mini-submarine:0.3.0:RC0
+```
+### Publish Jars To Apache Maven Staging Repository
+```
+export GPG_PASSPHRASE=yourPassphase
+export ASF_USERID=yourApacheId
+export ASF_PASSWORD=yourApachePwd
+./publish_release.sh $version $tag
+```
+Then to view the staging repo, we can login the the https://repository.apache.org with the apache id. Click the "Staging Reposotories" in the left side of the web page. And click "orgapachesubmarine-1001", then you will see the details of the repo including the URI. The URI is like this:
+"https://repository.apache.org/content/repositories/orgapachesubmarine-1001"
+
+### Call A Vote For The Release Candidate
+After the artifacts and images are staged, we can send a vote email to the community. It's recommended that we paste the URI of RC tag, RC release artifacts, docker images, maven staging repository and the KEYS.
+Refer to [here](https://www.mail-archive.com/dev@submarine.apache.org/msg01498.html) for an example.
+
+## Release
+In several days if the [vote passes](http://hadoop.apache.org/bylaws#Decision+Making), we can publish the release.
+If the vote fails, then we need to start another RC from tagging to the staging.
+
+1. Access [submarine project version page](https://issues.apache.org/jira/projects/SUBMARINE?selectedItem=com.atlassian.jira.jira-projects-plugin:release-page&status=unreleased). Click the version to be released, and then click the "Release" button. It will request the release date. We can fill it with the end-of-vote date.
+
+2. Tag the release.
+```
+export version=0.3.0
+git tag -s rel/release-${version} -m "Submarine ${version} release"
+git push origin rel/release-${version}
+```
+
+3. Copy release artifacts to apache dist server
+```
+svn co --depth immediates https://dist.apache.org/repos/dist apache-dist
+cd apache-dist
+svn update --set-depth infinity dev/submarine
+svn update --set-depth infinity release/submarine
+cd dev/submarine
+mkdir submarine-$version
+cp ~/submarine-release/*  submarine-$version/
+svn add submarine-$version
+svn ci -m "Publishing the bits for submarine release ${version} to apache dist dev folder"
+cd ../../
+svn mv dev/submarine/submarine-$version release/submarine/
+svn ci -m "Publishing the bits for submarine release ${version}"
+```
+
+Usually binary tarball becomes larger than 300MB, so it cannot be directly uploaded to the distribution directory. We can use the dev directory (https://dist.apache.org/repos/dist/dev/submarine/) first and then move it to the distribution directory by svn move
+
+4. In [Nexus](https://repository.apache.org/), effect the release of artifacts by selecting the staged repository and then clicking Release. If there were multiple RCs, simply drop the staging repositories corresponding to failed RCs.
+
+5. Upload the images
+```
+docker tag apache/submarine:mini-0.3.0-RC0 apache/submarine:mini-0.3.0
+docker push apache/submarine:mini-0.3.0
+```
+
+6. Update the version in pom.xml
+```
+# if the new version a a point release
+mvn versions:set -DgenerateBackupPoms=false -DnewVersion=X.(Y+1).Z-SNAPSHOT
+git commit -a -m "Preparing for X.(Y+1).Z development"
+```
+
+7. Wait 24 hours for release to propagate to mirrors.
+
+8. Update the website. The guide is [here](https://github.com/apache/submarine-site)
+```
+git clone https://github.com/apache/submarine-site.git
+cd submarine-site
+git checkout master
+# Edit download.md to add the new release content
+# The url of the binary and source tarball should be like
+# "https://www.apache.org/dyn/closer.cgi/submarine/submarine-0.3.0/submarine-dist-0.3.0-hadoop-2.9.tar.gz"
+# due to it will find a mirror server for different region.
+# The url of the signature and checksum should be like
+# "https://www.apache.org/dist/submarine/submarine-0.3.0/submarine-dist-0.3.0-hadoop-2.9.tar.gz.sha512)"
+# due to they're not mirrored from apache dist server.
+# For the release note web page, we need to create a MD file under "releases" directory
+# like "submarine-release-0.3.0.md". The count of issues can be found
+# from JIRA like "https://issues.apache.org/jira/projects/SUBMARINE/versions/12345556".
+# And the details of issues can also get from "Release Notes" in that page.
+cp release/submarine-release-0.3.0.md release/submarine-release-<new version>.md
+vim release/submarine-release-<new version>.md
+cd ..
+docker run -it -p 4000:4000 -v $PWD/submarine-site:/submarine-site hadoopsubmarine/submarine-website:1.0.0 bash
+cd /submarine-site
+bundle exec jekyll serve --watch --host=0.0.0.0
+# Open another terminal, you can edit MD files and refresh the webpage to see changes instantly.
+```
+9. Send announcements to the user and developer lists once the site changes are visible.
diff --git a/dev-support/cicd/README.md b/dev-support/cicd/README.md
index b021404..4ed4c3a 100644
--- a/dev-support/cicd/README.md
+++ b/dev-support/cicd/README.md
@@ -15,7 +15,8 @@
 
 > Please note that cicd is a tool provided to submarine committers for PR merging and release. Only submarine committers have permission to execute.
 
-This cicd directory contains several scripts to ease code and release management.
+This cicd directory contains several scripts to ease code and release management. For how-to-release, check [here](./HowToRelease.md)
+
 To use them more easily, we provide a Docker image to help committer to handle tasks like committing code and release build.
 
 ## Docker mode
diff --git a/dev-support/cicd/common_release.sh b/dev-support/cicd/common_release.sh
new file mode 100755
index 0000000..5d84245
--- /dev/null
+++ b/dev-support/cicd/common_release.sh
@@ -0,0 +1,65 @@
+#!/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/submarine-release"
+fi
+
+DEBUG_SUBMARINE_SCRIPT=false
+if $DEBUG_SUBMARINE_SCRIPT; then
+  echo "DEBUGGING, skip remove ${WORKING_DIR}"
+else
+  echo "Cleaning up ${WORKING_DIR}"
+  rm -rf "${WORKING_DIR}"
+  mkdir "${WORKING_DIR}"
+fi
+
+# If set to 'yes', release script will deploy artifacts to SNAPSHOT repository.
+DO_SNAPSHOT='no'
+
+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/submarine.git "${WORKING_DIR}/submarine"
+
+  if [[ $? -ne 0 ]]; then
+    echo "Can not clone source repository"
+    exit 1
+  fi
+
+  cd "${WORKING_DIR}/submarine"
+  git checkout "${GIT_TAG}"
+  echo "Checked out ${GIT_TAG}"
+}
diff --git a/dev-support/cicd/create_release.sh b/dev-support/cicd/create_release.sh
new file mode 100755
index 0000000..418f800
--- /dev/null
+++ b/dev-support/cicd/create_release.sh
@@ -0,0 +1,106 @@
+#!/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.
+#
+
+# The script helps making a release.
+# You need to specify release version and branch|tag name.
+#
+# 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
+
+set -e
+
+BASEDIR="$(dirname "$0")"
+. "${BASEDIR}/common_release.sh"
+echo "${BASEDIR}/common_release.sh"
+
+if [[ $# -ne 2 ]]; then
+  usage
+fi
+
+for var in GPG_PASSPHRASE; do
+  if [[ -z "${!var}" ]]; then
+    echo "You need ${var} variable set"
+    exit 1
+  fi
+done
+
+RELEASE_VERSION="$1"
+GIT_TAG="$2"
+
+function compile_src_and_bin() {
+  cd ${WORKING_DIR}/submarine
+  echo "mvn versions:set -DnewVersion=${RELEASE_VERSION}"
+  mvn versions:set -DnewVersion="${RELEASE_VERSION}"
+  echo "mvn clean install package -DskipTests -Psrc"
+  mvn clean install package -DskipTests -Psrc
+  if [[ $? -ne 0 ]]; then
+    echo "Build failed. ${BUILD_FLAGS}"
+    exit 1
+  fi
+
+}
+
+function make_source_package() {
+  # create source package
+  cd ${WORKING_DIR}/submarine/submarine-dist/target
+  cd submarine-dist-*-src
+  # remove unneeded dir .github
+  rm -rf submarine-dist-${RELEASE_VERSION}-src/.github
+  ${TAR} cfz "submarine-dist-${RELEASE_VERSION}-src.tar.gz" "submarine-dist-${RELEASE_VERSION}-src"
+  mv "submarine-dist-${RELEASE_VERSION}-src.tar.gz" ${WORKING_DIR}
+  echo "Signing the source package"
+  cd "${WORKING_DIR}"
+  echo "${GPG_PASSPHRASE}" | gpg --passphrase-fd 0 --armor \
+    --output "submarine-dist-${RELEASE_VERSION}-src.tar.gz.asc" \
+    --detach-sig "${WORKING_DIR}/submarine-dist-${RELEASE_VERSION}-src.tar.gz"
+  ${SHASUM} -a 512 "submarine-dist-${RELEASE_VERSION}-src.tar.gz" > \
+    "${WORKING_DIR}/submarine-dist-${RELEASE_VERSION}-src.tar.gz.sha512"
+}
+
+function make_binary_release() {
+  R_DIR_NAME=submarine-dist-${RELEASE_VERSION}-hadoop-2.9
+  cd ${WORKING_DIR}/submarine/submarine-dist/target
+  mv "${R_DIR_NAME}.tar.gz" ${WORKING_DIR}
+  # sign bin package
+  cd ${WORKING_DIR}
+  echo "${GPG_PASSPHRASE}" | gpg --passphrase-fd 0 --armor \
+    --output "${R_DIR_NAME}.tar.gz.asc" \
+    --detach-sig "${R_DIR_NAME}.tar.gz"
+  ${SHASUM} -a 512 "${R_DIR_NAME}.tar.gz" > \
+    "${R_DIR_NAME}.tar.gz.sha512"
+}
+
+if [ -d "${WORKING_DIR}/submarine/submarine-dist/target" ]; then
+  if $DEBUG_SUBMARINE_SCRIPT; then
+    echo "DEBUGGING, skip re-building submarine"
+  fi
+else
+  git_clone
+  compile_src_and_bin
+fi
+
+make_source_package
+make_binary_release
+
+# remove non release files and dirs
+echo "Deleting ${WORKING_DIR}/submarine"
+rm -rf "${WORKING_DIR}/submarine"
+echo "Release files are created under ${WORKING_DIR}"
diff --git a/dev-support/cicd/publish_release.sh b/dev-support/cicd/publish_release.sh
new file mode 100755
index 0000000..cf73a19
--- /dev/null
+++ b/dev-support/cicd/publish_release.sh
@@ -0,0 +1,172 @@
+#!/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.
+#
+
+# The script helps publishing release to maven.
+# You need to specify release version and branch|tag name.
+#
+# Here's some helpful documents for the release.
+# http://www.apache.org/dev/publishing-maven-artifacts.html
+set -e
+BASEDIR="$(dirname "$0")"
+. "${BASEDIR}/common_release.sh"
+
+if [[ $# -ne 2 ]]; then
+  usage
+fi
+
+for var in GPG_PASSPHRASE ASF_USERID ASF_PASSWORD; do
+  if [[ -z "${!var}" ]]; then
+    echo "You need ${var} variable set"
+    exit 1
+  fi
+done
+
+export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512m"
+RED='\033[0;31m'
+NC='\033[0m' # No Color
+
+RELEASE_VERSION="$1"
+GIT_TAG="$2"
+if [[ $RELEASE_VERSION == *"SNAPSHOT"* ]]; then
+  DO_SNAPSHOT="yes"
+fi
+
+NEXUS_STAGING="https://repository.apache.org/service/local/staging"
+# Get this from apache infra admin
+NEXUS_PROFILE="2525cde13fad2a"
+
+function cleanup() {
+  echo "Remove working directory and maven local repository"
+  rm -rf ${WORKING_DIR}
+}
+
+function curl_error() {
+  ret=${1}
+  if [[ $ret -ne 0 ]]; then
+    echo "curl response code is: ($ret)"
+    echo "See https://curl.haxx.se/libcurl/c/libcurl-errors.html to know the detailed cause of error."
+    echo -e "${RED}Failed to publish maven artifact to staging repository."
+    echo -e "IMPORTANT: You will have to re-run publish_release.sh to complete maven artifact publish.${NC}"
+    cleanup
+    exit 1
+  fi
+}
+
+
+#
+# Publishing Apache Submarine artifact to Apache snapshot repository.
+#
+function publish_snapshot_to_maven() {
+  cd "${WORKING_DIR}/submarine"
+  echo "Deploying Apache Submarine $RELEASE_VERSION version to snapshot repository."
+
+  if [[ ! $RELEASE_VERSION == *"SNAPSHOT"* ]]; then
+    echo "ERROR: Snapshots must have a version containing 'SNAPSHOT'"
+    echo "ERROR: You gave version '$RELEASE_VERSION'"
+    exit 1
+  fi
+
+  tmp_repo="$(mktemp -d /tmp/submarine-repo-XXXXX)"
+  mvn versions:set -DnewVersion=$RELEASE_VERSION
+  tmp_settings="tmp-settings.xml"
+  echo "<settings><servers><server>" > $tmp_settings
+  echo "<id>apache.snapshots.https</id><username>$ASF_USERID</username>" >> $tmp_settings
+  echo "<password>$ASF_PASSWORD</password>" >> $tmp_settings
+  echo "</server></servers></settings>" >> $tmp_settings
+
+  mvn --settings $tmp_settings -Dmaven.repo.local="${tmp_repo}" -DskipTests deploy
+
+  rm $tmp_settings
+  rm -rf $tmp_repo
+}
+
+function publish_to_maven() {
+  cd "${WORKING_DIR}/submarine"
+  # Force release version
+  mvn versions:set -DnewVersion="${RELEASE_VERSION}"
+
+  # Using Nexus API documented here:
+  # https://support.sonatype.com/hc/en-us/articles/213465868-Uploading-to-a-Staging-Repository-via-REST-API
+  echo "Creating Nexus staging repository"
+  repo_request="<promoteRequest><data><description>Apache Submarine ${RELEASE_VERSION}</description></data></promoteRequest>"
+  out="$(curl -X POST -d "${repo_request}" -u "${ASF_USERID}:${ASF_PASSWORD}" \
+    -H 'Content-Type:application/xml' -v \
+    "${NEXUS_STAGING}/profiles/${NEXUS_PROFILE}/start")"
+  create_ret=$?
+  curl_error $create_ret
+  staged_repo_id="$(echo ${out} | sed -e 's/.*\(orgapachesubmarine-[0-9]\{4\}\).*/\1/')"
+  if [[ -z "${staged_repo_id}" ]]; then
+    echo "Fail to create staging repository"
+    exit 1
+  fi
+
+  echo "Created Nexus staging repository: ${staged_repo_id}"
+
+  rm -rf $HOME/.m2/repository/org/apache/submarine
+
+  # build and install to local
+  echo "mvn clean install -DskipTests"
+  mvn clean install -DskipTests
+  if [[ $? -ne 0 ]]; then
+    echo "Mvn install failed."
+    exit 1
+  fi
+
+  pushd "${HOME}/.m2/repository/org/apache/submarine"
+  find . -type f | grep -v '\.jar$' | grep -v '\.pom$' |grep -v '\.war$' | xargs rm
+
+  echo "Creating hash and signature files"
+  for file in $(find . -type f); do
+    echo "${GPG_PASSPHRASE}" | gpg --passphrase-fd 0 --output "${file}.asc" \
+      --detach-sig --armor "${file}"
+    md5 -q "${file}" > "${file}.md5"
+    ${SHASUM} -a 1 "${file}" | cut -f1 -d' ' > "${file}.sha1"
+  done
+
+  nexus_upload="${NEXUS_STAGING}/deployByRepositoryId/${staged_repo_id}"
+  echo "Uplading files to ${nexus_upload}"
+  for file in $(find . -type f); do
+    # strip leading ./
+    file_short="$(echo "${file}" | sed -e 's/\.\///')"
+    dest_url="${nexus_upload}/org/apache/submarine/$file_short"
+    echo "  Uploading ${file_short}"
+    curl -u "${ASF_USERID}:${ASF_PASSWORD}" --upload-file "${file_short}" "${dest_url}"
+    upload_ret=$?
+    curl_error $upload_ret
+  done
+
+  echo "Closing nexus staging repository"
+  repo_request="<promoteRequest><data><stagedRepositoryId>${staged_repo_id}</stagedRepositoryId><description>Apache Submarine ${RELEASE_VERSION}</description></data></promoteRequest>"
+  out="$(curl -X POST -d "${repo_request}" -u "${ASF_USERID}:${ASF_PASSWORD}" \
+    -H 'Content-Type:application/xml' -v \
+    "${NEXUS_STAGING}/profiles/${NEXUS_PROFILE}/finish")"
+  close_ret=$?
+  curl_error $close_ret
+  echo "Closed Nexus staging repository: ${staged_repo_id}"
+  popd
+  echo "Complete publishing maven artifacts to apache staging repository"
+  echo "Once release candidate pass the vote, do not forget to hit the release button in https://repository.apache.org"
+}
+
+git_clone
+if [[ "${DO_SNAPSHOT}" == 'yes' ]]; then
+  publish_snapshot_to_maven
+else
+  publish_to_maven
+fi
+cleanup


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@submarine.apache.org
For additional commands, e-mail: dev-help@submarine.apache.org