HADOOP-15058. create-release site build outputs dummy shaded jars due to skipShade. Contributed by Andrew Wang.

This commit is contained in:
Sean Mackrory 2017-12-04 15:39:33 -07:00
parent d8863fc16f
commit 5533648241

View File

@ -202,6 +202,8 @@ function set_defaults
| head -1 \ | head -1 \
| sed -e 's|^ *<version>||' -e 's|</version>.*$||') | sed -e 's|^ *<version>||' -e 's|</version>.*$||')
DEPLOY=false
DOCKER=false DOCKER=false
DOCKERCACHE=false DOCKERCACHE=false
DOCKERFILE="${BASEDIR}/dev-support/docker/Dockerfile" DOCKERFILE="${BASEDIR}/dev-support/docker/Dockerfile"
@ -283,6 +285,7 @@ function usage
{ {
echo "--artifactsdir=[path] Path to use to store release bits" echo "--artifactsdir=[path] Path to use to store release bits"
echo "--asfrelease Make an ASF release" echo "--asfrelease Make an ASF release"
echo "--deploy Deploy Maven artifacts using ~/.m2/settings.xml"
echo "--docker Use Hadoop's Dockerfile for guaranteed environment" echo "--docker Use Hadoop's Dockerfile for guaranteed environment"
echo "--dockercache Use a Docker-private maven cache" echo "--dockercache Use a Docker-private maven cache"
echo "--logdir=[path] Path to store logs" echo "--logdir=[path] Path to store logs"
@ -304,10 +307,14 @@ function option_parse
ASFRELEASE=true ASFRELEASE=true
NATIVE=true NATIVE=true
SIGN=true SIGN=true
DEPLOY=true
;; ;;
--artifactsdir=*) --artifactsdir=*)
ARTIFACTS_DIR=${i#*=} ARTIFACTS_DIR=${i#*=}
;; ;;
--deploy)
DEPLOY=true
;;
--docker) --docker)
DOCKER=true DOCKER=true
;; ;;
@ -360,6 +367,11 @@ function option_parse
fi fi
fi fi
if [[ "${DEPLOY}" = true && ! -f "${HOME}/.m2/settings.xml" ]]; then
hadoop_error "ERROR: No ~/.m2/settings.xml file, cannot deploy Maven artifacts."
exit 1
fi
DOCKERCMD=$(command -v docker) DOCKERCMD=$(command -v docker)
if [[ "${DOCKER}" = true && -z "${DOCKERCMD}" ]]; then if [[ "${DOCKER}" = true && -z "${DOCKERCMD}" ]]; then
hadoop_error "ERROR: docker binary not found. Disabling docker mode." hadoop_error "ERROR: docker binary not found. Disabling docker mode."
@ -452,6 +464,11 @@ function dockermode
extrad+=("-v" "${lines}:${lines}") extrad+=("-v" "${lines}:${lines}")
fi fi
if [[ "${DEPLOY}" = true ]]; then
modp+=("--deploy")
extrad+=("-v" "${HOME}/.m2/settings.xml:/home/${user_name}/.m2/settings.xml")
fi
if [[ "${DOCKERCACHE}" = true ]]; then if [[ "${DOCKERCACHE}" = true ]]; then
modp+=("--mvncache=/maven") modp+=("--mvncache=/maven")
else else
@ -540,14 +557,32 @@ function makearelease
signflags=("-Psign" "-Dgpg.useagent=true" "-Dgpg.executable=${GPG}") signflags=("-Psign" "-Dgpg.useagent=true" "-Dgpg.executable=${GPG}")
fi fi
local target="install"
if [[ "${DEPLOY}" = true ]]; then
target="deploy"
fi
# Create SRC and BIN tarballs for release, # Create SRC and BIN tarballs for release,
# shellcheck disable=SC2046 # shellcheck disable=SC2046
run_and_redirect "${LOGDIR}/mvn_install.log" \ run_and_redirect "${LOGDIR}/mvn_${target}.log" \
"${MVN}" "${MVN_ARGS[@]}" install \ "${MVN}" "${MVN_ARGS[@]}" ${target} \
-Pdist,src,yarn-ui \ -Pdist,src,yarn-ui \
"${signflags[@]}" \ "${signflags[@]}" \
-DskipTests -Dtar $(hadoop_native_flags) -DskipTests -Dtar $(hadoop_native_flags)
# Stage BIN tarball
run cd "${BASEDIR}"
run mv \
"${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}.tar.gz" \
"${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz"
# Stage SRC tarball
run mv \
"${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}-src.tar.gz" \
"${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-src.tar.gz"
big_console_header "Maven Site"
if [[ "${SECURITYRELEASE}" = true ]]; then if [[ "${SECURITYRELEASE}" = true ]]; then
DOCFLAGS="-Pdocs" DOCFLAGS="-Pdocs"
hadoop_error "WARNING: Skipping automatic changelog and release notes generation due to --security" hadoop_error "WARNING: Skipping automatic changelog and release notes generation due to --security"
@ -555,7 +590,6 @@ function makearelease
DOCFLAGS="-Preleasedocs,docs" DOCFLAGS="-Preleasedocs,docs"
fi fi
# Create site for release # Create site for release
# we need to do install again so that jdiff and # we need to do install again so that jdiff and
# a few other things get registered in the maven # a few other things get registered in the maven
@ -568,13 +602,17 @@ function makearelease
-Pdist,src \ -Pdist,src \
"${DOCFLAGS}" "${DOCFLAGS}"
big_console_header "Staging the release" # Create the site tarball
run mv "${BASEDIR}/target/staging/hadoop-project" "${BASEDIR}/target/r${HADOOP_VERSION}/" run mv "${BASEDIR}/target/staging/hadoop-project" "${BASEDIR}/target/r${HADOOP_VERSION}/"
run cd "${BASEDIR}/target/" run cd "${BASEDIR}/target/"
run tar czpf "hadoop-site-${HADOOP_VERSION}.tar.gz" "r${HADOOP_VERSION}"/* run tar czpf "hadoop-site-${HADOOP_VERSION}.tar.gz" "r${HADOOP_VERSION}"/*
run cd "${BASEDIR}" run cd "${BASEDIR}"
# Stage SITE tarball
run mv \
"${BASEDIR}/target/hadoop-site-${HADOOP_VERSION}.tar.gz" \
"${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-site.tar.gz"
# Stage RAT report # Stage RAT report
#shellcheck disable=SC2038 #shellcheck disable=SC2038
find . -name rat.txt | xargs -I% cat % > "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-rat.txt" find . -name rat.txt | xargs -I% cat % > "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-rat.txt"
@ -586,25 +624,14 @@ function makearelease
"${ARTIFACTS_DIR}/${i}.md" "${ARTIFACTS_DIR}/${i}.md"
done done
# Prepare and stage BIN tarball # We need to fixup the BIN tarball at the end to contain the site docs.
run cd "${BASEDIR}/hadoop-dist/target/" run cd "${ARTIFACTS_DIR}"
run tar -xzpf "hadoop-${HADOOP_VERSION}.tar.gz" run tar -xzpf "hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz"
run mkdir -p "hadoop-${HADOOP_VERSION}/share/doc/hadoop/"
run cp -r "${BASEDIR}/target/r${HADOOP_VERSION}"/* "hadoop-${HADOOP_VERSION}/share/doc/hadoop/" run cp -r "${BASEDIR}/target/r${HADOOP_VERSION}"/* "hadoop-${HADOOP_VERSION}/share/doc/hadoop/"
run tar -czpf "hadoop-${HADOOP_VERSION}.tar.gz" "hadoop-${HADOOP_VERSION}" run tar -czpf "hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz" "hadoop-${HADOOP_VERSION}"
run cd "${BASEDIR}" run rm -rf "hadoop-${HADOOP_VERSION}"
run mv \
"${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}.tar.gz" \
"${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz"
# Stage SRC tarball
run mv \
"${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}-src.tar.gz" \
"${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-src.tar.gz"
# Stage SITE tarball
run mv \
"${BASEDIR}/target/hadoop-site-${HADOOP_VERSION}.tar.gz" \
"${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-site.tar.gz"
} }
function signartifacts function signartifacts