create-release 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  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 36000" > "${LOGDIR}/gpgagent.conf"
  227. echo "max-cache-ttl 36000" >> "${LOGDIR}/gpgagent.conf"
  228. # shellcheck disable=2046
  229. eval $("${GPGAGENT}" --daemon \
  230. --options "${LOGDIR}/gpgagent.conf" \
  231. --log-file="${LOGDIR}/create-release-gpgagent.log")
  232. GPGAGENTPID=$(echo "${GPG_AGENT_INFO}" | cut -f 2 -d:)
  233. fi
  234. if [[ -n "${GPG_AGENT_INFO}" ]]; then
  235. echo "Warming the gpg-agent cache prior to calling maven"
  236. # warm the agent's cache:
  237. touch "${LOGDIR}/warm"
  238. ${GPG} --use-agent --armor --output "${LOGDIR}/warm.asc" --detach-sig "${LOGDIR}/warm"
  239. rm "${LOGDIR}/warm.asc" "${LOGDIR}/warm"
  240. else
  241. SIGN=false
  242. hadoop_error "ERROR: Unable to launch or acquire gpg-agent. Disable signing."
  243. fi
  244. fi
  245. }
  246. function stopgpgagent
  247. {
  248. if [[ -n "${GPGAGENTPID}" ]]; then
  249. kill "${GPGAGENTPID}"
  250. fi
  251. }
  252. function usage
  253. {
  254. echo "--artifactsdir=[path] Path to use to store release bits"
  255. echo "--asfrelease Make an ASF release"
  256. echo "--docker Use Hadoop's Dockerfile for guaranteed environment"
  257. echo "--dockercache Use a Docker-private maven cache"
  258. echo "--jvmhint=[filter] Simple filter to pick a JVM to use"
  259. echo "--logdir=[path] Path to store logs"
  260. echo "--mvncache=[path] Path to the maven cache to use"
  261. echo "--native Also build the native components"
  262. echo "--rc-label=[label] Add this label to the builds"
  263. echo "--sign Use .gnupg dir to sign the artifacts and jars"
  264. echo "--version=[version] Use an alternative version string"
  265. }
  266. function option_parse
  267. {
  268. declare i
  269. for i in "$@"; do
  270. case ${i} in
  271. --asfrelease)
  272. ASFRELEASE=true
  273. NATIVE=true
  274. SIGN=true
  275. ;;
  276. --artifactsdir=*)
  277. ARTIFACTS_DIR=${i#*=}
  278. ;;
  279. --docker)
  280. DOCKER=true
  281. ;;
  282. --dockercache)
  283. DOCKERCACHE=true
  284. ;;
  285. --help)
  286. usage
  287. exit
  288. ;;
  289. --indocker)
  290. INDOCKER=true
  291. ;;
  292. --jvmhint=*)
  293. JVM_HINT=${i#*=}
  294. ;;
  295. --logdir=*)
  296. LOGDIR=${i#*=}
  297. ;;
  298. --mvncache=*)
  299. MVNCACHE=${i#*=}
  300. ;;
  301. --native)
  302. NATIVE=true
  303. ;;
  304. --rc-label=*)
  305. RC_LABEL=${i#*=}
  306. ;;
  307. --sign)
  308. SIGN=true
  309. ;;
  310. --version=*)
  311. HADOOP_VERSION=${i#*=}
  312. ;;
  313. esac
  314. done
  315. if [[ ! -d "${HOME}/.gnupg" ]]; then
  316. hadoop_error "ERROR: No .gnupg dir. Disabling signing capability."
  317. SIGN=false
  318. fi
  319. if [[ "${SIGN}" = true ]]; then
  320. if [[ -n "${GPG_AGENT_INFO}" ]]; then
  321. echo "NOTE: Using existing gpg-agent. If the default-cache-ttl"
  322. echo "is set to less than ~20 mins, maven commands will fail."
  323. elif [[ -z "${GPGAGENT}" ]]; then
  324. hadoop_error "ERROR: No gpg-agent. Disabling signing capability."
  325. SIGN=false
  326. fi
  327. fi
  328. DOCKERCMD=$(command -v docker)
  329. if [[ "${DOCKER}" = true && -z "${DOCKERCMD}" ]]; then
  330. hadoop_error "ERROR: docker binary not found. Disabling docker mode."
  331. DOCKER=false
  332. fi
  333. if [[ "${DOCKERCACHE}" = true && "${DOCKER}" = false ]]; then
  334. if [[ "${INDOCKER}" = false ]]; then
  335. hadoop_error "ERROR: docker mode not enabled. Disabling dockercache."
  336. fi
  337. DOCKERCACHE=false
  338. fi
  339. if [[ "${DOCKERCACHE}" = true && -n "${MVNCACHE}" ]]; then
  340. hadoop_error "ERROR: Cannot set --mvncache and --dockercache simultaneously."
  341. exit 1
  342. else
  343. MVNCACHE=${MVNCACHE:-"${HOME}/.m2"}
  344. fi
  345. if [[ "${ASFRELEASE}" = true ]]; then
  346. if [[ "${SIGN}" = false ]]; then
  347. hadoop_error "ERROR: --asfrelease requires --sign. Exiting."
  348. exit 1
  349. fi
  350. if [[ "${OSNAME}" = Linux ]]; then
  351. if [[ "${DOCKER}" = false && "${INDOCKER}" = false ]]; then
  352. hadoop_error "ERROR: --asfrelease requires --docker on Linux. Exiting."
  353. exit 1
  354. elif [[ "${DOCKERCACHE}" = false && "${INDOCKER}" = false ]]; then
  355. hadoop_error "ERROR: --asfrelease on Linux requires --dockercache. Exiting."
  356. exit 1
  357. fi
  358. fi
  359. fi
  360. if [[ -n "${MVNCACHE}" ]]; then
  361. mkdir -p "${MVNCACHE}"
  362. if [[ -d "${MVNCACHE}" ]]; then
  363. MVN_ARGS=("-Dmaven.repo.local=${MVNCACHE}")
  364. fi
  365. fi
  366. }
  367. function dockermode
  368. {
  369. declare lines
  370. declare -a modp
  371. declare imgname
  372. declare -a extrad
  373. declare user_name
  374. declare group_id
  375. if [[ "${DOCKER}" != true ]]; then
  376. return
  377. fi
  378. user_name=${SUDO_USER:=$USER}
  379. user_id=$(id -u "${user_name}")
  380. group_id=$(id -g "${user_name}")
  381. imgname="hadoop/createrelease:${HADOOP_VERSION}_${RANDOM}"
  382. if [[ -d "${HOME}/.gnupg" ]]; then
  383. extrad+=("-v" "${HOME}/.gnupg:/home/${user_name}/.gnupg")
  384. fi
  385. if [[ -n "${LOGDIR}" ]]; then
  386. if [[ ! -d "${LOGDIR}" ]]; then
  387. mkdir -p "${LOGDIR}"
  388. fi
  389. lines=$(hadoop_abs "${LOGDIR}")
  390. extrad+=("-v" "${lines}:${lines}")
  391. fi
  392. if [[ -n "${ARTIFACTS_DIR}" ]]; then
  393. if [[ ! -d "${ARTIFACTS_DIR}" ]]; then
  394. mkdir -p "${ARTIFACTS_DIR}"
  395. fi
  396. lines=$(hadoop_abs "${ARTIFACTS_DIR}")
  397. extrad+=("-v" "${lines}:${lines}")
  398. fi
  399. if [[ "${DOCKERCACHE}" = true ]]; then
  400. modp+=("--mvncache=/maven")
  401. else
  402. lines=$(hadoop_abs "${MVNCACHE}")
  403. extrad+=("-v" "${lines}:${lines}")
  404. fi
  405. for lines in "${PARAMS[@]}"; do
  406. if [[ "${lines}" != "--docker" ]]; then
  407. modp+=("$lines")
  408. fi
  409. done
  410. modp+=("--indocker")
  411. (
  412. lines=$(grep -n 'YETUS CUT HERE' "${DOCKERFILE}" | cut -f1 -d:)
  413. if [[ -z "${lines}" ]]; then
  414. cat "${DOCKERFILE}"
  415. else
  416. head -n "${lines}" "${DOCKERFILE}"
  417. fi
  418. # make sure we put some space between, just in case last
  419. # line isn't an empty line or whatever
  420. printf "\n\n"
  421. # force a new image for every run to make it easier to remove later
  422. echo "LABEL org.apache.hadoop.create-release=\"cr-${RANDOM}\""
  423. # setup ownerships, etc
  424. echo "RUN groupadd --non-unique -g ${group_id} ${user_name}"
  425. echo "RUN useradd -g ${group_id} -u ${user_id} -m ${user_name}"
  426. echo "RUN chown -R ${user_name} /home/${user_name}"
  427. echo "ENV HOME /home/${user_name}"
  428. echo "RUN mkdir -p /maven"
  429. echo "RUN chown -R ${user_name} /maven"
  430. echo "USER ${user_name}"
  431. printf "\n\n"
  432. ) | docker build -t "${imgname}" -
  433. run docker run -i -t \
  434. --privileged \
  435. "${extrad[@]}" \
  436. -v "${BASEDIR}:/build/source" \
  437. -u "${user_name}" \
  438. -w "/build/source" \
  439. "${imgname}" \
  440. "/build/source/dev-support/bin/create-release" "${modp[@]}"
  441. DOCKERRAN=true
  442. }
  443. function makearelease
  444. {
  445. # let's start at the root
  446. run cd "${BASEDIR}"
  447. big_console_header "Cleaning the Source Tree"
  448. # git clean to clear any remnants from previous build
  449. run "${GIT}" clean -xdf
  450. mkdir -p "${LOGDIR}"
  451. # Install the Hadoop maven plugins first
  452. run_and_redirect "${LOGDIR}/mvn_install_maven_plugins.log" "${MVN}" "${MVN_ARGS[@]}" -pl hadoop-maven-plugins -am clean install
  453. # mvn clean for sanity
  454. run_and_redirect "${LOGDIR}/mvn_clean.log" "${MVN}" "${MVN_ARGS[@]}" clean
  455. # Create staging dir for release artifacts
  456. run mkdir -p "${ARTIFACTS_DIR}"
  457. big_console_header "Apache RAT Check"
  458. # Create RAT report
  459. run_and_redirect "${LOGDIR}/mvn_apache_rat.log" "${MVN}" "${MVN_ARGS[@]}" apache-rat:check
  460. big_console_header "Maven Build and Install"
  461. if [[ "${SIGN}" = true ]]; then
  462. signflags=("-Psign" "-Dgpg.useagent=true" -Dgpg.executable="${GPG}")
  463. fi
  464. # Create SRC and BIN tarballs for release,
  465. # shellcheck disable=SC2046
  466. run_and_redirect "${LOGDIR}/mvn_install.log" \
  467. "${MVN}" "${MVN_ARGS[@]}" install \
  468. -Pdist,src,yarn-ui \
  469. "${signflags[@]}" \
  470. -DskipTests -Dtar $(hadoop_native_flags)
  471. # Create site for release
  472. # we need to do install again so that jdiff and
  473. # a few other things get registered in the maven
  474. # universe correctly
  475. run_and_redirect "${LOGDIR}/mvn_site.log" \
  476. "${MVN}" "${MVN_ARGS[@]}" install \
  477. site site:stage \
  478. -DskipTests \
  479. -Pdist,src,releasedocs,docs
  480. big_console_header "Staging the release"
  481. run mv "${BASEDIR}/target/staging/hadoop-project" "${BASEDIR}/target/r${HADOOP_VERSION}/"
  482. run cd "${BASEDIR}/target/"
  483. run tar czpf "hadoop-site-${HADOOP_VERSION}.tar.gz" "r${HADOOP_VERSION}"/*
  484. run cd "${BASEDIR}"
  485. # Stage RAT report
  486. #shellcheck disable=SC2038
  487. find . -name rat.txt | xargs -I% cat % > "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-rat.txt"
  488. # Stage CHANGES and RELEASENOTES files
  489. for i in CHANGES RELEASENOTES; do
  490. run cp -p \
  491. "${BASEDIR}/hadoop-common-project/hadoop-common/src/site/markdown/release/${HADOOP_VERSION}"/${i}*.md \
  492. "${ARTIFACTS_DIR}/${i}.md"
  493. done
  494. # Prepare and stage BIN tarball
  495. run cd "${BASEDIR}/hadoop-dist/target/"
  496. run tar -xzpf "hadoop-${HADOOP_VERSION}.tar.gz"
  497. run mkdir -p "hadoop-${HADOOP_VERSION}/share/doc/hadoop/"
  498. run cp -r "${BASEDIR}/target/r${HADOOP_VERSION}"/* "hadoop-${HADOOP_VERSION}/share/doc/hadoop/"
  499. run tar -czpf "hadoop-${HADOOP_VERSION}.tar.gz" "hadoop-${HADOOP_VERSION}"
  500. run cd "${BASEDIR}"
  501. run mv \
  502. "${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}.tar.gz" \
  503. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz"
  504. # Stage SRC tarball
  505. run mv \
  506. "${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}-src.tar.gz" \
  507. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-src.tar.gz"
  508. # Stage SITE tarball
  509. run mv \
  510. "${BASEDIR}/target/hadoop-site-${HADOOP_VERSION}.tar.gz" \
  511. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-site.tar.gz"
  512. }
  513. function signartifacts
  514. {
  515. declare i
  516. if [[ "${SIGN}" = false ]]; then
  517. for i in ${ARTIFACTS_DIR}/*; do
  518. domd5 "${i}"
  519. done
  520. echo ""
  521. echo "Remember to sign the artifacts before staging them on the open"
  522. echo ""
  523. return
  524. fi
  525. big_console_header "Signing the release"
  526. for i in ${ARTIFACTS_DIR}/*; do
  527. ${GPG} --use-agent --armor --output "${i}.asc" --detach-sig "${i}"
  528. ${GPG} --print-mds "${i}" > "${i}.mds"
  529. domd5 "${i}"
  530. done
  531. if [[ "${ASFRELEASE}" = true ]]; then
  532. echo "Fetching the Apache Hadoop KEYS file..."
  533. curl -L "${PUBKEYFILE}" -o "${BASEDIR}/target/KEYS"
  534. ${GPG} --import --trustdb "${BASEDIR}/target/testkeysdb" "${BASEDIR}/target/KEYS"
  535. ${GPG} --verify --trustdb "${BASEDIR}/target/testkeysdb" \
  536. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz.asc" \
  537. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz"
  538. if [[ $? != 0 ]]; then
  539. hadoop_error "ERROR: GPG key is not present in ${PUBKEYFILE}."
  540. hadoop_error "ERROR: This MUST be fixed. Exiting."
  541. exit 1
  542. fi
  543. fi
  544. }
  545. # find root of the source tree
  546. BIN=$(hadoop_abs "${BASH_SOURCE:-$0}")
  547. PARAMS=("$@")
  548. set_defaults
  549. option_parse "${PARAMS[@]}"
  550. dockermode
  551. locate_jvm
  552. header
  553. if [[ -n ${RC_LABEL} ]]; then
  554. RC_LABEL="-${RC_LABEL}"
  555. fi
  556. if [[ "${INDOCKER}" = true || "${DOCKERRAN}" = false ]]; then
  557. startgpgagent
  558. makearelease
  559. signartifacts
  560. stopgpgagent
  561. fi
  562. if [[ "${INDOCKER}" = true ]]; then
  563. exit $?
  564. fi
  565. if [[ $? == 0 ]]; then
  566. echo
  567. echo "Congratulations, you have successfully built the release"
  568. echo "artifacts for Apache Hadoop ${HADOOP_VERSION}${RC_LABEL}"
  569. echo
  570. echo "The artifacts for this run are available at ${ARTIFACTS_DIR}:"
  571. run ls -1 "${ARTIFACTS_DIR}"
  572. echo
  573. fi