Merge pull request #11422 from id/0810-ci-fix-publishing-packages
This commit is contained in:
commit
b3082c3f90
|
@ -82,20 +82,8 @@ jobs:
|
||||||
echo "ct-host=${CT_HOST}" | tee -a $GITHUB_OUTPUT
|
echo "ct-host=${CT_HOST}" | tee -a $GITHUB_OUTPUT
|
||||||
echo "ct-docker=${CT_DOCKER}" | tee -a $GITHUB_OUTPUT
|
echo "ct-docker=${CT_DOCKER}" | tee -a $GITHUB_OUTPUT
|
||||||
|
|
||||||
build_slim_packages:
|
|
||||||
if: ${{ needs.prepare.outputs.release != 'true' }}
|
|
||||||
needs:
|
|
||||||
- prepare
|
|
||||||
uses: ./.github/workflows/build_slim_packages.yaml
|
|
||||||
with:
|
|
||||||
runner: ${{ needs.prepare.outputs.runner }}
|
|
||||||
builder: ${{ needs.prepare.outputs.builder }}
|
|
||||||
builder_vsn: ${{ needs.prepare.outputs.builder_vsn }}
|
|
||||||
otp_vsn: ${{ needs.prepare.outputs.otp_vsn }}
|
|
||||||
elixir_vsn: ${{ needs.prepare.outputs.elixir_vsn }}
|
|
||||||
|
|
||||||
build_packages:
|
build_packages:
|
||||||
if: ${{ needs.prepare.outputs.release == 'true' }}
|
if: needs.prepare.outputs.release == 'true'
|
||||||
needs:
|
needs:
|
||||||
- prepare
|
- prepare
|
||||||
uses: ./.github/workflows/build_packages.yaml
|
uses: ./.github/workflows/build_packages.yaml
|
||||||
|
@ -109,7 +97,7 @@ jobs:
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
build_and_push_docker_images:
|
build_and_push_docker_images:
|
||||||
if: ${{ needs.prepare.outputs.release == 'true' }}
|
if: needs.prepare.outputs.release == 'true'
|
||||||
needs:
|
needs:
|
||||||
- prepare
|
- prepare
|
||||||
uses: ./.github/workflows/build_and_push_docker_images.yaml
|
uses: ./.github/workflows/build_and_push_docker_images.yaml
|
||||||
|
@ -124,7 +112,20 @@ jobs:
|
||||||
runner: ${{ needs.prepare.outputs.runner }}
|
runner: ${{ needs.prepare.outputs.runner }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
build_slim_packages:
|
||||||
|
if: needs.prepare.outputs.release != 'true'
|
||||||
|
needs:
|
||||||
|
- prepare
|
||||||
|
uses: ./.github/workflows/build_slim_packages.yaml
|
||||||
|
with:
|
||||||
|
runner: ${{ needs.prepare.outputs.runner }}
|
||||||
|
builder: ${{ needs.prepare.outputs.builder }}
|
||||||
|
builder_vsn: ${{ needs.prepare.outputs.builder_vsn }}
|
||||||
|
otp_vsn: ${{ needs.prepare.outputs.otp_vsn }}
|
||||||
|
elixir_vsn: ${{ needs.prepare.outputs.elixir_vsn }}
|
||||||
|
|
||||||
compile:
|
compile:
|
||||||
|
if: needs.prepare.outputs.release != 'true'
|
||||||
runs-on: ${{ needs.prepare.outputs.runner }}
|
runs-on: ${{ needs.prepare.outputs.runner }}
|
||||||
container: ${{ needs.prepare.outputs.builder }}
|
container: ${{ needs.prepare.outputs.builder }}
|
||||||
needs:
|
needs:
|
||||||
|
@ -157,6 +158,7 @@ jobs:
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
run_test_cases:
|
run_test_cases:
|
||||||
|
if: needs.prepare.outputs.release != 'true'
|
||||||
needs:
|
needs:
|
||||||
- prepare
|
- prepare
|
||||||
- compile
|
- compile
|
||||||
|
@ -169,6 +171,7 @@ jobs:
|
||||||
ct-docker: ${{ needs.prepare.outputs.ct-docker }}
|
ct-docker: ${{ needs.prepare.outputs.ct-docker }}
|
||||||
|
|
||||||
run_conf_tests:
|
run_conf_tests:
|
||||||
|
if: needs.prepare.outputs.release != 'true'
|
||||||
needs:
|
needs:
|
||||||
- prepare
|
- prepare
|
||||||
- compile
|
- compile
|
||||||
|
@ -178,6 +181,7 @@ jobs:
|
||||||
builder: ${{ needs.prepare.outputs.builder }}
|
builder: ${{ needs.prepare.outputs.builder }}
|
||||||
|
|
||||||
static_checks:
|
static_checks:
|
||||||
|
if: needs.prepare.outputs.release != 'true'
|
||||||
needs:
|
needs:
|
||||||
- prepare
|
- prepare
|
||||||
- compile
|
- compile
|
||||||
|
|
|
@ -264,7 +264,7 @@ jobs:
|
||||||
path: _packages/${{ matrix.profile }}/
|
path: _packages/${{ matrix.profile }}/
|
||||||
|
|
||||||
publish_artifacts:
|
publish_artifacts:
|
||||||
runs-on: ${{ inputs.runner }}
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- mac
|
- mac
|
||||||
- linux
|
- linux
|
||||||
|
@ -280,7 +280,7 @@ jobs:
|
||||||
name: ${{ matrix.profile }}
|
name: ${{ matrix.profile }}
|
||||||
path: packages/${{ matrix.profile }}
|
path: packages/${{ matrix.profile }}
|
||||||
- name: install dos2unix
|
- name: install dos2unix
|
||||||
run: apt-get update && apt install -y dos2unix
|
run: sudo apt-get update && sudo apt install -y dos2unix
|
||||||
- name: get packages
|
- name: get packages
|
||||||
run: |
|
run: |
|
||||||
set -eu
|
set -eu
|
||||||
|
@ -300,7 +300,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
PROFILE: ${{ matrix.profile }}
|
PROFILE: ${{ matrix.profile }}
|
||||||
run: |
|
run: |
|
||||||
set -e -u
|
set -eu
|
||||||
if [ $PROFILE = 'emqx' ]; then
|
if [ $PROFILE = 'emqx' ]; then
|
||||||
s3dir='emqx-ce'
|
s3dir='emqx-ce'
|
||||||
elif [ $PROFILE = 'emqx-enterprise' ]; then
|
elif [ $PROFILE = 'emqx-enterprise' ]; then
|
||||||
|
|
12
build
12
build
|
@ -378,11 +378,11 @@ make_docker() {
|
||||||
local EMQX_DOCKERFILE="${EMQX_DOCKERFILE:-deploy/docker/Dockerfile}"
|
local EMQX_DOCKERFILE="${EMQX_DOCKERFILE:-deploy/docker/Dockerfile}"
|
||||||
local PKG_VSN="${PKG_VSN:-$(./pkg-vsn.sh)}"
|
local PKG_VSN="${PKG_VSN:-$(./pkg-vsn.sh)}"
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
local VSN_MAJOR="$(echo "$PKG_VSN" | cut -d . -f 1)"
|
local VSN_MAJOR="$(scripts/semver.sh "$PKG_VSN" --major)"
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
local VSN_MINOR="$(echo "$PKG_VSN" | cut -d . -f 2)"
|
local VSN_MINOR="$(scripts/semver.sh "$PKG_VSN" --minor)"
|
||||||
# shellcheck disable=SC2155
|
# shellcheck disable=SC2155
|
||||||
local VSN_PATCH="$(echo "$PKG_VSN" | cut -d . -f 3)"
|
local VSN_MINOR="$(scripts/semver.sh "$PKG_VSN" --patch)"
|
||||||
local SUFFIX=''
|
local SUFFIX=''
|
||||||
if [[ "$PROFILE" = *-elixir ]]; then
|
if [[ "$PROFILE" = *-elixir ]]; then
|
||||||
SUFFIX="-elixir"
|
SUFFIX="-elixir"
|
||||||
|
@ -430,8 +430,6 @@ make_docker() {
|
||||||
--label org.opencontainers.image.licenses="${LICENSE}" \
|
--label org.opencontainers.image.licenses="${LICENSE}" \
|
||||||
--label org.opencontainers.image.otp.version="${EMQX_BUILDER_OTP}" \
|
--label org.opencontainers.image.otp.version="${EMQX_BUILDER_OTP}" \
|
||||||
--tag "${EMQX_IMAGE_TAG}" \
|
--tag "${EMQX_IMAGE_TAG}" \
|
||||||
--tag "${EMQX_BASE_DOCKER_TAG}:${VSN_MAJOR}.${VSN_MINOR}${SUFFIX}" \
|
|
||||||
--tag "${EMQX_BASE_DOCKER_TAG}:${VSN_MAJOR}.${VSN_MINOR}.${VSN_PATCH}${SUFFIX}" \
|
|
||||||
--provenance false \
|
--provenance false \
|
||||||
--pull
|
--pull
|
||||||
)
|
)
|
||||||
|
@ -442,7 +440,9 @@ make_docker() {
|
||||||
DOCKER_BUILDX_ARGS+=(--label org.opencontainers.image.elixir.version="${EMQX_BUILDER_ELIXIR}")
|
DOCKER_BUILDX_ARGS+=(--label org.opencontainers.image.elixir.version="${EMQX_BUILDER_ELIXIR}")
|
||||||
fi
|
fi
|
||||||
if [ "${DOCKER_LATEST:-false}" = true ]; then
|
if [ "${DOCKER_LATEST:-false}" = true ]; then
|
||||||
DOCKER_BUILDX_ARGS+=(--tag "${DOCKER_REGISTRY}/${DOCKER_ORG}/${PROFILE}:latest${SUFFIX}")
|
DOCKER_BUILDX_ARGS+=(--tag "${EMQX_BASE_DOCKER_TAG}:latest${SUFFIX}")
|
||||||
|
DOCKER_BUILDX_ARGS+=(--tag "${EMQX_BASE_DOCKER_TAG}:${VSN_MAJOR}.${VSN_MINOR}${SUFFIX}")
|
||||||
|
DOCKER_BUILDX_ARGS+=(--tag "${EMQX_BASE_DOCKER_TAG}:${VSN_MAJOR}.${VSN_MINOR}.${VSN_PATCH}${SUFFIX}")
|
||||||
fi
|
fi
|
||||||
if [ "${DOCKER_PLATFORMS:-default}" != 'default' ]; then
|
if [ "${DOCKER_PLATFORMS:-default}" != 'default' ]; then
|
||||||
DOCKER_BUILDX_ARGS+=(--platform "${DOCKER_PLATFORMS}")
|
DOCKER_BUILDX_ARGS+=(--platform "${DOCKER_PLATFORMS}")
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
function parseSemver() {
|
||||||
|
local RE='^([0-9]+)\.([0-9]+)\.([0-9]+)(-([a-z]+\.[0-9]+))?$'
|
||||||
|
echo "$1" | grep -qE "$RE" || exit 1
|
||||||
|
#shellcheck disable=SC2155
|
||||||
|
local MAJOR=$( echo "$1" | sed -r "s#$RE#\1#")
|
||||||
|
#shellcheck disable=SC2155
|
||||||
|
local MINOR=$( echo "$1" | sed -r "s#$RE#\2#")
|
||||||
|
#shellcheck disable=SC2155
|
||||||
|
local PATCH=$( echo "$1" | sed -r "s#$RE#\3#")
|
||||||
|
#shellcheck disable=SC2155
|
||||||
|
local SPECIAL=$(echo "$1" | sed -r "s#$RE#\5#")
|
||||||
|
case "${2}" in
|
||||||
|
--major) echo "${MAJOR}" ;;
|
||||||
|
--minor) echo "${MINOR}" ;;
|
||||||
|
--patch) echo "${PATCH}" ;;
|
||||||
|
--special) echo "${SPECIAL}" ;;
|
||||||
|
*)
|
||||||
|
cat <<EOF
|
||||||
|
{"major": ${MAJOR}, "minor": ${MINOR}, "patch": ${PATCH}, "special": "${SPECIAL}"}
|
||||||
|
EOF
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
parseSemver "$1" "$2"
|
|
@ -7,13 +7,13 @@ exit_code=0
|
||||||
|
|
||||||
for test in shelltest/*.test; do
|
for test in shelltest/*.test; do
|
||||||
echo "Running $test"
|
echo "Running $test"
|
||||||
/bin/sh "${test%.test}.setup"
|
[ -f "${test%.test}.setup" ] && /bin/sh "${test%.test}.setup"
|
||||||
shelltest -c --diff --all --precise -- "$test"
|
shelltest -c --diff --all --precise -- "$test"
|
||||||
# shellcheck disable=SC2181
|
# shellcheck disable=SC2181
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
exit_code=1
|
exit_code=1
|
||||||
fi
|
fi
|
||||||
/bin/sh "${test%.test}.cleanup"
|
[ -f "${test%.test}.cleanup" ] && /bin/sh "${test%.test}.cleanup"
|
||||||
done
|
done
|
||||||
|
|
||||||
exit $exit_code
|
exit $exit_code
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
./semver.sh 5.2.0.1
|
||||||
|
>>>= 1
|
||||||
|
|
||||||
|
./semver.sh 5.1.0
|
||||||
|
>>>
|
||||||
|
{"major": 5, "minor": 1, "patch": 0, "special": ""}
|
||||||
|
>>>= 0
|
||||||
|
|
||||||
|
./semver.sh 5.1.0-patch.3
|
||||||
|
>>>
|
||||||
|
{"major": 5, "minor": 1, "patch": 0, "special": "patch.3"}
|
||||||
|
>>>= 0
|
||||||
|
|
||||||
|
./semver.sh 5.1.0-patch.3 --major
|
||||||
|
>>>
|
||||||
|
5
|
||||||
|
>>>= 0
|
||||||
|
|
||||||
|
./semver.sh 5.1.0-patch.3 --minor
|
||||||
|
>>>
|
||||||
|
1
|
||||||
|
>>>= 0
|
||||||
|
|
||||||
|
./semver.sh 5.1.0-patch.3 --patch
|
||||||
|
>>>
|
||||||
|
0
|
||||||
|
>>>= 0
|
||||||
|
|
||||||
|
./semver.sh 5.1.0-patch.3 --special
|
||||||
|
>>>
|
||||||
|
patch.3
|
||||||
|
>>>= 0
|
Loading…
Reference in New Issue