build 17 KB

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