create-release 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  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. declare ret
  50. if [[ ! -e ${obj} ]]; then
  51. return 1
  52. elif [[ -d ${obj} ]]; then
  53. dir=${obj}
  54. else
  55. dir=$(dirname -- "${obj}")
  56. fn=$(basename -- "${obj}")
  57. fn="/${fn}"
  58. fi
  59. dir=$(cd -P -- "${dir}" >/dev/null 2>/dev/null && pwd -P)
  60. ret=$?
  61. if [[ ${ret} = 0 ]]; then
  62. echo "${dir}${fn}"
  63. return 0
  64. fi
  65. return 1
  66. }
  67. ## @description Print a message to stderr
  68. ## @audience public
  69. ## @stability stable
  70. ## @replaceable no
  71. ## @param string
  72. function hadoop_error
  73. {
  74. echo "$*" 1>&2
  75. }
  76. function run_and_redirect
  77. {
  78. declare logfile=$1
  79. shift
  80. declare res
  81. echo "\$ ${*} > ${logfile} 2>&1"
  82. # to the log
  83. {
  84. date
  85. echo "cd $(pwd)"
  86. echo "${*}"
  87. } > "${logfile}"
  88. # run the actual command
  89. "${@}" >> "${logfile}" 2>&1
  90. res=$?
  91. if [[ ${res} != 0 ]]; then
  92. echo
  93. echo "Failed!"
  94. echo
  95. exit "${res}"
  96. fi
  97. }
  98. function hadoop_native_flags
  99. {
  100. # modified version of the Yetus personality
  101. if [[ ${NATIVE} != true ]]; then
  102. return
  103. fi
  104. # Based upon HADOOP-11937
  105. #
  106. # Some notes:
  107. #
  108. # - getting fuse to compile on anything but Linux
  109. # is always tricky.
  110. # - Darwin assumes homebrew is in use.
  111. # - HADOOP-12027 required for bzip2 on OS X.
  112. # - bzip2 is broken in lots of places.
  113. # e.g, HADOOP-12027 for OS X. so no -Drequire.bzip2
  114. #
  115. case "${OSNAME}" in
  116. Linux)
  117. # shellcheck disable=SC2086
  118. echo -Pnative -Drequire.snappy -Drequire.openssl -Drequire.fuse
  119. ;;
  120. Darwin)
  121. echo \
  122. -Pnative -Drequire.snappy \
  123. -Drequire.openssl \
  124. -Dopenssl.prefix=/usr/local/opt/openssl/ \
  125. -Dopenssl.include=/usr/local/opt/openssl/include \
  126. -Dopenssl.lib=/usr/local/opt/openssl/lib
  127. ;;
  128. *)
  129. # shellcheck disable=SC2086
  130. echo \
  131. -Pnative \
  132. -Drequire.snappy -Drequire.openssl \
  133. -Drequire.test.libhadoop
  134. ;;
  135. esac
  136. }
  137. # Function to probe the exit code of the script commands,
  138. # and stop in the case of failure with an contextual error
  139. # message.
  140. function run()
  141. {
  142. declare res
  143. declare logfile
  144. echo "\$ ${*}"
  145. "${@}"
  146. res=$?
  147. if [[ ${res} != 0 ]]; then
  148. echo
  149. echo "Failed!"
  150. echo
  151. exit "${res}"
  152. fi
  153. }
  154. function domd5()
  155. {
  156. run "${MD5SUM}" "${1}" > "${1}.md5"
  157. }
  158. function header()
  159. {
  160. echo
  161. printf "\n\n"
  162. echo "============================================================================"
  163. echo "============================================================================"
  164. centered_text "Hadoop Release Creator"
  165. echo "============================================================================"
  166. echo "============================================================================"
  167. printf "\n\n"
  168. echo "Version to create : ${HADOOP_VERSION}"
  169. echo "Release Candidate Label: ${RC_LABEL##-}"
  170. echo "Source Version : ${DEFAULT_HADOOP_VERSION}"
  171. printf "\n\n"
  172. }
  173. function set_defaults
  174. {
  175. BINDIR=$(dirname "${BIN}")
  176. BASEDIR=$(hadoop_abs "${BINDIR}/../..")
  177. ARTIFACTS_DIR="${BASEDIR}/target/artifacts"
  178. # Extract Hadoop version from ${BASEDIR}/pom.xml
  179. DEFAULT_HADOOP_VERSION=$(grep "<version>" "${BASEDIR}/pom.xml" \
  180. | head -1 \
  181. | sed -e 's|^ *<version>||' -e 's|</version>.*$||')
  182. DOCKER=false
  183. DOCKERCACHE=false
  184. DOCKERFILE="${BASEDIR}/dev-support/docker/Dockerfile"
  185. DOCKERRAN=false
  186. # Extract Java version from ${BASEDIR}/pom.xml
  187. # doing this outside of maven means we can do this before
  188. # the docker container comes up...
  189. JVM_VERSION=$(grep "<javac.version>" "${BASEDIR}/hadoop-project/pom.xml" \
  190. | head -1 \
  191. | sed -e 's|^ *<javac.version>||' -e 's|</javac.version>.*$||' -e 's|..||')
  192. GIT=$(command -v git)
  193. GPG=$(command -v gpg)
  194. GPGAGENT=$(command -v gpg-agent)
  195. HADOOP_VERSION="${DEFAULT_HADOOP_VERSION}"
  196. INDOCKER=false
  197. LOGDIR="${BASEDIR}/patchprocess"
  198. if [[ -z "${MVN}" ]]; then
  199. if [[ -n "${MAVEN_HOME}" ]]; then
  200. MVN=${MAVEN_HOME}/bin/mvn
  201. else
  202. MVN=$(command -v mvn)
  203. fi
  204. fi
  205. MD5SUM=$(command -v md5sum)
  206. if [[ -z "${MD5SUM}" ]]; then
  207. MD5SUM=$(command -v md5)
  208. fi
  209. NATIVE=false
  210. OSNAME=$(uname -s)
  211. PUBKEYFILE="https://dist.apache.org/repos/dist/release/hadoop/common/KEYS"
  212. SIGN=false
  213. }
  214. function startgpgagent
  215. {
  216. if [[ "${SIGN}" = true ]]; then
  217. if [[ -n "${GPGAGENT}" && -z "${GPG_AGENT_INFO}" ]]; then
  218. echo "starting gpg agent"
  219. echo "default-cache-ttl 14400" > "${LOGDIR}/gpgagent.conf"
  220. # shellcheck disable=2046
  221. eval $("${GPGAGENT}" --daemon \
  222. --options "${LOGDIR}/gpgagent.conf" \
  223. --log-file="${LOGDIR}/create-release-gpgagent.log")
  224. GPGAGENTPID=$(echo "${GPG_AGENT_INFO}" | cut -f 2 -d:)
  225. fi
  226. if [[ -n "${GPG_AGENT_INFO}" ]]; then
  227. echo "Warming the gpg-agent cache prior to calling maven"
  228. # warm the agent's cache:
  229. touch "${LOGDIR}/warm"
  230. ${GPG} --use-agent --armor --output "${LOGDIR}/warm.asc" --detach-sig "${LOGDIR}/warm"
  231. rm "${LOGDIR}/warm.asc" "${LOGDIR}/warm"
  232. else
  233. SIGN=false
  234. hadoop_error "ERROR: Unable to launch or acquire gpg-agent. Disable signing."
  235. fi
  236. fi
  237. }
  238. function stopgpgagent
  239. {
  240. if [[ -n "${GPGAGENTPID}" ]]; then
  241. kill "${GPGAGENTPID}"
  242. fi
  243. }
  244. function usage
  245. {
  246. echo "--artifactsdir=[path] Path to use to store release bits"
  247. echo "--asfrelease Make an ASF release"
  248. echo "--docker Use Hadoop's Dockerfile for guaranteed environment"
  249. echo "--dockercache Use a Docker-private maven cache"
  250. echo "--logdir=[path] Path to store logs"
  251. echo "--mvncache=[path] Path to the maven cache to use"
  252. echo "--native Also build the native components"
  253. echo "--rc-label=[label] Add this label to the builds"
  254. echo "--security Emergency security release"
  255. echo "--sign Use .gnupg dir to sign the artifacts and jars"
  256. echo "--version=[version] Use an alternative version string"
  257. }
  258. function option_parse
  259. {
  260. declare i
  261. for i in "$@"; do
  262. case ${i} in
  263. --asfrelease)
  264. ASFRELEASE=true
  265. NATIVE=true
  266. SIGN=true
  267. ;;
  268. --artifactsdir=*)
  269. ARTIFACTS_DIR=${i#*=}
  270. ;;
  271. --docker)
  272. DOCKER=true
  273. ;;
  274. --dockercache)
  275. DOCKERCACHE=true
  276. ;;
  277. --help)
  278. usage
  279. exit
  280. ;;
  281. --indocker)
  282. INDOCKER=true
  283. ;;
  284. --logdir=*)
  285. LOGDIR=${i#*=}
  286. ;;
  287. --mvncache=*)
  288. MVNCACHE=${i#*=}
  289. ;;
  290. --native)
  291. NATIVE=true
  292. ;;
  293. --rc-label=*)
  294. RC_LABEL=${i#*=}
  295. ;;
  296. --security)
  297. SECURITYRELEASE=true
  298. ;;
  299. --sign)
  300. SIGN=true
  301. ;;
  302. --version=*)
  303. HADOOP_VERSION=${i#*=}
  304. ;;
  305. esac
  306. done
  307. if [[ ! -d "${HOME}/.gnupg" ]]; then
  308. hadoop_error "ERROR: No .gnupg dir. Disabling signing capability."
  309. SIGN=false
  310. fi
  311. if [[ "${SIGN}" = true ]]; then
  312. if [[ -n "${GPG_AGENT_INFO}" ]]; then
  313. echo "NOTE: Using existing gpg-agent. If the default-cache-ttl"
  314. echo "is set to less than ~20 mins, maven commands will fail."
  315. elif [[ -z "${GPGAGENT}" ]]; then
  316. hadoop_error "ERROR: No gpg-agent. Disabling signing capability."
  317. SIGN=false
  318. fi
  319. fi
  320. DOCKERCMD=$(command -v docker)
  321. if [[ "${DOCKER}" = true && -z "${DOCKERCMD}" ]]; then
  322. hadoop_error "ERROR: docker binary not found. Disabling docker mode."
  323. DOCKER=false
  324. fi
  325. if [[ "${DOCKERCACHE}" = true && "${DOCKER}" = false ]]; then
  326. if [[ "${INDOCKER}" = false ]]; then
  327. hadoop_error "ERROR: docker mode not enabled. Disabling dockercache."
  328. fi
  329. DOCKERCACHE=false
  330. fi
  331. if [[ "${DOCKERCACHE}" = true && -n "${MVNCACHE}" ]]; then
  332. hadoop_error "ERROR: Cannot set --mvncache and --dockercache simultaneously."
  333. exit 1
  334. else
  335. MVNCACHE=${MVNCACHE:-"${HOME}/.m2"}
  336. fi
  337. if [[ "${ASFRELEASE}" = true ]]; then
  338. if [[ "${SIGN}" = false ]]; then
  339. hadoop_error "ERROR: --asfrelease requires --sign. Exiting."
  340. exit 1
  341. fi
  342. if [[ "${OSNAME}" = Linux ]]; then
  343. if [[ "${DOCKER}" = false && "${INDOCKER}" = false ]]; then
  344. hadoop_error "ERROR: --asfrelease requires --docker on Linux. Exiting."
  345. exit 1
  346. elif [[ "${DOCKERCACHE}" = false && "${INDOCKER}" = false ]]; then
  347. hadoop_error "ERROR: --asfrelease on Linux requires --dockercache. Exiting."
  348. exit 1
  349. fi
  350. fi
  351. fi
  352. if [[ -n "${MVNCACHE}" ]]; then
  353. mkdir -p "${MVNCACHE}"
  354. if [[ -d "${MVNCACHE}" ]]; then
  355. MVN_ARGS=("-Dmaven.repo.local=${MVNCACHE}")
  356. fi
  357. fi
  358. if [[ "${SECURITYRELEASE}" = true ]]; then
  359. if [[ ! -d "${BASEDIR}/hadoop-common-project/hadoop-common/src/site/markdown/release/${HADOOP_VERSION}" ]]; then
  360. hadoop_error "ERROR: ${BASEDIR}/hadoop-common-project/hadoop-common/src/site/markdown/release/${HADOOP_VERSION} does not exist."
  361. hadoop_error "ERROR: This directory and its contents are required to be manually created for a security release."
  362. exit 1
  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. # we always force build with the Oracle JDK
  430. # but with the correct version
  431. echo "ENV JAVA_HOME /usr/lib/jvm/java-${JVM_VERSION}-oracle"
  432. echo "USER ${user_name}"
  433. printf "\n\n"
  434. ) | docker build -t "${imgname}" -
  435. run docker run -i -t \
  436. --privileged \
  437. "${extrad[@]}" \
  438. -v "${BASEDIR}:/build/source" \
  439. -u "${user_name}" \
  440. -w "/build/source" \
  441. "${imgname}" \
  442. "/build/source/dev-support/bin/create-release" "${modp[@]}"
  443. DOCKERRAN=true
  444. }
  445. function makearelease
  446. {
  447. # let's start at the root
  448. run cd "${BASEDIR}"
  449. big_console_header "Cleaning the Source Tree"
  450. # git clean to clear any remnants from previous build
  451. run "${GIT}" clean -xdf
  452. mkdir -p "${LOGDIR}"
  453. # Install the Hadoop maven plugins first
  454. run_and_redirect "${LOGDIR}/mvn_install_maven_plugins.log" "${MVN}" "${MVN_ARGS[@]}" -pl hadoop-maven-plugins -am clean install
  455. # mvn clean for sanity
  456. run_and_redirect "${LOGDIR}/mvn_clean.log" "${MVN}" "${MVN_ARGS[@]}" clean
  457. # Create staging dir for release artifacts
  458. run mkdir -p "${ARTIFACTS_DIR}"
  459. big_console_header "Apache RAT Check"
  460. # Create RAT report
  461. run_and_redirect "${LOGDIR}/mvn_apache_rat.log" "${MVN}" "${MVN_ARGS[@]}" apache-rat:check
  462. big_console_header "Maven Build and Install"
  463. if [[ "${SIGN}" = true ]]; then
  464. signflags=("-Psign" "-Dgpg.useagent=true" "-Dgpg.executable=${GPG}")
  465. fi
  466. # Create SRC and BIN tarballs for release,
  467. # shellcheck disable=SC2046
  468. run_and_redirect "${LOGDIR}/mvn_install.log" \
  469. "${MVN}" "${MVN_ARGS[@]}" install \
  470. -Pdist,src,yarn-ui \
  471. "${signflags[@]}" \
  472. -DskipTests -Dtar $(hadoop_native_flags)
  473. if [[ "${SECURITYRELEASE}" = true ]]; then
  474. DOCFLAGS="-Pdocs"
  475. hadoop_error "WARNING: Skipping automatic changelog and release notes generation due to --security"
  476. else
  477. DOCFLAGS="-Preleasedocs,docs"
  478. fi
  479. # Create site for release
  480. # we need to do install again so that jdiff and
  481. # a few other things get registered in the maven
  482. # universe correctly
  483. run_and_redirect "${LOGDIR}/mvn_site.log" \
  484. "${MVN}" "${MVN_ARGS[@]}" install \
  485. site site:stage \
  486. -DskipTests \
  487. -Pdist,src \
  488. "${DOCFLAGS}"
  489. big_console_header "Staging the release"
  490. run mv "${BASEDIR}/target/staging/hadoop-project" "${BASEDIR}/target/r${HADOOP_VERSION}/"
  491. run cd "${BASEDIR}/target/"
  492. run tar czpf "hadoop-site-${HADOOP_VERSION}.tar.gz" "r${HADOOP_VERSION}"/*
  493. run cd "${BASEDIR}"
  494. # Stage RAT report
  495. #shellcheck disable=SC2038
  496. find . -name rat.txt | xargs -I% cat % > "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-rat.txt"
  497. # Stage CHANGES and RELEASENOTES files
  498. for i in CHANGES RELEASENOTES; do
  499. run cp -p \
  500. "${BASEDIR}/hadoop-common-project/hadoop-common/src/site/markdown/release/${HADOOP_VERSION}"/${i}*.md \
  501. "${ARTIFACTS_DIR}/${i}.md"
  502. done
  503. # Prepare and stage BIN tarball
  504. run cd "${BASEDIR}/hadoop-dist/target/"
  505. run tar -xzpf "hadoop-${HADOOP_VERSION}.tar.gz"
  506. run cp -r "${BASEDIR}/target/r${HADOOP_VERSION}"/* "hadoop-${HADOOP_VERSION}/share/doc/hadoop/"
  507. run tar -czpf "hadoop-${HADOOP_VERSION}.tar.gz" "hadoop-${HADOOP_VERSION}"
  508. run cd "${BASEDIR}"
  509. run mv \
  510. "${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}.tar.gz" \
  511. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz"
  512. # Stage SRC tarball
  513. run mv \
  514. "${BASEDIR}/hadoop-dist/target/hadoop-${HADOOP_VERSION}-src.tar.gz" \
  515. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-src.tar.gz"
  516. # Stage SITE tarball
  517. run mv \
  518. "${BASEDIR}/target/hadoop-site-${HADOOP_VERSION}.tar.gz" \
  519. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}-site.tar.gz"
  520. }
  521. function signartifacts
  522. {
  523. declare i
  524. declare ret
  525. if [[ "${SIGN}" = false ]]; then
  526. for i in ${ARTIFACTS_DIR}/*; do
  527. domd5 "${i}"
  528. done
  529. echo ""
  530. echo "Remember to sign the artifacts before staging them on the open"
  531. echo ""
  532. return
  533. fi
  534. big_console_header "Signing the release"
  535. for i in ${ARTIFACTS_DIR}/*; do
  536. ${GPG} --use-agent --armor --output "${i}.asc" --detach-sig "${i}"
  537. ${GPG} --print-mds "${i}" > "${i}.mds"
  538. domd5 "${i}"
  539. done
  540. if [[ "${ASFRELEASE}" = true ]]; then
  541. echo "Fetching the Apache Hadoop KEYS file..."
  542. curl -L "${PUBKEYFILE}" -o "${BASEDIR}/target/KEYS"
  543. ${GPG} --import --trustdb "${BASEDIR}/target/testkeysdb" "${BASEDIR}/target/KEYS"
  544. ${GPG} --verify --trustdb "${BASEDIR}/target/testkeysdb" \
  545. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz.asc" \
  546. "${ARTIFACTS_DIR}/hadoop-${HADOOP_VERSION}${RC_LABEL}.tar.gz"
  547. ret=$?
  548. if [[ ${ret} != 0 ]]; then
  549. hadoop_error "ERROR: GPG key is not present in ${PUBKEYFILE}."
  550. hadoop_error "ERROR: This MUST be fixed. Exiting."
  551. exit 1
  552. fi
  553. fi
  554. }
  555. # find root of the source tree
  556. BIN=$(hadoop_abs "${BASH_SOURCE:-$0}")
  557. PARAMS=("$@")
  558. set_defaults
  559. option_parse "${PARAMS[@]}"
  560. dockermode
  561. header
  562. if [[ -n ${RC_LABEL} ]]; then
  563. RC_LABEL="-${RC_LABEL}"
  564. fi
  565. if [[ "${INDOCKER}" = true || "${DOCKERRAN}" = false ]]; then
  566. startgpgagent
  567. makearelease
  568. releaseret=$?
  569. signartifacts
  570. stopgpgagent
  571. fi
  572. if [[ "${INDOCKER}" = true ]]; then
  573. exit $?
  574. fi
  575. if [[ ${releaseret} == 0 ]]; then
  576. echo
  577. echo "Congratulations, you have successfully built the release"
  578. echo "artifacts for Apache Hadoop ${HADOOP_VERSION}${RC_LABEL}"
  579. echo
  580. echo "The artifacts for this run are available at ${ARTIFACTS_DIR}:"
  581. run ls -1 "${ARTIFACTS_DIR}"
  582. echo
  583. fi