create-release 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677
  1. #!/usr/bin/env bash
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. if [[ -z "${BASH_VERSINFO[0]}" ]] \
  17. || [[ "${BASH_VERSINFO[0]}" -lt 3 ]] \
  18. || [[ "${BASH_VERSINFO[0]}" -eq 3 && "${BASH_VERSINFO[1]}" -lt 2 ]]; then
  19. echo "bash v3.2+ is required. Sorry."
  20. exit 1
  21. fi
  22. function centered_text
  23. {
  24. local text="$*"
  25. local spacing=$(( (75+${#text}) /2 ))
  26. printf "%*s\n" ${spacing} "${text}"
  27. }
  28. function big_console_header
  29. {
  30. printf "\n\n"
  31. echo "****************************************************************************"
  32. centered_text "${@}"
  33. echo "****************************************************************************"
  34. printf "\n\n"
  35. }
  36. ## @description Given a filename or dir, return the absolute version of it
  37. ## @audience public
  38. ## @stability stable
  39. ## @param directory
  40. ## @replaceable no
  41. ## @return 0 success
  42. ## @return 1 failure
  43. ## @return stdout abspath
  44. function hadoop_abs
  45. {
  46. declare obj=$1
  47. declare dir
  48. declare fn
  49. if [[ ! -e ${obj} ]]; then
  50. return 1
  51. elif [[ -d ${obj} ]]; then
  52. dir=${obj}
  53. else
  54. dir=$(dirname -- "${obj}")
  55. fn=$(basename -- "${obj}")
  56. fn="/${fn}"
  57. fi
  58. dir=$(cd -P -- "${dir}" >/dev/null 2>/dev/null && pwd -P)
  59. if [[ $? = 0 ]]; then
  60. echo "${dir}${fn}"
  61. return 0
  62. fi
  63. return 1
  64. }
  65. ## @description Print a message to stderr
  66. ## @audience public
  67. ## @stability stable
  68. ## @replaceable no
  69. ## @param string
  70. function hadoop_error
  71. {
  72. echo "$*" 1>&2
  73. }
  74. function run_and_redirect
  75. {
  76. declare logfile=$1
  77. shift
  78. declare res
  79. echo "\$ ${*} > ${logfile} 2>&1"
  80. # to the log
  81. {
  82. date
  83. echo "cd $(pwd)"
  84. echo "${*}"
  85. } > "${logfile}"
  86. # run the actual command
  87. "${@}" >> "${logfile}" 2>&1
  88. res=$?
  89. if [[ ${res} != 0 ]]; then
  90. echo
  91. echo "Failed!"
  92. echo
  93. exit "${res}"
  94. fi
  95. }
  96. function hadoop_native_flags
  97. {
  98. # modified version of the Yetus personality
  99. if [[ ${NATIVE} != true ]]; then
  100. return
  101. fi
  102. # Based upon HADOOP-11937
  103. #
  104. # Some notes:
  105. #
  106. # - getting fuse to compile on anything but Linux
  107. # is always tricky.
  108. # - Darwin assumes homebrew is in use.
  109. # - HADOOP-12027 required for bzip2 on OS X.
  110. # - bzip2 is broken in lots of places.
  111. # e.g, HADOOP-12027 for OS X. so no -Drequire.bzip2
  112. #
  113. case "${OSNAME}" in
  114. Linux)
  115. # shellcheck disable=SC2086
  116. echo -Pnative -Drequire.snappy -Drequire.openssl -Drequire.fuse
  117. ;;
  118. Darwin)
  119. echo \
  120. -Pnative -Drequire.snappy \
  121. -Drequire.openssl \
  122. -Dopenssl.prefix=/usr/local/opt/openssl/ \
  123. -Dopenssl.include=/usr/local/opt/openssl/include \
  124. -Dopenssl.lib=/usr/local/opt/openssl/lib
  125. ;;
  126. *)
  127. # shellcheck disable=SC2086
  128. echo \
  129. -Pnative \
  130. -Drequire.snappy -Drequire.openssl \
  131. -Drequire.test.libhadoop
  132. ;;
  133. esac
  134. }
  135. # Function to probe the exit code of the script commands,
  136. # and stop in the case of failure with an contextual error
  137. # message.
  138. function run()
  139. {
  140. declare res
  141. declare logfile
  142. echo "\$ ${*}"
  143. "${@}"
  144. res=$?
  145. if [[ ${res} != 0 ]]; then
  146. echo
  147. echo "Failed!"
  148. echo
  149. exit "${res}"
  150. fi
  151. }
  152. function domd5()
  153. {
  154. run "${MD5SUM}" "${1}" > "${1}.md5"
  155. }
  156. ## @description set JAVA_HOME properly
  157. ## @audience public
  158. ## @stability unstable
  159. function locate_jvm()
  160. {
  161. JAVA_HOME="$(ls -d /usr/lib/jvm/*${JVM_VERSION}* | grep "${JVM_HINT}" | head -1 )"
  162. export JAVA_HOME
  163. }
  164. function header()
  165. {
  166. echo
  167. printf "\n\n"
  168. echo "============================================================================"
  169. echo "============================================================================"
  170. centered_text "Hadoop Release Creator"
  171. echo "============================================================================"
  172. echo "============================================================================"
  173. printf "\n\n"
  174. echo "Version to create : ${HADOOP_VERSION}"
  175. echo "Release Candidate Label: ${RC_LABEL##-}"
  176. echo "Source Version : ${DEFAULT_HADOOP_VERSION}"
  177. echo "Using JDK : ${JAVA_HOME}"
  178. printf "\n\n"
  179. }
  180. function set_defaults
  181. {
  182. BINDIR=$(dirname "${BIN}")
  183. BASEDIR=$(hadoop_abs "${BINDIR}/../..")
  184. ARTIFACTS_DIR="${BASEDIR}/target/artifacts"
  185. # Extract Hadoop version from ${BASEDIR}/pom.xml
  186. DEFAULT_HADOOP_VERSION=$(grep "<version>" "${BASEDIR}/pom.xml" \
  187. | head -1 \
  188. | sed -e 's|^ *<version>||' -e 's|</version>.*$||')
  189. DOCKER=false
  190. DOCKERCACHE=false
  191. DOCKERFILE="${BASEDIR}/dev-support/docker/Dockerfile"
  192. DOCKERRAN=false
  193. # Extract Java version from ${BASEDIR}/pom.xml
  194. # doing this outside of maven means we can do this before
  195. # the docker container comes up...
  196. JVM_VERSION=$(grep "<javac.version>" "${BASEDIR}/hadoop-project/pom.xml" \
  197. | head -1 \
  198. | sed -e 's|^ *<javac.version>||' -e 's|</javac.version>.*$||' -e 's|..||')
  199. GIT=$(command -v git)
  200. GPG=$(command -v gpg)
  201. GPGAGENT=$(command -v gpg-agent)
  202. HADOOP_VERSION="${DEFAULT_HADOOP_VERSION}"
  203. INDOCKER=false
  204. LOGDIR="${BASEDIR}/patchprocess"
  205. if [[ -z "${MVN}" ]]; then
  206. if [[ -n "${MAVEN_HOME}" ]]; then
  207. MVN=${MAVEN_HOME}/bin/mvn
  208. else
  209. MVN=$(command -v mvn)
  210. fi
  211. fi
  212. MD5SUM=$(command -v md5sum)
  213. if [[ -z "${MD5SUM}" ]]; then
  214. MD5SUM=$(command -v md5)
  215. fi
  216. NATIVE=false
  217. OSNAME=$(uname -s)
  218. PUBKEYFILE="https://dist.apache.org/repos/dist/release/hadoop/common/KEYS"
  219. SIGN=false
  220. }
  221. function startgpgagent
  222. {
  223. if [[ "${SIGN}" = true ]]; then
  224. if [[ -n "${GPGAGENT}" && -z "${GPG_AGENT_INFO}" ]]; then
  225. echo "starting gpg agent"
  226. echo "default-cache-ttl 14400" > "${LOGDIR}/gpgagent.conf"
  227. # shellcheck disable=2046
  228. eval $("${GPGAGENT}" --daemon \
  229. --options "${LOGDIR}/gpgagent.conf" \
  230. --log-file="${LOGDIR}/create-release-gpgagent.log")
  231. GPGAGENTPID=$(echo "${GPG_AGENT_INFO}" | cut -f 2 -d:)
  232. fi
  233. if [[ -n "${GPG_AGENT_INFO}" ]]; then
  234. echo "Warming the gpg-agent cache prior to calling maven"
  235. # warm the agent's cache:
  236. touch "${LOGDIR}/warm"
  237. ${GPG} --use-agent --armor --output "${LOGDIR}/warm.asc" --detach-sig "${LOGDIR}/warm"
  238. rm "${LOGDIR}/warm.asc" "${LOGDIR}/warm"
  239. else
  240. SIGN=false
  241. hadoop_error "ERROR: Unable to launch or acquire gpg-agent. Disable signing."
  242. fi
  243. fi
  244. }
  245. function stopgpgagent
  246. {
  247. if [[ -n "${GPGAGENTPID}" ]]; then
  248. kill "${GPGAGENTPID}"
  249. fi
  250. }
  251. function usage
  252. {
  253. echo "--artifactsdir=[path] Path to use to store release bits"
  254. echo "--asfrelease Make an ASF release"
  255. echo "--docker Use Hadoop's Dockerfile for guaranteed environment"
  256. echo "--dockercache Use a Docker-private maven cache"
  257. echo "--jvmhint=[filter] Simple filter to pick a JVM to use"
  258. echo "--logdir=[path] Path to store logs"
  259. echo "--mvncache=[path] Path to the maven cache to use"
  260. echo "--native Also build the native components"
  261. echo "--rc-label=[label] Add this label to the builds"
  262. echo "--sign Use .gnupg dir to sign the artifacts and jars"
  263. echo "--version=[version] Use an alternative version string"
  264. }
  265. function option_parse
  266. {
  267. declare i
  268. for i in "$@"; do
  269. case ${i} in
  270. --asfrelease)
  271. ASFRELEASE=true
  272. NATIVE=true
  273. SIGN=true
  274. ;;
  275. --artifactsdir=*)
  276. ARTIFACTS_DIR=${i#*=}
  277. ;;
  278. --docker)
  279. DOCKER=true
  280. ;;
  281. --dockercache)
  282. DOCKERCACHE=true
  283. ;;
  284. --help)
  285. usage
  286. exit
  287. ;;
  288. --indocker)
  289. INDOCKER=true
  290. ;;
  291. --jvmhint=*)
  292. JVM_HINT=${i#*=}
  293. ;;
  294. --logdir=*)
  295. LOGDIR=${i#*=}
  296. ;;
  297. --mvncache=*)
  298. MVNCACHE=${i#*=}
  299. ;;
  300. --native)
  301. NATIVE=true
  302. ;;
  303. --rc-label=*)
  304. RC_LABEL=${i#*=}
  305. ;;
  306. --sign)
  307. SIGN=true
  308. ;;
  309. --version=*)
  310. HADOOP_VERSION=${i#*=}
  311. ;;
  312. esac
  313. done
  314. if [[ ! -d "${HOME}/.gnupg" ]]; then
  315. hadoop_error "ERROR: No .gnupg dir. Disabling signing capability."
  316. SIGN=false
  317. fi
  318. if [[ "${SIGN}" = true ]]; then
  319. if [[ -n "${GPG_AGENT_INFO}" ]]; then
  320. echo "NOTE: Using existing gpg-agent. If the default-cache-ttl"
  321. echo "is set to less than ~20 mins, maven commands will fail."
  322. elif [[ -z "${GPGAGENT}" ]]; then
  323. hadoop_error "ERROR: No gpg-agent. Disabling signing capability."
  324. SIGN=false
  325. fi
  326. fi
  327. DOCKERCMD=$(command -v docker)
  328. if [[ "${DOCKER}" = true && -z "${DOCKERCMD}" ]]; then
  329. hadoop_error "ERROR: docker binary not found. Disabling docker mode."
  330. DOCKER=false
  331. fi
  332. if [[ "${DOCKERCACHE}" = true && "${DOCKER}" = false ]]; then
  333. if [[ "${INDOCKER}" = false ]]; then
  334. hadoop_error "ERROR: docker mode not enabled. Disabling dockercache."
  335. fi
  336. DOCKERCACHE=false
  337. fi
  338. if [[ "${DOCKERCACHE}" = true && -n "${MVNCACHE}" ]]; then
  339. hadoop_error "ERROR: Cannot set --mvncache and --dockercache simultaneously."
  340. exit 1
  341. else
  342. MVNCACHE=${MVNCACHE:-"${HOME}/.m2"}
  343. fi
  344. if [[ "${ASFRELEASE}" = true ]]; then
  345. if [[ "${SIGN}" = false ]]; then
  346. hadoop_error "ERROR: --asfrelease requires --sign. Exiting."
  347. exit 1
  348. fi
  349. if [[ "${OSNAME}" = Linux ]]; then
  350. if [[ "${DOCKER}" = false && "${INDOCKER}" = false ]]; then
  351. hadoop_error "ERROR: --asfrelease requires --docker on Linux. Exiting."
  352. exit 1
  353. elif [[ "${DOCKERCACHE}" = false && "${INDOCKER}" = false ]]; then
  354. hadoop_error "ERROR: --asfrelease on Linux requires --dockercache. Exiting."
  355. exit 1
  356. fi
  357. fi
  358. fi
  359. if [[ -n "${MVNCACHE}" ]]; then
  360. mkdir -p "${MVNCACHE}"
  361. if [[ -d "${MVNCACHE}" ]]; then
  362. MVN_ARGS=("-Dmaven.repo.local=${MVNCACHE}")
  363. fi
  364. fi
  365. }
  366. function dockermode
  367. {
  368. declare lines
  369. declare -a modp
  370. declare imgname
  371. declare -a extrad
  372. declare user_name
  373. declare group_id
  374. if [[ "${DOCKER}" != true ]]; then
  375. return
  376. fi
  377. user_name=${SUDO_USER:=$USER}
  378. user_id=$(id -u "${user_name}")
  379. group_id=$(id -g "${user_name}")
  380. imgname="hadoop/createrelease:${HADOOP_VERSION}_${RANDOM}"
  381. if [[ -d "${HOME}/.gnupg" ]]; then
  382. extrad+=("-v" "${HOME}/.gnupg:/home/${user_name}/.gnupg")
  383. fi
  384. if [[ -n "${LOGDIR}" ]]; then
  385. if [[ ! -d "${LOGDIR}" ]]; then
  386. mkdir -p "${LOGDIR}"
  387. fi
  388. lines=$(hadoop_abs "${LOGDIR}")
  389. extrad+=("-v" "${lines}:${lines}")
  390. fi
  391. if [[ -n "${ARTIFACTS_DIR}" ]]; then
  392. if [[ ! -d "${ARTIFACTS_DIR}" ]]; then
  393. mkdir -p "${ARTIFACTS_DIR}"
  394. fi
  395. lines=$(hadoop_abs "${ARTIFACTS_DIR}")
  396. extrad+=("-v" "${lines}:${lines}")
  397. fi
  398. if [[ "${DOCKERCACHE}" = true ]]; then
  399. modp+=("--mvncache=/maven")
  400. else
  401. lines=$(hadoop_abs "${MVNCACHE}")
  402. extrad+=("-v" "${lines}:${lines}")
  403. fi
  404. for lines in "${PARAMS[@]}"; do
  405. if [[ "${lines}" != "--docker" ]]; then
  406. modp+=("$lines")
  407. fi
  408. done
  409. modp+=("--indocker")
  410. (
  411. lines=$(grep -n 'YETUS CUT HERE' "${DOCKERFILE}" | cut -f1 -d:)
  412. if [[ -z "${lines}" ]]; then
  413. cat "${DOCKERFILE}"
  414. else
  415. head -n "${lines}" "${DOCKERFILE}"
  416. fi
  417. # make sure we put some space between, just in case last
  418. # line isn't an empty line or whatever
  419. printf "\n\n"
  420. # force a new image for every run to make it easier to remove later
  421. echo "LABEL org.apache.hadoop.create-release=\"cr-${RANDOM}\""
  422. # setup ownerships, etc
  423. echo "RUN groupadd --non-unique -g ${group_id} ${user_name}"
  424. echo "RUN useradd -g ${group_id} -u ${user_id} -m ${user_name}"
  425. echo "RUN chown -R ${user_name} /home/${user_name}"
  426. echo "ENV HOME /home/${user_name}"
  427. echo "RUN mkdir -p /maven"
  428. echo "RUN chown -R ${user_name} /maven"
  429. echo "USER ${user_name}"
  430. printf "\n\n"
  431. ) | docker build -t "${imgname}" -
  432. run docker run -i -t \
  433. --privileged \
  434. "${extrad[@]}" \
  435. -v "${BASEDIR}:/build/source" \
  436. -u "${user_name}" \
  437. -w "/build/source" \
  438. "${imgname}" \
  439. "/build/source/dev-support/bin/create-release" "${modp[@]}"
  440. DOCKERRAN=true
  441. }
  442. function makearelease
  443. {
  444. # let's start at the root
  445. run cd "${BASEDIR}"
  446. big_console_header "Cleaning the Source Tree"
  447. # git clean to clear any remnants from previous build
  448. run "${GIT}" clean -xdf
  449. mkdir -p "${LOGDIR}"
  450. # Install the Hadoop maven plugins first
  451. run_and_redirect "${LOGDIR}/mvn_install_maven_plugins.log" "${MVN}" "${MVN_ARGS[@]}" -pl hadoop-maven-plugins -am clean install
  452. # mvn clean for sanity
  453. run_and_redirect "${LOGDIR}/mvn_clean.log" "${MVN}" "${MVN_ARGS[@]}" clean
  454. # Create staging dir for release artifacts
  455. run mkdir -p "${ARTIFACTS_DIR}"
  456. big_console_header "Apache RAT Check"
  457. # Create RAT report
  458. run_and_redirect "${LOGDIR}/mvn_apache_rat.log" "${MVN}" "${MVN_ARGS[@]}" apache-rat:check
  459. big_console_header "Maven Build and Install"
  460. if [[ "${SIGN}" = true ]]; then
  461. signflags=("-Psign" "-Dgpg.useagent=true" -Dgpg.executable="${GPG}")
  462. fi
  463. # Create SRC and BIN tarballs for release,
  464. # shellcheck disable=SC2046
  465. run_and_redirect "${LOGDIR}/mvn_install.log" \
  466. "${MVN}" "${MVN_ARGS[@]}" install \
  467. -Pdist,src,yarn-ui \
  468. "${signflags[@]}" \
  469. -DskipTests -Dtar $(hadoop_native_flags)
  470. # Create site for release
  471. # we need to do install again so that jdiff and
  472. # a few other things get registered in the maven
  473. # universe correctly
  474. run_and_redirect "${LOGDIR}/mvn_site.log" \
  475. "${MVN}" "${MVN_ARGS[@]}" install \
  476. site site:stage \
  477. -DskipTests \
  478. -Pdist,src,releasedocs,docs
  479. big_console_header "Staging the release"
  480. run mv "${BASEDIR}/target/staging/hadoop-project" "${BASEDIR}/target/r${HADOOP_VERSION}/"
  481. run cd "${BASEDIR}/target/"
  482. run tar czpf "hadoop-site-${HADOOP_VERSION}.tar.gz" "r${HADOOP_VERSION}"/*
  483. run cd "${BASEDIR}"
  484. # Stage RAT report
  485. #shellcheck disable=SC2038
  486. find . -name rat.txt | xargs -I% cat % > "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-rat.txt"
  487. # Stage CHANGES and RELEASENOTES files
  488. for i in CHANGES RELEASENOTES; do
  489. run cp -p \
  490. "${BASEDIR}/hadoop-common-project/hadoop-common/src/site/markdown/release/${HADOOP_VERSION}"/${i}*.md \
  491. "${ARTIFACTS_DIR}/${i}.md"
  492. done
  493. # Prepare and stage BIN tarball
  494. run cd "${BASEDIR}/hadoop-dist/target/"
  495. run tar -xzpf "hadoop-${HADOOP_VERSION}.tar.gz"
  496. run mkdir -p "hadoop-${HADOOP_VERSION}/share/doc/hadoop/"
  497. run cp -r "${BASEDIR}/target/r${HADOOP_VERSION}"/* "hadoop-${HADOOP_VERSION}/share/doc/hadoop/"
  498. run tar -czpf "hadoop-${HADOOP_VERSION}.tar.gz" "hadoop-${HADOOP_VERSION}"
  499. run cd "${BASEDIR}"
  500. run mv \
  501. "${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}.tar.gz" \
  502. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz"
  503. # Stage SRC tarball
  504. run mv \
  505. "${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}-src.tar.gz" \
  506. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-src.tar.gz"
  507. # Stage SITE tarball
  508. run mv \
  509. "${BASEDIR}/target/hadoop-site-${HADOOP_VERSION}.tar.gz" \
  510. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-site.tar.gz"
  511. }
  512. function signartifacts
  513. {
  514. declare i
  515. if [[ "${SIGN}" = false ]]; then
  516. for i in ${ARTIFACTS_DIR}/*; do
  517. domd5 "${i}"
  518. done
  519. echo ""
  520. echo "Remember to sign the artifacts before staging them on the open"
  521. echo ""
  522. return
  523. fi
  524. big_console_header "Signing the release"
  525. for i in ${ARTIFACTS_DIR}/*; do
  526. ${GPG} --use-agent --armor --output "${i}.asc" --detach-sig "${i}"
  527. ${GPG} --print-mds "${i}" > "${i}.mds"
  528. domd5 "${i}"
  529. done
  530. if [[ "${ASFRELEASE}" = true ]]; then
  531. echo "Fetching the Apache Hadoop KEYS file..."
  532. curl -L "${PUBKEYFILE}" -o "${BASEDIR}/target/KEYS"
  533. ${GPG} --import --trustdb "${BASEDIR}/target/testkeysdb" "${BASEDIR}/target/KEYS"
  534. ${GPG} --verify --trustdb "${BASEDIR}/target/testkeysdb" \
  535. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz.asc" \
  536. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz"
  537. if [[ $? != 0 ]]; then
  538. hadoop_error "ERROR: GPG key is not present in ${PUBKEYFILE}."
  539. hadoop_error "ERROR: This MUST be fixed. Exiting."
  540. exit 1
  541. fi
  542. fi
  543. }
  544. # find root of the source tree
  545. BIN=$(hadoop_abs "${BASH_SOURCE:-$0}")
  546. PARAMS=("$@")
  547. set_defaults
  548. option_parse "${PARAMS[@]}"
  549. dockermode
  550. locate_jvm
  551. header
  552. if [[ -n ${RC_LABEL} ]]; then
  553. RC_LABEL="-${RC_LABEL}"
  554. fi
  555. if [[ "${INDOCKER}" = true || "${DOCKERRAN}" = false ]]; then
  556. startgpgagent
  557. makearelease
  558. signartifacts
  559. stopgpgagent
  560. fi
  561. if [[ "${INDOCKER}" = true ]]; then
  562. exit $?
  563. fi
  564. if [[ $? == 0 ]]; then
  565. echo
  566. echo "Congratulations, you have successfully built the release"
  567. echo "artifacts for Apache Hadoop ${HADOOP_VERSION}${RC_LABEL}"
  568. echo
  569. echo "The artifacts for this run are available at ${ARTIFACTS_DIR}:"
  570. run ls -1 "${ARTIFACTS_DIR}"
  571. echo
  572. fi