ci: harden external test tool bootstrap
All checks were successful
CI / verify (push) Successful in 11m0s

This commit is contained in:
237899745
2026-07-26 08:20:00 +08:00
parent 9c1d749a2a
commit e90f6ec604

View File

@@ -79,19 +79,37 @@ case "$arch" in
*) echo "Unsupported MinIO architecture: ${arch}" >&2; exit 1 ;;
esac
MINIO_BIN="${MINIO_BIN:-${WORK_DIR}/minio}"
MC_BIN="${MC_BIN:-${WORK_DIR}/mc}"
default_minio_bin="${WORK_DIR}/minio"
default_mc_bin="${WORK_DIR}/mc"
if command -v minio >/dev/null 2>&1; then
default_minio_bin="$(command -v minio)"
fi
if command -v mc >/dev/null 2>&1; then
default_mc_bin="$(command -v mc)"
fi
MINIO_BIN="${MINIO_BIN:-${default_minio_bin}}"
MC_BIN="${MC_BIN:-${default_mc_bin}}"
download_tool() {
local url=$1
local output=$2
local partial="${output}.part"
curl --fail --silent --show-error --location \
--retry 10 --retry-all-errors --retry-delay 2 --connect-timeout 20 \
--continue-at - --output "$partial" "$url"
mv "$partial" "$output"
chmod +x "$output"
}
if [[ ! -x "$MINIO_BIN" ]]; then
curl --fail --silent --show-error --location --retry 3 \
download_tool \
"https://dl.min.io/server/minio/release/linux-${minio_arch}/minio" \
--output "$MINIO_BIN"
chmod +x "$MINIO_BIN"
"$MINIO_BIN"
fi
if [[ ! -x "$MC_BIN" ]]; then
curl --fail --silent --show-error --location --retry 3 \
download_tool \
"https://dl.min.io/client/mc/release/linux-${minio_arch}/mc" \
--output "$MC_BIN"
chmod +x "$MC_BIN"
"$MC_BIN"
fi
export IMAGEFORGE_TEST_S3_ENDPOINT="${IMAGEFORGE_TEST_S3_ENDPOINT:-http://127.0.0.1:19000}"