Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Bind parsed manual channels through installer execution

pulse-triage[bot]493e0b5fa989
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 5c52503cd7..9c86a3aada 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -5197,11 +5197,15 @@ missing jq stops before downloading or executing the installer, with explicit
`--stable`/`--rc` recovery guidance and no configuration rewrite. A missing file
retains the default. Explicit existing selectors (including `--prerelease`)
and the existing source-build marker keep precedence over saved configuration.
+The helper forwards both parsed channels explicitly, including the stable
+default for an existing file, so the containing installer cannot reinterpret
+that same configuration through its older saved-preference reader.
`TestManualUpdateChannelAdmission` generates and executes the actual helper
against local transport fixtures and genuinely signed installer/sidecar bytes.
-It checks final arguments, pre-download refusal, configuration preservation,
-selector/marker precedence and signature rejection. This is bounded source
+It checks final arguments and the actual installer channel-selection functions,
+pre-download refusal, configuration preservation, selector/marker precedence
+and signature rejection. This is bounded source
acceptance, not installed upgrade, native service restoration or published
release acceptance. The installer, archive, signing, rollback and service gates
remain unchanged.
diff --git a/install.sh b/install.sh
index 8d2b3061bc..e2678b30ba 100755
--- a/install.sh
+++ b/install.sh
@@ -4079,6 +4079,10 @@ if [[ "\$auto_selector_allowed" == "true" ]]; then
fi
if [[ "\$configured_channel" == "rc" ]]; then
extra_args+=(--rc)
+ else
+ # Bind the parsed default too: the installer has its own saved
+ # preference reader, which must not re-interpret the same file.
+ extra_args+=(--stable)
fi
fi
fi
diff --git a/scripts/installtests/install_sh_test.go b/scripts/installtests/install_sh_test.go
index a162387152..55efa1a672 100644
--- a/scripts/installtests/install_sh_test.go
+++ b/scripts/installtests/install_sh_test.go
@@ -4375,6 +4375,9 @@ func TestSetupUpdateCommandHonorsRCChannelAndCustomPaths(t *testing.T) {
if !strings.Contains(got, `extra_args+=(--rc)`) {
t.Fatalf("update helper missing rc channel forwarding:\n%s", got)
}
+ if !strings.Contains(got, `extra_args+=(--stable)`) {
+ t.Fatalf("update helper must bind the parsed stable channel before the installer rereads configuration:\n%s", got)
+ }
if !strings.Contains(got, `INSTALLER_URL="https://github.com/example/pulse-fork/releases/latest/download/install.sh"`) {
t.Fatalf("update helper missing configured repo installer url:\n%s", got)
}
diff --git a/scripts/installtests/manual_update_channel_test.go b/scripts/installtests/manual_update_channel_test.go
index 83791b1c1d..13efa987f5 100644
--- a/scripts/installtests/manual_update_channel_test.go
+++ b/scripts/installtests/manual_update_channel_test.go
@@ -5,6 +5,7 @@ import (
"os/exec"
"path/filepath"
"reflect"
+ "regexp"
"strings"
"testing"
)
@@ -35,8 +36,40 @@ func TestManualUpdateChannelAdmission(t *testing.T) {
if err != nil {
t.Fatal(err)
}
+ rootSource, err := os.ReadFile(source)
+ if err != nil {
+ t.Fatal(err)
+ }
+ selectionFunctions := ""
+ for _, name := range []string{"read_configured_update_channel", "selected_update_channel"} {
+ body := regexp.MustCompile(`(?ms)^` + name + `\(\) \{\n.*?^\}`).Find(rootSource)
+ if body == nil {
+ t.Fatalf("cannot find actual installer channel function %s", name)
+ }
+ selectionFunctions += string(body) + "\n"
+ }
installer := filepath.Join(assets, "install.sh")
- if err := os.WriteFile(installer, []byte("#!/bin/bash\nset -eu\nprintf '%s\\n' EXECUTED \"$@\" > \"$MANUAL_UPDATE_CALLS\"\n"), 0600); err != nil {
+ // The real installer reads configuration again unless the helper forwards
+ // an explicit channel. Use its actual selection functions to catch that
+ // crossing rather than accepting helper arguments alone as the outcome.
+ fixture := `#!/bin/bash
+set -eu
+CONFIG_DIR="$PULSE_CONFIG_DIR"
+FORCE_CHANNEL=""
+FORCE_VERSION=""
+UPDATE_CHANNEL=""
+IGNORE_CONFIGURED_UPDATE_CHANNEL=false
+` + selectionFunctions + `
+for arg in "$@"; do
+ case "$arg" in
+ --stable) FORCE_CHANNEL=stable ;;
+ --rc|--pre|--prerelease) FORCE_CHANNEL=rc ;;
+ esac
+done
+printf '%s\n' EXECUTED "$@" > "$MANUAL_UPDATE_CALLS"
+selected_update_channel > "$MANUAL_UPDATE_CHANNEL"
+`
+ if err := os.WriteFile(installer, []byte(fixture), 0600); err != nil {
t.Fatal(err)
}
if out, err := exec.Command("ssh-keygen", "-q", "-Y", "sign", "-f", key, "-n", "pulse-install", installer).CombinedOutput(); err != nil {
@@ -53,19 +86,19 @@ func TestManualUpdateChannelAdmission(t *testing.T) {
brokenLink bool
badSignature bool
}{
- {name: "stable", config: `{"updateChannel":"stable"}`},
+ {name: "stable", config: `{"updateChannel":"stable"}`, want: []string{"--stable"}},
{name: "rc", config: `{"updateChannel":"rc"}`, want: []string{"--rc"}},
{name: "normalized_rc", config: `{"updateChannel":" RC "}`, want: []string{"--rc"}},
- {name: "normalized_stable", config: `{"updateChannel":" STABLE "}`},
- {name: "missing_setting", config: `{}`},
- {name: "null_setting", config: `{"updateChannel":null}`},
- {name: "empty_setting", config: `{"updateChannel":" "}`},
+ {name: "normalized_stable", config: `{"updateChannel":" STABLE "}`, want: []string{"--stable"}},
+ {name: "missing_setting", config: `{}`, want: []string{"--stable"}},
+ {name: "null_setting", config: `{"updateChannel":null}`, want: []string{"--stable"}},
+ {name: "empty_setting", config: `{"updateChannel":" "}`, want: []string{"--stable"}},
{name: "missing_file", missingConfig: true},
- {name: "nested_only", config: `{"other":{"updateChannel":"rc"}}`},
- {name: "stable_with_nested_rc", config: `{"updateChannel":"stable","other":{"updateChannel":"rc"}}`},
+ {name: "nested_only", config: `{"other":{"updateChannel":"rc"}}`, want: []string{"--stable"}},
+ {name: "stable_with_nested_rc", config: `{"updateChannel":"stable","other":{"updateChannel":"rc"}}`, want: []string{"--stable"}},
{name: "rc_with_nested_stable", config: `{"updateChannel":"rc","other":{"updateChannel":"stable"}}`, want: []string{"--rc"}},
{name: "escaped_setting_name", config: `{"update\u0043hannel":"rc"}`, want: []string{"--rc"}},
- {name: "quoted_only", config: `{"note":"\"updateChannel\":\"rc\""}`},
+ {name: "quoted_only", config: `{"note":"\"updateChannel\":\"rc\""}`, want: []string{"--stable"}},
{name: "truncated", config: `{"updateChannel":"rc"`, blocked: true},
{name: "valid_object_then_garbage", config: `{"updateChannel":"rc"} trailing`, blocked: true},
{name: "two_objects", config: `{"updateChannel":"stable"} {"updateChannel":"rc"}`, blocked: true},
@@ -157,8 +190,9 @@ esac
}
calls := filepath.Join(dir, "calls")
transport := filepath.Join(dir, "transport")
+ channel := filepath.Join(dir, "channel")
cmd := exec.Command(bash, append([]string{helper}, tc.args...)...)
- cmd.Env = append(os.Environ(), "PATH="+path, "FIXTURE_ASSETS="+assets, "MANUAL_UPDATE_CALLS="+calls, "MANUAL_UPDATE_TRANSPORT="+transport,
+ cmd.Env = append(os.Environ(), "PATH="+path, "FIXTURE_ASSETS="+assets, "MANUAL_UPDATE_CALLS="+calls, "MANUAL_UPDATE_TRANSPORT="+transport, "MANUAL_UPDATE_CHANNEL="+channel,
"BAD_SIGNATURE="+map[bool]string{true: "true", false: "false"}[tc.badSignature])
out, runErr := cmd.CombinedOutput()
if tc.blocked {
@@ -188,6 +222,16 @@ esac
if !reflect.DeepEqual(strings.Split(strings.TrimSuffix(string(got), "\n"), "\n"), want) {
t.Fatalf("installer args %q, want %q", got, want)
}
+ selected, err := os.ReadFile(channel)
+ wantChannel := "stable"
+ for _, arg := range tc.want {
+ if arg == "--rc" || arg == "--prerelease" {
+ wantChannel = "rc"
+ }
+ }
+ if err != nil || strings.TrimSpace(string(selected)) != wantChannel {
+ t.Fatalf("installer selected %q: %v, want %s", selected, err, wantChannel)
+ }
}
if !tc.missingConfig && !tc.directory && !tc.brokenLink {
got, err := os.ReadFile(configPath)