build 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. #!/usr/bin/env bash
  2. # This script helps to build release artifacts.
  3. # arg1: profile, e.g. emqx | emqx-enterprise
  4. # arg2: artifact, e.g. rel | relup | tgz | pkg
  5. set -euo pipefail
  6. [ "${DEBUG:-0}" -eq 1 ] && set -x
  7. PROFILE_ARG="$1"
  8. ARTIFACT="$2"
  9. is_enterprise() {
  10. case "$1" in
  11. *enterprise*)
  12. echo 'yes'
  13. ;;
  14. *)
  15. echo 'no'
  16. ;;
  17. esac
  18. }
  19. PROFILE_ENV="${PROFILE:-${PROFILE_ARG}}"
  20. case "$(is_enterprise "$PROFILE_ARG"),$(is_enterprise "$PROFILE_ENV")" in
  21. 'yes,yes')
  22. true
  23. ;;
  24. 'no,no')
  25. true
  26. ;;
  27. *)
  28. echo "PROFILE env var is set to '$PROFILE_ENV', but '$0' arg1 is '$PROFILE_ARG'"
  29. exit 1
  30. ;;
  31. esac
  32. # make sure PROFILE is exported, it is needed by rebar.config.erl
  33. PROFILE=$PROFILE_ARG
  34. export PROFILE
  35. # ensure dir
  36. cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")"
  37. PKG_VSN="${PKG_VSN:-$(./pkg-vsn.sh "$PROFILE")}"
  38. export PKG_VSN
  39. SYSTEM="$(./scripts/get-distro.sh)"
  40. ARCH="$(uname -m)"
  41. case "$ARCH" in
  42. x86_64)
  43. ARCH='amd64'
  44. ;;
  45. aarch64)
  46. ARCH='arm64'
  47. ;;
  48. arm*)
  49. ARCH='arm64'
  50. ;;
  51. esac
  52. export ARCH
  53. ##
  54. ## Support RPM and Debian based linux systems
  55. ##
  56. if [ "$(uname -s)" = 'Linux' ]; then
  57. case "${SYSTEM:-}" in
  58. ubuntu*|debian*|raspbian*)
  59. PKGERDIR='deb'
  60. ;;
  61. *)
  62. PKGERDIR='rpm'
  63. ;;
  64. esac
  65. fi
  66. if [ "${SYSTEM}" = 'windows' ]; then
  67. # windows does not like the find
  68. FIND="/usr/bin/find"
  69. TAR="/usr/bin/tar"
  70. export BUILD_WITHOUT_ROCKSDB="on"
  71. else
  72. FIND='find'
  73. TAR='tar'
  74. fi
  75. log() {
  76. local msg="$1"
  77. # rebar3 prints ===>, so we print ===<
  78. echo "===< $msg"
  79. }
  80. prepare_erl_libs() {
  81. local libs_dir="$1"
  82. local erl_libs="${ERL_LIBS:-}"
  83. local sep
  84. if [ "${SYSTEM}" = 'windows' ]; then
  85. sep=';'
  86. else
  87. sep=':'
  88. fi
  89. for app in "${libs_dir}"/*; do
  90. if [ -d "${app}/ebin" ]; then
  91. if [ -n "$erl_libs" ]; then
  92. erl_libs="${erl_libs}${sep}${app}"
  93. else
  94. erl_libs="${app}"
  95. fi
  96. fi
  97. done
  98. export ERL_LIBS="$erl_libs"
  99. }
  100. make_docs() {
  101. case "$(is_enterprise "$PROFILE")" in
  102. 'yes')
  103. SCHEMA_MODULE='emqx_enterprise_schema'
  104. ;;
  105. 'no')
  106. SCHEMA_MODULE='emqx_conf_schema'
  107. ;;
  108. esac
  109. prepare_erl_libs "_build/$PROFILE/checkouts"
  110. prepare_erl_libs "_build/$PROFILE/lib"
  111. local docdir="_build/docgen/$PROFILE"
  112. mkdir -p "$docdir"
  113. # shellcheck disable=SC2086
  114. erl -noshell -eval \
  115. "ok = emqx_conf:dump_schema('$docdir', $SCHEMA_MODULE), \
  116. halt(0)."
  117. }
  118. ## arg1 is the profile for which the following args (as app names) should be excluded
  119. assert_no_excluded_deps() {
  120. local profile="$1"
  121. shift 1
  122. if [ "$PROFILE" != "$profile" ]; then
  123. # not currently building the profile which has apps to be excluded
  124. return 0
  125. fi
  126. local rel_dir="_build/$PROFILE/rel/emqx/lib"
  127. local excluded_apps=( "$@" )
  128. local found
  129. for app in "${excluded_apps[@]}"; do
  130. found="$($FIND "$rel_dir" -maxdepth 1 -type d -name "$app-*")"
  131. if [ -n "${found}" ]; then
  132. echo "ERROR: ${app} should not be included in ${PROFILE}"
  133. echo "ERROR: found ${app} in ${rel_dir}"
  134. exit 1
  135. fi
  136. done
  137. }
  138. just_compile() {
  139. ./scripts/pre-compile.sh "$PROFILE"
  140. # make_elixir_rel always create rebar.lock
  141. # delete it to make git clone + checkout work because we use shallow close for rebar deps
  142. rm -f rebar.lock
  143. # compile all beams
  144. ./rebar3 as "$PROFILE" compile
  145. make_docs
  146. }
  147. just_compile_elixir() {
  148. ./scripts/pre-compile.sh "$PROFILE"
  149. rm -f rebar.lock
  150. # shellcheck disable=SC1010
  151. env MIX_ENV="$PROFILE" mix do local.hex --if-missing --force, \
  152. local.rebar rebar3 "${PWD}/rebar3" --if-missing --force, \
  153. deps.get
  154. env MIX_ENV="$PROFILE" mix compile
  155. }
  156. make_rel() {
  157. local release_or_tar="${1}"
  158. just_compile
  159. # now assemble the release tar
  160. ./rebar3 as "$PROFILE" "$release_or_tar"
  161. assert_no_excluded_deps emqx-enterprise emqx_telemetry
  162. }
  163. make_elixir_rel() {
  164. ./scripts/pre-compile.sh "$PROFILE"
  165. export_elixir_release_vars "$PROFILE"
  166. # for some reason, this has to be run outside "do"...
  167. mix local.rebar --if-missing --force
  168. # shellcheck disable=SC1010
  169. mix do local.hex --if-missing --force, \
  170. local.rebar rebar3 "${PWD}/rebar3" --if-missing --force, \
  171. deps.get
  172. mix release --overwrite
  173. assert_no_excluded_deps emqx-enterprise emqx_telemetry
  174. }
  175. ## extract previous version .tar.gz files to _build/$PROFILE/rel/emqx before making relup
  176. make_relup() {
  177. local rel_dir="_build/$PROFILE/rel/emqx"
  178. local name_pattern
  179. name_pattern="${PROFILE}-$(./pkg-vsn.sh "$PROFILE" --vsn_matcher --long)"
  180. local releases=()
  181. mkdir -p _upgrade_base
  182. while read -r tgzfile ; do
  183. local base_vsn
  184. base_vsn="$(echo "$tgzfile" | grep -oE "[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)\.[0-9])?(-[0-9a-f]{8})?" | head -1)"
  185. ## we have to create tmp dir to untar old tgz, as `tar --skip-old-files` is not supported on all plantforms
  186. local tmp_dir
  187. tmp_dir="$(mktemp -d -t emqx.XXXXXXX)"
  188. $TAR -C "$tmp_dir" -zxf "$tgzfile"
  189. mkdir -p "${rel_dir}/releases/"
  190. cp -npr "$tmp_dir/releases"/* "${rel_dir}/releases/"
  191. ## There is for some reason a copy of the '$PROFILE.rel' file to releases dir,
  192. ## the content is duplicated to releases/5.0.0/$PROFILE.rel.
  193. ## This file seems to be useless, but yet confusing as it does not change after upgrade/downgrade
  194. ## Hence we force delete this file.
  195. rm -f "${rel_dir}/releases/${PROFILE}.rel"
  196. mkdir -p "${rel_dir}/lib/"
  197. cp -npr "$tmp_dir/lib"/* "${rel_dir}/lib/"
  198. rm -rf "$tmp_dir"
  199. releases+=( "$base_vsn" )
  200. done < <("$FIND" _upgrade_base -maxdepth 1 -name "${name_pattern}.tar.gz" -type f)
  201. if [ ${#releases[@]} -eq 0 ]; then
  202. log "No upgrade base found, relup ignored"
  203. return 0
  204. fi
  205. RELX_BASE_VERSIONS="$(IFS=, ; echo "${releases[*]}")"
  206. export RELX_BASE_VERSIONS
  207. ./rebar3 as "$PROFILE" relup --relname emqx --relvsn "${PKG_VSN}"
  208. }
  209. cp_dyn_libs() {
  210. local rel_dir="$1"
  211. local target_dir="${rel_dir}/dynlibs"
  212. if ! [ "$(uname -s)" = 'Linux' ]; then
  213. return 0;
  214. fi
  215. mkdir -p "$target_dir"
  216. while read -r so_file; do
  217. cp -L "$so_file" "$target_dir/"
  218. done < <("$FIND" "$rel_dir" -type f \( -name "*.so*" -o -name "beam.smp" \) -print0 \
  219. | xargs -0 ldd \
  220. | grep -E '(libcrypto)|(libtinfo)|(libatomic)' \
  221. | awk '{print $3}' \
  222. | sort -u)
  223. }
  224. ## Re-pack the relx assembled .tar.gz to EMQX's package naming scheme
  225. ## It assumes the .tar.gz has been built -- relies on Makefile dependency
  226. make_tgz() {
  227. local pkgpath="_packages/${PROFILE}"
  228. local src_tarball
  229. local target_name
  230. local target
  231. if [ "${IS_ELIXIR:-no}" = "yes" ]
  232. then
  233. # ensure src_tarball exists
  234. ELIXIR_MAKE_TAR=yes make_elixir_rel
  235. local relpath="_build/${PROFILE}"
  236. full_vsn="$(./pkg-vsn.sh "$PROFILE" --long --elixir)"
  237. else
  238. # build the src_tarball again to ensure relup is included
  239. # elixir does not have relup yet.
  240. make_rel tar
  241. local relpath="_build/${PROFILE}/rel/emqx"
  242. full_vsn="$(./pkg-vsn.sh "$PROFILE" --long)"
  243. fi
  244. case "$SYSTEM" in
  245. macos*)
  246. target_name="${PROFILE}-${full_vsn}.zip"
  247. ;;
  248. windows*)
  249. target_name="${PROFILE}-${full_vsn}.zip"
  250. ;;
  251. *)
  252. target_name="${PROFILE}-${full_vsn}.tar.gz"
  253. ;;
  254. esac
  255. target="${pkgpath}/${target_name}"
  256. src_tarball="${relpath}/emqx-${PKG_VSN}.tar.gz"
  257. tard="$(mktemp -d -t emqx.XXXXXXX)"
  258. mkdir -p "${tard}/emqx"
  259. mkdir -p "${pkgpath}"
  260. if [ ! -f "$src_tarball" ]; then
  261. log "ERROR: $src_tarball is not found"
  262. fi
  263. $TAR zxf "${src_tarball}" -C "${tard}/emqx"
  264. if [ -f "${tard}/emqx/releases/${PKG_VSN}/relup" ]; then
  265. ./scripts/relup-build/inject-relup.escript "${tard}/emqx/releases/${PKG_VSN}/relup"
  266. fi
  267. ## try to be portable for tar.gz packages.
  268. ## for DEB and RPM packages the dependencies are resoved by yum and apt
  269. cp_dyn_libs "${tard}/emqx"
  270. case "$SYSTEM" in
  271. macos*)
  272. # if the flag to sign macos binaries is set, but developer certificate
  273. # or certificate password is not configured, reset the flag
  274. # could happen, for example, when people submit PR from a fork, in this
  275. # case they cannot access secrets
  276. if [[ "${APPLE_SIGN_BINARIES:-0}" == 1 && \
  277. ( "${APPLE_DEVELOPER_ID_BUNDLE:-0}" == 0 || \
  278. "${APPLE_DEVELOPER_ID_BUNDLE_PASSWORD:-0}" == 0 ) ]]; then
  279. echo "Apple developer certificate is not configured, skip signing"
  280. APPLE_SIGN_BINARIES=0
  281. fi
  282. if [ "${APPLE_SIGN_BINARIES:-0}" = 1 ]; then
  283. ./scripts/macos-sign-binaries.sh "${tard}/emqx"
  284. fi
  285. ## create zip after change dir
  286. ## to avoid creating an extra level of 'emqx' dir in the .zip file
  287. pushd "${tard}/emqx" >/dev/null
  288. zip -r "../${target_name}" -- * >/dev/null
  289. popd >/dev/null
  290. mv "${tard}/${target_name}" "${target}"
  291. if [ "${APPLE_SIGN_BINARIES:-0}" = 1 ]; then
  292. # notarize the package
  293. # if fails, check what went wrong with this command:
  294. # xcrun notarytool log \
  295. # --apple-id <apple id> \
  296. # --password <apple id password>
  297. # --team-id <apple team id> <submission-id>
  298. echo 'Submitting the package for notarization to Apple (normally takes about a minute)'
  299. notarytool_output="$(xcrun notarytool submit \
  300. --apple-id "${APPLE_ID}" \
  301. --password "${APPLE_ID_PASSWORD}" \
  302. --team-id "${APPLE_TEAM_ID}" "${target}" \
  303. --no-progress \
  304. --wait)"
  305. echo "$notarytool_output"
  306. echo "$notarytool_output" | grep -q 'status: Accepted' || {
  307. echo 'Notarization failed';
  308. exit 1;
  309. }
  310. fi
  311. # sha256sum may not be available on macos
  312. openssl dgst -sha256 "${target}" | cut -d ' ' -f 2 > "${target}.sha256"
  313. ;;
  314. windows*)
  315. pushd "${tard}" >/dev/null
  316. 7z a "${target_name}" ./emqx/* >/dev/null
  317. popd >/dev/null
  318. mv "${tard}/${target_name}" "${target}"
  319. sha256sum "${target}" | head -c 64 > "${target}.sha256"
  320. ;;
  321. *)
  322. ## create tar after change dir
  323. ## to avoid creating an extra level of 'emqx' dir in the .tar.gz file
  324. pushd "${tard}/emqx" >/dev/null
  325. $TAR -zcf "../${target_name}" -- *
  326. popd >/dev/null
  327. mv "${tard}/${target_name}" "${target}"
  328. sha256sum "${target}" | head -c 64 > "${target}.sha256"
  329. ;;
  330. esac
  331. log "Archive successfully repacked: ${target}"
  332. log "Archive sha256sum: $(cat "${target}.sha256")"
  333. }
  334. docker_cleanup() {
  335. rm -f ./.dockerignore >/dev/null
  336. # shellcheck disable=SC2015
  337. [ -f ./.dockerignore.bak ] && mv ./.dockerignore.bak ./.dockerignore >/dev/null || true
  338. }
  339. ## Build the default docker image based on debian 11.
  340. make_docker() {
  341. local EMQX_BUILDER_VERSION="${EMQX_BUILDER_VERSION:-5.1-4}"
  342. local EMQX_BUILDER_PLATFORM="${EMQX_BUILDER_PLATFORM:-debian11}"
  343. local EMQX_BUILDER_OTP="${EMQX_BUILDER_OTP:-25.3.2-2}"
  344. local EMQX_BUILDER_ELIXIR="${EMQX_BUILDER_ELIXIR:-1.14.5}"
  345. local EMQX_BUILDER=${EMQX_BUILDER:-ghcr.io/emqx/emqx-builder/${EMQX_BUILDER_VERSION}:${EMQX_BUILDER_ELIXIR}-${EMQX_BUILDER_OTP}-${EMQX_BUILDER_PLATFORM}}
  346. local EMQX_RUNNER="${EMQX_RUNNER:-${EMQX_DEFAULT_RUNNER}}"
  347. local EMQX_DOCKERFILE="${EMQX_DOCKERFILE:-deploy/docker/Dockerfile}"
  348. local PKG_VSN="${PKG_VSN:-$(./pkg-vsn.sh)}"
  349. # shellcheck disable=SC2155
  350. local VSN_MAJOR="$(scripts/semver.sh "$PKG_VSN" --major)"
  351. # shellcheck disable=SC2155
  352. local VSN_MINOR="$(scripts/semver.sh "$PKG_VSN" --minor)"
  353. # shellcheck disable=SC2155
  354. local VSN_PATCH="$(scripts/semver.sh "$PKG_VSN" --patch)"
  355. local SUFFIX=''
  356. if [[ "$PROFILE" = *-elixir ]]; then
  357. SUFFIX="-elixir"
  358. fi
  359. local DOCKER_REGISTRY="${DOCKER_REGISTRY:-docker.io}"
  360. local DOCKER_ORG="${DOCKER_ORG:-emqx}"
  361. local EMQX_BASE_DOCKER_TAG="${DOCKER_REGISTRY}/${DOCKER_ORG}/${PROFILE%%-elixir}"
  362. local default_tag="${EMQX_BASE_DOCKER_TAG}:${PKG_VSN}${SUFFIX}"
  363. local EMQX_IMAGE_TAG="${EMQX_IMAGE_TAG:-$default_tag}"
  364. local EDITION=Opensource
  365. local LICENSE='Apache-2.0'
  366. local PRODUCT_URL='https://www.emqx.io'
  367. local PRODUCT_DESCRIPTION='Official docker image for EMQX, the most scalable open-source MQTT broker for IoT, IIoT, and connected vehicles.'
  368. local DOCUMENTATION_URL='https://www.emqx.io/docs/en/latest/'
  369. ## extra_deps is a comma separated list of debian 11 package names
  370. local EXTRA_DEPS=''
  371. if [[ "$PROFILE" = *enterprise* ]]; then
  372. EXTRA_DEPS='libsasl2-2,libsasl2-modules-gssapi-mit'
  373. EDITION=Enterprise
  374. LICENSE='(Apache-2.0 AND BSL-1.1)'
  375. PRODUCT_URL='https://www.emqx.com/en/products/emqx'
  376. PRODUCT_DESCRIPTION='Official docker image for EMQX Enterprise, an enterprise MQTT platform at scale. '
  377. DOCUMENTATION_URL='https://docs.emqx.com/en/enterprise/latest/'
  378. fi
  379. # shellcheck disable=SC2155
  380. local ISO_8601_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
  381. # shellcheck disable=SC2155
  382. local GIT_REVISION="$(git rev-parse HEAD)"
  383. local DOCKER_BUILDX_ARGS=(
  384. --build-arg BUILD_FROM="${EMQX_BUILDER}" \
  385. --build-arg RUN_FROM="${EMQX_RUNNER}" \
  386. --build-arg EMQX_NAME="${PROFILE}" \
  387. --build-arg EXTRA_DEPS="${EXTRA_DEPS}" \
  388. --build-arg PKG_VSN="${PKG_VSN}" \
  389. --file "${EMQX_DOCKERFILE}" \
  390. --label org.opencontainers.image.title="${PROFILE}" \
  391. --label org.opencontainers.image.edition="${EDITION}" \
  392. --label org.opencontainers.image.version="${PKG_VSN}" \
  393. --label org.opencontainers.image.revision="${GIT_REVISION}" \
  394. --label org.opencontainers.image.created="${ISO_8601_DATE}" \
  395. --label org.opencontainers.image.source='https://github.com/emqx/emqx' \
  396. --label org.opencontainers.image.url="${PRODUCT_URL}" \
  397. --label org.opencontainers.image.description="${PRODUCT_DESCRIPTION}" \
  398. --label org.opencontainers.image.documentation="${DOCUMENTATION_URL}" \
  399. --label org.opencontainers.image.licenses="${LICENSE}" \
  400. --label org.opencontainers.image.otp.version="${EMQX_BUILDER_OTP}" \
  401. --tag "${EMQX_IMAGE_TAG}" \
  402. --provenance false \
  403. --pull
  404. )
  405. if [ "${DOCKER_BUILD_NOCACHE:-false}" = true ]; then
  406. DOCKER_BUILDX_ARGS+=(--no-cache)
  407. fi
  408. if [ "${SUFFIX}" = '-elixir' ]; then
  409. DOCKER_BUILDX_ARGS+=(--label org.opencontainers.image.elixir.version="${EMQX_BUILDER_ELIXIR}")
  410. fi
  411. if [ "${DOCKER_LATEST:-false}" = true ]; then
  412. DOCKER_BUILDX_ARGS+=(--tag "${EMQX_BASE_DOCKER_TAG}:latest${SUFFIX}")
  413. DOCKER_BUILDX_ARGS+=(--tag "${EMQX_BASE_DOCKER_TAG}:${VSN_MAJOR}.${VSN_MINOR}${SUFFIX}")
  414. DOCKER_BUILDX_ARGS+=(--tag "${EMQX_BASE_DOCKER_TAG}:${VSN_MAJOR}.${VSN_MINOR}.${VSN_PATCH}${SUFFIX}")
  415. fi
  416. if [ "${DOCKER_PLATFORMS:-default}" != 'default' ]; then
  417. DOCKER_BUILDX_ARGS+=(--platform "${DOCKER_PLATFORMS}")
  418. fi
  419. if [ "${DOCKER_PUSH:-false}" = true ]; then
  420. DOCKER_BUILDX_ARGS+=(--push)
  421. fi
  422. # shellcheck disable=SC2015
  423. [ -f ./.dockerignore ] && mv ./.dockerignore ./.dockerignore.bak || true
  424. trap docker_cleanup EXIT
  425. {
  426. echo '/_build'
  427. echo '/deps'
  428. echo '/*.lock'
  429. } >> ./.dockerignore
  430. set -x
  431. docker buildx build "${DOCKER_BUILDX_ARGS[@]}" .
  432. [[ "${DEBUG:-}" -eq 1 ]] || set +x
  433. echo "${EMQX_IMAGE_TAG}" > ./.docker_image_tag
  434. }
  435. function join {
  436. local IFS="$1"
  437. shift
  438. echo "$*"
  439. }
  440. # used to control the Elixir Mix Release output
  441. # see docstring in `mix.exs`
  442. export_elixir_release_vars() {
  443. local profile="$1"
  444. case "$profile" in
  445. emqx|emqx-enterprise)
  446. export ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-no}
  447. ;;
  448. emqx-pkg|emqx-enterprise-pkg)
  449. export ELIXIR_MAKE_TAR=${ELIXIR_MAKE_TAR:-yes}
  450. ;;
  451. *)
  452. echo Invalid profile "$profile"
  453. exit 1
  454. esac
  455. export MIX_ENV="$profile"
  456. }
  457. log "building artifact=$ARTIFACT for profile=$PROFILE"
  458. case "$ARTIFACT" in
  459. apps)
  460. if [ "${IS_ELIXIR:-}" = "yes" ]; then
  461. just_compile_elixir
  462. else
  463. just_compile
  464. fi
  465. ;;
  466. doc|docs)
  467. make_docs
  468. ;;
  469. rel)
  470. make_rel release
  471. ;;
  472. relup)
  473. make_relup
  474. ;;
  475. tgz)
  476. make_tgz
  477. ;;
  478. pkg)
  479. # this only affect build artifacts, such as schema doc
  480. export EMQX_ETC_DIR='/etc/emqx/'
  481. if [ -z "${PKGERDIR:-}" ]; then
  482. log "Skipped making deb/rpm package for $SYSTEM"
  483. exit 0
  484. fi
  485. export EMQX_REL_FORM="$PKGERDIR"
  486. if [ "${IS_ELIXIR:-}" = 'yes' ]; then
  487. make_elixir_rel
  488. else
  489. make_rel tar
  490. fi
  491. env EMQX_REL="$(pwd)" \
  492. EMQX_BUILD="${PROFILE}" \
  493. make -C "deploy/packages/${PKGERDIR}" clean
  494. env EMQX_REL="$(pwd)" \
  495. EMQX_BUILD="${PROFILE}" \
  496. make -C "deploy/packages/${PKGERDIR}"
  497. ;;
  498. docker)
  499. make_docker
  500. ;;
  501. elixir)
  502. make_elixir_rel
  503. ;;
  504. *)
  505. log "Unknown artifact $ARTIFACT"
  506. exit 1
  507. ;;
  508. esac