diff --git a/dev-support/bin/create-release b/dev-support/bin/create-release index 94351d3f56..b22e90b322 100755 --- a/dev-support/bin/create-release +++ b/dev-support/bin/create-release @@ -50,6 +50,7 @@ function hadoop_abs declare obj=$1 declare dir declare fn + declare ret if [[ ! -e ${obj} ]]; then return 1 @@ -62,7 +63,8 @@ function hadoop_abs fi dir=$(cd -P -- "${dir}" >/dev/null 2>/dev/null && pwd -P) - if [[ $? = 0 ]]; then + ret=$? + if [[ ${ret} = 0 ]]; then echo "${dir}${fn}" return 0 fi @@ -287,6 +289,7 @@ function usage echo "--mvncache=[path] Path to the maven cache to use" echo "--native Also build the native components" echo "--rc-label=[label] Add this label to the builds" + echo "--security Emergency security release" echo "--sign Use .gnupg dir to sign the artifacts and jars" echo "--version=[version] Use an alternative version string" } @@ -330,6 +333,9 @@ function option_parse --rc-label=*) RC_LABEL=${i#*=} ;; + --security) + SECURITYRELEASE=true + ;; --sign) SIGN=true ;; @@ -397,6 +403,14 @@ function option_parse MVN_ARGS=("-Dmaven.repo.local=${MVNCACHE}") fi fi + + if [[ "${SECURITYRELEASE}" = true ]]; then + if [[ ! -d "${BASEDIR}/hadoop-common-project/hadoop-common/src/site/markdown/release/${HADOOP_VERSION}" ]]; then + hadoop_error "ERROR: ${BASEDIR}/hadoop-common-project/hadoop-common/src/site/markdown/release/${HADOOP_VERSION} does not exist." + hadoop_error "ERROR: This directory and its contents are required to be manually created for a security release." + exit 1 + fi + fi } function dockermode @@ -523,7 +537,7 @@ function makearelease big_console_header "Maven Build and Install" if [[ "${SIGN}" = true ]]; then - signflags=("-Psign" "-Dgpg.useagent=true" -Dgpg.executable="${GPG}") + signflags=("-Psign" "-Dgpg.useagent=true" "-Dgpg.executable=${GPG}") fi # Create SRC and BIN tarballs for release, @@ -534,6 +548,14 @@ function makearelease "${signflags[@]}" \ -DskipTests -Dtar $(hadoop_native_flags) + if [[ "${SECURITYRELEASE}" = true ]]; then + DOCFLAGS="-Pdocs" + hadoop_error "WARNING: Skipping automatic changelog and release notes generation due to --security" + else + DOCFLAGS="-Preleasedocs,docs" + fi + + # Create site for release # we need to do install again so that jdiff and # a few other things get registered in the maven @@ -542,7 +564,8 @@ function makearelease "${MVN}" "${MVN_ARGS[@]}" install \ site site:stage \ -DskipTests \ - -Pdist,src,releasedocs,docs + -Pdist,src \ + "${DOCFLAGS}" big_console_header "Staging the release" @@ -586,6 +609,7 @@ function makearelease function signartifacts { declare i + declare ret if [[ "${SIGN}" = false ]]; then for i in ${ARTIFACTS_DIR}/*; do @@ -612,7 +636,8 @@ function signartifacts ${GPG} --verify --trustdb "${BASEDIR}/target/testkeysdb" \ "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz.asc" \ "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz" - if [[ $? != 0 ]]; then + ret=$? + if [[ ${ret} != 0 ]]; then hadoop_error "ERROR: GPG key is not present in ${PUBKEYFILE}." hadoop_error "ERROR: This MUST be fixed. Exiting." exit 1 @@ -641,6 +666,7 @@ if [[ "${INDOCKER}" = true || "${DOCKERRAN}" = false ]]; then startgpgagent makearelease + releaseret=$? signartifacts @@ -651,7 +677,7 @@ if [[ "${INDOCKER}" = true ]]; then exit $? fi -if [[ $? == 0 ]]; then +if [[ ${releaseret} == 0 ]]; then echo echo "Congratulations, you have successfully built the release" echo "artifacts for Apache Hadoop ${HADOOP_VERSION}${RC_LABEL}"