feat: migrate releases to git.awaioi.com

This commit is contained in:
Qiufeng
2026-08-05 06:08:47 +08:00
parent 670dfb0c7a
commit 5d7112ce31
13 changed files with 132 additions and 76 deletions
+37 -9
View File
@@ -56,6 +56,34 @@ test_erp_run_preserves_java_option_arguments() (
grep -Fqx -- "$tmp/current/app/kaidi-erp.jar" <<< "$output"
)
test_erp_run_migrates_legacy_update_source() (
local tmp
tmp="$(mktemp -d "${TMPDIR:-/tmp}/erp-source-migration.XXXXXX")" || return 1
trap 'rm -rf "$tmp"' EXIT
mkdir -p "$tmp/current/app" "$tmp/run" "$tmp/state"
: > "$tmp/current/app/kaidi-erp.jar"
: > "$tmp/state/install.lock"
printf '%s\n' \
'#!/usr/bin/env bash' \
'if [[ "${1:-}" == "-version" ]]; then printf '\''openjdk version "17.0.12"\n'\'' >&2; fi' \
'exit 0' > "$tmp/java"
chmod +x "$tmp/java"
{
printf 'ERP_JAVA_BIN=%q\n' "$tmp/java"
printf 'ERP_RUN_DIR=%q\n' "$tmp/run"
printf "OA_UPDATE_GITEA_BASE_URL='http://38.76.196.225:10099/'\n"
printf "OA_UPDATE_ALLOW_INSECURE_HTTP='true'\n"
} > "$tmp/erp.env"
chmod 600 "$tmp/erp.env"
ERP_INSTALL_ROOT="$tmp" ERP_CONFIG_FILE="$tmp/erp.env" \
"$PROJECT_ROOT/distribution/bin/erp-run" >/dev/null 2>&1 || return 1
grep -Fqx "OA_UPDATE_GITEA_BASE_URL='https://git.awaioi.com'" "$tmp/erp.env" || return 1
grep -Fqx "OA_UPDATE_ALLOW_INSECURE_HTTP='false'" "$tmp/erp.env" || return 1
! grep -Fq '38.76.196.225' "$tmp/erp.env"
)
test_erp_run_finalizes_healthy_pending_install() (
local tmp
tmp="$(mktemp -d "${TMPDIR:-/tmp}/erp-handoff-success.XXXXXX")" || return 1
@@ -562,17 +590,15 @@ test_installer_moves_database_setup_to_web_wizard() (
[[ "$status" -ne 0 && "$output" == *'unknown option: --db-mode'* ]]
)
test_installer_requires_explicit_gitea_url() (
local output status=0
test_installer_defaults_to_official_gitea_url() (
local output
output="$(ERP_GITEA_BASE_URL= bash -c '
root="$1"
set --
source "$root/install.sh"
GITEA_BASE_URL=
NO_SERVICE=1
main
' _ "$PROJECT_ROOT" 2>&1)" || status=$?
[[ "$status" -ne 0 && "$output" == *'Gitea URL is required'* ]]
printf "%s\n" "$GITEA_BASE_URL"
' _ "$PROJECT_ROOT")" || return 1
[[ "$output" == 'https://git.awaioi.com' ]]
)
test_linux_service_preflight_requires_systemd() (
@@ -739,7 +765,8 @@ test_release_workflow_uses_scoped_job_token() (
test_installer_runs_when_piped_to_bash() (
local output status=0
output="$(ERP_GITEA_BASE_URL= bash -s -- --no-service < "$PROJECT_ROOT/install.sh" 2>&1)" || status=$?
output="$(bash -s -- --no-service --gitea-url invalid://example.test \
< "$PROJECT_ROOT/install.sh" 2>&1)" || status=$?
[[ "$status" -ne 0 ]]
[[ "$output" == *'[ERP Install] ERROR:'* ]]
[[ "$output" != *'BASH_SOURCE'* ]]
@@ -763,6 +790,7 @@ test_app_honors_reverse_proxy_headers() (
)
run_test 'erp-run preserves Java option arguments' test_erp_run_preserves_java_option_arguments
run_test 'erp-run migrates the legacy Gitea update source' test_erp_run_migrates_legacy_update_source
run_test 'erp-run finalizes a healthy pending installation' test_erp_run_finalizes_healthy_pending_install
run_test 'erp-run preserves a failed pending installation' test_erp_run_preserves_failed_pending_install
run_test 'installer accepts a correctly signed archive' test_installer_verifies_signed_safe_archive
@@ -775,7 +803,7 @@ run_test 'update helper installs a healthy release end to end' test_update_helpe
run_test 'update helper rolls back an unhealthy release end to end' test_update_helper_rolls_back_unhealthy_release
run_test 'update helper rejects a concurrent process' test_update_lock_rejects_concurrent_process
run_test 'installer moves database setup to the web wizard' test_installer_moves_database_setup_to_web_wizard
run_test 'installer requires an explicit Gitea URL' test_installer_requires_explicit_gitea_url
run_test 'installer defaults to the official Gitea URL' test_installer_defaults_to_official_gitea_url
run_test 'Linux production install requires systemd' test_linux_service_preflight_requires_systemd
run_test 'systemd unit uses compatible protection' test_systemd_unit_uses_compatible_protection
run_test 'systemd unit preserves update helper during restart' test_systemd_unit_preserves_update_helper_during_restart