Fix release/5.1 LXC installs defaulting to RC
Some checks failed
Build and Test / Secret Scan (push) Has been cancelled
Build and Test / Frontend & Backend (push) Has been cancelled
Core E2E Tests / Playwright Core E2E (push) Has been cancelled

Refs #1435
This commit is contained in:
rcourtman 2026-04-21 17:18:42 +01:00
parent 9fe622b885
commit b204bed8c7
2 changed files with 65 additions and 4 deletions

View file

@ -173,6 +173,24 @@ get_latest_release_from_redirect() {
return 0
}
read_configured_update_channel() {
if [[ "${IGNORE_CONFIGURED_UPDATE_CHANNEL:-false}" == "true" ]]; then
return 1
fi
if [[ ! -f "$CONFIG_DIR/system.json" ]]; then
return 1
fi
local configured_channel=""
configured_channel=$(grep -o '"updateChannel"[[:space:]]*:[[:space:]]*"[^"]*"' "$CONFIG_DIR/system.json" 2>/dev/null | sed 's/.*"\([^"]*\)"$/\1/' || true)
if [[ -z "$configured_channel" ]]; then
return 1
fi
printf '%s\n' "$configured_channel"
}
maintenance_raw_url() {
local path="$1"
printf 'https://raw.githubusercontent.com/%s/%s/%s\n' "$GITHUB_REPO" "$SOURCE_BRANCH" "$path"
@ -821,6 +839,12 @@ create_lxc_container() {
ADVANCED_MODE=false
;;
esac
# A Proxmox-host LXC install creates a brand-new Pulse instance inside the
# container. Host-local Pulse config must not silently switch that fresh
# install onto the prerelease channel unless the operator explicitly asked
# for it via --rc or --version.
IGNORE_CONFIGURED_UPDATE_CHANNEL=true
# Get next available container ID from Proxmox
local CTID=$(pvesh get /cluster/nextid 2>/dev/null || echo "100")
@ -2415,8 +2439,8 @@ resolve_target_release() {
if [[ -n "${FORCE_CHANNEL}" ]]; then
UPDATE_CHANNEL="${FORCE_CHANNEL}"
print_info "Using $UPDATE_CHANNEL channel from command line"
elif [[ -f "$CONFIG_DIR/system.json" ]]; then
CONFIGURED_CHANNEL=$(cat "$CONFIG_DIR/system.json" 2>/dev/null | grep -o '"updateChannel"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"\([^"]*\)"$/\1/' || true)
else
CONFIGURED_CHANNEL=$(read_configured_update_channel 2>/dev/null || true)
if [[ "$CONFIGURED_CHANNEL" == "rc" ]]; then
UPDATE_CHANNEL="rc"
print_info "RC channel detected in configuration"
@ -3745,8 +3769,8 @@ main() {
# Allow override via command line
if [[ -n "${FORCE_CHANNEL}" ]]; then
UPDATE_CHANNEL="${FORCE_CHANNEL}"
elif [[ -f "$CONFIG_DIR/system.json" ]]; then
CONFIGURED_CHANNEL=$(cat "$CONFIG_DIR/system.json" 2>/dev/null | grep -o '"updateChannel"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/.*"\([^"]*\)"$/\1/' || true)
else
CONFIGURED_CHANNEL=$(read_configured_update_channel 2>/dev/null || true)
if [[ "$CONFIGURED_CHANNEL" == "rc" ]]; then
UPDATE_CHANNEL="rc"
fi

View file

@ -176,6 +176,42 @@ test_prefetch_pulse_archive_for_container_sets_output_var() {
)
}
test_resolve_target_release_ignores_host_configured_rc_channel_when_requested() {
(
load_installer
local tmpdir
tmpdir="$(mktemp -d)"
CONFIG_DIR="${tmpdir}/etc/pulse"
mkdir -p "${CONFIG_DIR}"
cat > "${CONFIG_DIR}/system.json" <<'EOF'
{"updateChannel":"rc"}
EOF
IGNORE_CONFIGURED_UPDATE_CHANNEL=true
FORCE_VERSION=""
FORCE_CHANNEL=""
UPDATE_CHANNEL=""
LATEST_RELEASE=""
curl() {
cat <<'EOF'
[
{"tag_name":"v6.0.0-rc.2","draft":false,"prerelease":true},
{"tag_name":"v5.1.28","draft":false,"prerelease":false}
]
EOF
}
resolve_target_release >/dev/null
[[ "${UPDATE_CHANNEL}" == "stable" ]]
[[ "${LATEST_RELEASE}" == "v5.1.28" ]]
rm -rf "${tmpdir}"
)
}
test_install_pulse_archive_rejects_mismatched_arch_without_replacing_existing_binary() {
(
load_installer
@ -332,6 +368,7 @@ main() {
assert_success "update disk preflight passes on separate filesystems with enough headroom" test_ensure_update_disk_headroom_accepts_separate_filesystems_with_sufficient_space
assert_success "download_pulse installs from local archive without network" test_download_pulse_installs_from_local_archive_without_network
assert_success "prefetch helper writes archive path via output variable" test_prefetch_pulse_archive_for_container_sets_output_var
assert_success "resolve_target_release ignores host-configured rc during fresh LXC bootstrap" test_resolve_target_release_ignores_host_configured_rc_channel_when_requested
assert_success "wrong-arch archives fail before replacing the installed binary" test_install_pulse_archive_rejects_mismatched_arch_without_replacing_existing_binary
assert_success "parse_args rejects archive with source builds" test_parse_args_rejects_archive_with_source
assert_success "installer supports curl-pipe execution via bash stdin" test_installer_runs_when_streamed_over_stdin