Files
alpine-packages/scripts/apk/test-shell.sh
T
Joachim Schlöffel 0f311d47fe
Build Alpine Packages / build-and-publish (v3.24, 3.24) (pull_request) Failing after 30m42s
Add LavinMQ Alpine package
2026-07-08 14:13:19 +02:00

72 lines
2.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
alpine_version="${ALPINE_VERSION:-3.24}"
platform="${ALPINE_BUILD_PLATFORM:-linux/amd64}"
arch="${ALPINE_ARCH:-x86_64}"
packages="${TEST_SHELL_PACKAGES:-seaweedfs seaweedfs-doc bash-completion seaweedfs-master-openrc seaweedfs-filer-openrc seaweedfs-worker-openrc greptimedb lavinmq lavinmq-doc lavinmq-openrc}"
shell="${TEST_SHELL:-/bin/bash}"
timeout_seconds="${TEST_SHELL_TIMEOUT:-120}"
case "${arch}" in
x86_64|aarch64) ;;
*) printf 'unsupported Alpine architecture: %s\n' "${arch}" >&2; exit 2 ;;
esac
if [[ "${SKIP_BUILD:-0}" != "1" ]]; then
"${repo_root}/scripts/apk/build.sh" build "${arch}"
fi
if [[ ! -d "${repo_root}/packages/local/${arch}" ]]; then
printf 'missing local repository: packages/local/%s\n' "${arch}" >&2
printf 'run: mise run apk:build\n' >&2
exit 1
fi
docker_args=(--rm --platform "${platform}")
if [[ -t 0 && -t 1 ]]; then
docker_args+=(-it)
fi
docker run "${docker_args[@]}" \
-e "ALPINE_ARCH=${arch}" \
-e "PACKAGE_LIST=${packages}" \
-e "TEST_SHELL=${shell}" \
-e "TEST_SHELL_TIMEOUT=${timeout_seconds}" \
-v "${repo_root}:/work:ro" \
-v "${repo_root}/packages/local:/repo:ro" \
"alpine:${alpine_version}" \
sh -lc '
set -e
printf "Installing repository key for %s...\n" "${ALPINE_ARCH}"
cp "/repo/${ALPINE_ARCH}"/*.rsa.pub /etc/apk/keys/
echo /repo >> /etc/apk/repositories
printf "Refreshing apk indexes...\n"
timeout "${TEST_SHELL_TIMEOUT}" apk update
printf "Installing test packages: %s\n" "${PACKAGE_LIST}"
timeout "${TEST_SHELL_TIMEOUT}" apk add ${PACKAGE_LIST}
printf "\nInstalled default test packages:\n"
apk info -e seaweedfs seaweedfs-doc seaweedfs-bash-completion \
seaweedfs-master-openrc seaweedfs-filer-openrc seaweedfs-worker-openrc \
greptimedb lavinmq lavinmq-doc lavinmq-openrc \
| sort
if command -v weed >/dev/null 2>&1; then
printf "\nSeaweedFS version:\n"
weed version
fi
if command -v greptime >/dev/null 2>&1; then
printf "\nGreptimeDB version:\n"
greptime --version
fi
if command -v lavinmq >/dev/null 2>&1; then
printf "\nLavinMQ version:\n"
lavinmq -v
fi
printf "\nEntering %s. Repository mounted read-only at /work.\n\n" "${TEST_SHELL}"
exec "${TEST_SHELL}"
'