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.

Fix stable installer prerelease selection

rcourtmanc27814d1901e
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 0934ff787d..ba2361b235 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -62,41 +62,42 @@ server-side update execution surfaces.
38. `scripts/hot-dev-bg.sh`
39. `scripts/hot-dev.sh`
40. `scripts/install-container-agent.sh`
-41. `scripts/install.ps1`
-42. `scripts/install.sh`
-43. `scripts/pulse-auto-update.sh`
-44. `scripts/release_control/internal/record_rc_to_ga_rehearsal.py`
-45. `scripts/release_control/record_rc_to_ga_rehearsal.py`
-46. `scripts/release_control/release_promotion_policy_support.py`
-47. `scripts/release_control/resolve_release_promotion.py`
-48. `scripts/release_ldflags.sh`
-49. `scripts/run_cloud_public_signup_smoke.sh`
-50. `scripts/run_demo_public_browser_smoke.sh`
-51. `scripts/demo_public_browser_smoke.cjs`
-52. `scripts/run_hosted_staging_smoke.sh`
-53. `scripts/trigger-release-dry-run.sh`
-54. `scripts/trigger-release.sh`
-55. `scripts/toggle-mock.sh`
-56. `deploy/helm/pulse/`
-57. `tests/integration/playwright.config.ts`
-58. `tests/integration/QUICK_START.md`
-59. `tests/integration/README.md`
-60. `tests/integration/scripts/bootstrap-hosted-mobile-onboarding.mjs`
-61. `tests/integration/scripts/hosted-mobile-token-runtime.mjs`
-62. `tests/integration/scripts/hosted-tenant-approval-store.mjs`
-63. `tests/integration/scripts/hosted-tenant-runtime.mjs`
-64. `tests/integration/scripts/hosted-tenant-runtime-restart.mjs`
-65. `tests/integration/scripts/managed-dev-runtime.mjs`
-66. `tests/integration/scripts/relay-mobile-token-helper.go`
-67. `tests/integration/tests/helpers.ts`
-68. `tests/integration/tests/runtime-defaults.ts`
-67. `docker-compose.yml`
-68. `scripts/install-docker.sh`
-69. `scripts/validate-published-release.sh`
-69. `scripts/validate-release.sh`
-70. `scripts/release_asset_common.sh`
-71. `scripts/backfill-release-assets.sh`
-72. `.github/workflows/backfill-release-assets.yml`
+41. `install.sh`
+42. `scripts/install.ps1`
+43. `scripts/install.sh`
+44. `scripts/pulse-auto-update.sh`
+45. `scripts/release_control/internal/record_rc_to_ga_rehearsal.py`
+46. `scripts/release_control/record_rc_to_ga_rehearsal.py`
+47. `scripts/release_control/release_promotion_policy_support.py`
+48. `scripts/release_control/resolve_release_promotion.py`
+49. `scripts/release_ldflags.sh`
+50. `scripts/run_cloud_public_signup_smoke.sh`
+51. `scripts/run_demo_public_browser_smoke.sh`
+52. `scripts/demo_public_browser_smoke.cjs`
+53. `scripts/run_hosted_staging_smoke.sh`
+54. `scripts/trigger-release-dry-run.sh`
+55. `scripts/trigger-release.sh`
+56. `scripts/toggle-mock.sh`
+57. `deploy/helm/pulse/`
+58. `tests/integration/playwright.config.ts`
+59. `tests/integration/QUICK_START.md`
+60. `tests/integration/README.md`
+61. `tests/integration/scripts/bootstrap-hosted-mobile-onboarding.mjs`
+62. `tests/integration/scripts/hosted-mobile-token-runtime.mjs`
+63. `tests/integration/scripts/hosted-tenant-approval-store.mjs`
+64. `tests/integration/scripts/hosted-tenant-runtime.mjs`
+65. `tests/integration/scripts/hosted-tenant-runtime-restart.mjs`
+66. `tests/integration/scripts/managed-dev-runtime.mjs`
+67. `tests/integration/scripts/relay-mobile-token-helper.go`
+68. `tests/integration/tests/helpers.ts`
+69. `tests/integration/tests/runtime-defaults.ts`
+70. `docker-compose.yml`
+71. `scripts/install-docker.sh`
+72. `scripts/validate-published-release.sh`
+73. `scripts/validate-release.sh`
+74. `scripts/release_asset_common.sh`
+75. `scripts/backfill-release-assets.sh`
+76. `.github/workflows/backfill-release-assets.yml`
## Shared Boundaries
@@ -115,7 +116,7 @@ server-side update execution surfaces.
1. Add or change deployment-type detection, update planning, or apply behavior through `internal/updates/`
2. Add or change release-build metadata injection, Docker build-context allowlists, release artifact assembly, governed promotion metadata resolution, the canonical version file, operator-facing release packet content, prerelease feedback intake wording, historical published-release integrity backfill, release asset validation status publication, download endpoint checksum/signature header proof, or the canonical in-repo v6 upgrade guide through `scripts/build-release.sh`, `scripts/release_asset_common.sh`, `scripts/backfill-release-assets.sh`, `scripts/release_ldflags.sh`, `scripts/check-workflow-dispatch-inputs.py`, `scripts/release_control/render_release_body.py`, `scripts/release_control/resolve_release_promotion.py`, `scripts/release_control/record_rc_to_ga_rehearsal.py`, `scripts/release_control/internal/record_rc_to_ga_rehearsal.py`, `scripts/release_control/release_promotion_policy_support.py`, `.dockerignore`, `Dockerfile`, `.github/ISSUE_TEMPLATE/v6_rc_feedback.yml`, `docs/RELEASE_NOTES.md`, `docs/releases/`, `docs/UPGRADE_v6.md`, `docs/release-control/v6/internal/RELEASE_PROMOTION_POLICY.md`, `docs/release-control/v6/internal/PRE_RELEASE_CHECKLIST.md`, `docs/release-control/v6/internal/RC_TO_GA_REHEARSAL_TEMPLATE.md`, `scripts/validate-release.sh`, `scripts/validate-published-release.sh`, the operator dispatch helpers `scripts/trigger-release.sh` and `scripts/trigger-release-dry-run.sh`, and the governed release workflows `.github/workflows/backfill-release-assets.yml`, `.github/workflows/create-release.yml`, `.github/workflows/deploy-demo-server.yml`, `.github/workflows/helm-pages.yml`, `.github/workflows/publish-docker.yml`, `.github/workflows/publish-helm-chart.yml`, `.github/workflows/promote-floating-tags.yml`, `.github/workflows/release-dry-run.yml`, `.github/workflows/update-demo-server.yml`, and `.github/workflows/validate-release-assets.yml`
-3. Add or change shell installer, Docker bootstrap installer, Windows installer, container-agent installer, repo-root compose defaults, or auto-update script behavior through `scripts/install.sh`, `scripts/install-docker.sh`, `scripts/install.ps1`, `scripts/install-container-agent.sh`, `docker-compose.yml`, and `scripts/pulse-auto-update.sh`
+3. Add or change root server installer, shell installer, Docker bootstrap installer, Windows installer, container-agent installer, repo-root compose defaults, or auto-update script behavior through `install.sh`, `scripts/install.sh`, `scripts/install-docker.sh`, `scripts/install.ps1`, `scripts/install-container-agent.sh`, `docker-compose.yml`, and `scripts/pulse-auto-update.sh`
4. Add or change server update transport through `internal/api/updates.go` and `frontend-modern/src/api/updates.ts`
5. Add or change local dev-runtime orchestration, managed ownership, browser-runtime proof wiring, frontend/backend coherence diagnostics, canonical developer entry wrappers, dependency manifest floors, frontend build chunking, or dev-runtime helper control surfaces through `scripts/hot-dev.sh`, `scripts/hot-dev-bg.sh`, `scripts/dev-deploy-agent.sh`, `Makefile`, `package.json`, `package-lock.json`, `frontend-modern/package.json`, `frontend-modern/package-lock.json`, `frontend-modern/vite.config.ts`, `go.mod`, `go.sum`, `scripts/dev-check.sh`, `scripts/toggle-mock.sh`, `scripts/clean-mock-alerts.sh`, `scripts/dev-launchd-setup.sh`, `scripts/dev-launchd-wrapper.sh`, `scripts/run_demo_public_browser_smoke.sh`, `scripts/demo_public_browser_smoke.cjs`, `scripts/com.pulse.hot-dev.plist.template`, `tests/integration/scripts/managed-dev-runtime.mjs`, `tests/integration/playwright.config.ts`, `tests/integration/tests/helpers.ts`, `tests/integration/tests/runtime-defaults.ts`, `tests/integration/README.md`, and `tests/integration/QUICK_START.md`
6. Add or change governed release-promotion workflow inputs, operator-facing promotion metadata, the canonical version file, prerelease feedback intake prompts, artifact publication lineage enforcement, release note or changelog packet composition, or stable-promotion rehearsal summaries through `.github/workflows/create-release.yml`, `.github/workflows/helm-pages.yml`, `.github/workflows/publish-docker.yml`, `.github/workflows/publish-helm-chart.yml`, `.github/workflows/promote-floating-tags.yml`, `.github/workflows/release-dry-run.yml`, `.github/workflows/update-demo-server.yml`, `.github/ISSUE_TEMPLATE/v6_rc_feedback.yml`, `docs/RELEASE_NOTES.md`, `docs/releases/`, `docs/release-control/v6/internal/RELEASE_PROMOTION_POLICY.md`, `docs/release-control/v6/internal/PRE_RELEASE_CHECKLIST.md`, `docs/release-control/v6/internal/RC_TO_GA_REHEARSAL_TEMPLATE.md`, `scripts/check-workflow-dispatch-inputs.py`, `scripts/release_control/render_release_body.py`, `scripts/release_control/record_rc_to_ga_rehearsal.py`, `scripts/release_control/internal/record_rc_to_ga_rehearsal.py`, `scripts/release_control/release_promotion_policy_support.py`, `scripts/trigger-release.sh`, and `scripts/trigger-release-dry-run.sh`
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index 532effc481..2d70c18eb7 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -2670,6 +2670,7 @@
"frontend-modern/vite.config.ts",
"go.mod",
"go.sum",
+ "install.sh",
"internal/api/updates.go",
"internal/cloudcp/docker/labels.go",
"internal/cloudcp/docker/manager.go",
@@ -2885,6 +2886,7 @@
"match_prefixes": [],
"match_files": [
"docker-compose.yml",
+ "install.sh",
"scripts/install-container-agent.sh",
"scripts/install-docker.sh",
"scripts/install.ps1",
diff --git a/install.sh b/install.sh
index 038a750245..8d5dad7f3d 100755
--- a/install.sh
+++ b/install.sh
@@ -284,6 +284,35 @@ get_latest_release_from_redirect() {
return 0
}
+is_stable_release_tag() {
+ local tag="${1:-}"
+ tag="${tag#v}"
+
+ [[ "$tag" =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]]
+}
+
+latest_stable_release_tag_from_json() {
+ local releases_json="${1:-}"
+ local latest_release=""
+
+ if [[ -z "$releases_json" ]]; then
+ return 1
+ fi
+
+ if command -v jq >/dev/null 2>&1; then
+ latest_release=$(printf '%s' "$releases_json" | jq -r '[.[] | select(.draft == false and .prerelease == false and (.tag_name | test("^v?[0-9]+\\.[0-9]+\\.[0-9]+$")))][0].tag_name // empty' 2>/dev/null || true)
+ else
+ latest_release=$(printf '%s' "$releases_json" | grep -oE '"tag_name":[[:space:]]*"v?[0-9]+\.[0-9]+\.[0-9]+"' | head -1 | sed -E 's/.*"([^"]+)".*/\1/' || true)
+ fi
+
+ if is_stable_release_tag "$latest_release"; then
+ printf '%s\n' "$latest_release"
+ return 0
+ fi
+
+ return 1
+}
+
read_configured_update_channel() {
if [[ "${IGNORE_CONFIGURED_UPDATE_CHANNEL:-false}" == "true" ]]; then
return 1
@@ -310,7 +339,12 @@ resolve_install_script_download_url() {
local channel="${FORCE_CHANNEL:-${UPDATE_CHANNEL:-stable}}"
if [[ "$channel" != "rc" ]]; then
- printf 'https://github.com/%s/releases/latest/download/install.sh\n' "$GITHUB_REPO"
+ local stable_release=""
+ stable_release=$(resolve_latest_release_tag_for_channel stable 2>/dev/null || true)
+ if [[ -z "$stable_release" || "$stable_release" == "null" ]]; then
+ return 1
+ fi
+ printf 'https://github.com/%s/releases/download/%s/install.sh\n' "$GITHUB_REPO" "$stable_release"
return 0
fi
@@ -761,31 +795,24 @@ resolve_latest_release_tag_for_channel() {
local channel="${1:-stable}"
if [[ "$channel" != "rc" ]]; then
+ local releases_json=""
local stable_release=""
- stable_release=$(get_latest_release_from_redirect 2>/dev/null || true)
- if [[ -n "$stable_release" ]]; then
- printf '%s\n' "$stable_release"
- return 0
- fi
- local latest_json=""
if command -v timeout >/dev/null 2>&1; then
- latest_json=$(timeout 15 curl -fsSL --connect-timeout 10 --max-time 30 "https://api.github.com/repos/$GITHUB_REPO/releases/latest" 2>/dev/null || true)
+ releases_json=$(timeout 15 curl -fsSL --connect-timeout 10 --max-time 30 "https://api.github.com/repos/$GITHUB_REPO/releases" 2>/dev/null || true)
else
- latest_json=$(curl -fsSL --connect-timeout 10 --max-time 30 "https://api.github.com/repos/$GITHUB_REPO/releases/latest" 2>/dev/null || true)
+ releases_json=$(curl -fsSL --connect-timeout 10 --max-time 30 "https://api.github.com/repos/$GITHUB_REPO/releases" 2>/dev/null || true)
fi
- local latest_release=""
- if [[ -n "$latest_json" ]]; then
- if command -v jq >/dev/null 2>&1; then
- latest_release=$(echo "$latest_json" | jq -r '.tag_name' 2>/dev/null || true)
- else
- latest_release=$(echo "$latest_json" | grep '"tag_name":' | head -1 | sed -E 's/.*"([^"]+)".*/\1/' || true)
- fi
+ stable_release=$(latest_stable_release_tag_from_json "$releases_json" 2>/dev/null || true)
+ if [[ -n "$stable_release" ]]; then
+ printf '%s\n' "$stable_release"
+ return 0
fi
- if [[ -n "$latest_release" && "$latest_release" != "null" ]]; then
- printf '%s\n' "$latest_release"
+ stable_release=$(get_latest_release_from_redirect 2>/dev/null || true)
+ if is_stable_release_tag "$stable_release"; then
+ printf '%s\n' "$stable_release"
return 0
fi
@@ -2703,11 +2730,7 @@ resolve_target_release() {
LATEST_RELEASE=$(echo "$releases_json" | grep -v '"draft": true' | grep '"tag_name":' | head -1 | sed -E 's/.*"([^"]+)".*/\1/' || true)
fi
else
- if command -v jq >/dev/null 2>&1; then
- LATEST_RELEASE=$(echo "$releases_json" | jq -r '[.[] | select(.draft == false and .prerelease == false)][0].tag_name' 2>/dev/null || true)
- else
- LATEST_RELEASE=$(echo "$releases_json" | awk '/"draft": true/,/"tag_name":/ {next} /"prerelease": true/,/"tag_name":/ {next} /"tag_name":/ {print; exit}' | sed -E 's/.*"([^"]+)".*/\1/' || true)
- fi
+ LATEST_RELEASE=$(latest_stable_release_tag_from_json "$releases_json" 2>/dev/null || true)
fi
fi
@@ -2715,7 +2738,9 @@ resolve_target_release() {
print_info "GitHub API unavailable, trying alternative method..."
local redirect_version=""
redirect_version=$(get_latest_release_from_redirect 2>/dev/null || true)
- if [[ -n "$redirect_version" ]]; then
+ if [[ "$UPDATE_CHANNEL" == "rc" && -n "$redirect_version" ]]; then
+ LATEST_RELEASE="$redirect_version"
+ elif is_stable_release_tag "$redirect_version"; then
LATEST_RELEASE="$redirect_version"
fi
fi
@@ -4038,21 +4063,7 @@ main() {
# Get both stable and RC versions
# Try GitHub API first, but have a fallback - with timeout protection
local STABLE_VERSION=""
- if command -v timeout >/dev/null 2>&1; then
- STABLE_VERSION=$(timeout 10 curl -s --connect-timeout 5 --max-time 10 https://api.github.com/repos/$GITHUB_REPO/releases/latest 2>/dev/null | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' || true)
- else
- STABLE_VERSION=$(curl -s --connect-timeout 5 --max-time 10 https://api.github.com/repos/$GITHUB_REPO/releases/latest 2>/dev/null | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' || true)
- fi
-
- # If rate limited or failed, try direct GitHub latest URL
- if [[ -z "$STABLE_VERSION" ]] || [[ "$STABLE_VERSION" == *"rate limit"* ]]; then
- # Use the GitHub latest release redirect to get version
- local redirect_version=""
- redirect_version=$(get_latest_release_from_redirect 2>/dev/null || true)
- if [[ -n "$redirect_version" ]]; then
- STABLE_VERSION="$redirect_version"
- fi
- fi
+ STABLE_VERSION=$(resolve_latest_release_tag_for_channel stable 2>/dev/null || true)
# For RC, we need the API, so if it fails just use empty
local RC_VERSION=""
diff --git a/scripts/installtests/install_sh_test.go b/scripts/installtests/install_sh_test.go
index 34db748202..7b60495171 100644
--- a/scripts/installtests/install_sh_test.go
+++ b/scripts/installtests/install_sh_test.go
@@ -1286,6 +1286,156 @@ func TestResolveInstallScriptDownloadURLUsesForcedVersion(t *testing.T) {
}
}
+func TestRootInstallStableReleaseTagRejectsPrereleaseShapes(t *testing.T) {
+ script := `
+` + extractRootInstallShellFunction(t, "is_stable_release_tag") + `
+ if ! is_stable_release_tag v5.1.29; then
+ echo "rejected v-prefixed stable tag" >&2
+ exit 1
+ fi
+ if ! is_stable_release_tag 5.1.29; then
+ echo "rejected bare stable tag" >&2
+ exit 1
+ fi
+ if is_stable_release_tag v6.0.0-rc.2; then
+ echo "accepted rc tag" >&2
+ exit 1
+ fi
+ if is_stable_release_tag v6.0.0-beta.1; then
+ echo "accepted beta tag" >&2
+ exit 1
+ fi
+ if is_stable_release_tag latest; then
+ echo "accepted floating tag" >&2
+ exit 1
+ fi
+ `
+
+ out, err := exec.Command("bash", "-c", script).CombinedOutput()
+ if err != nil {
+ t.Fatalf("bash: %v\n%s", err, out)
+ }
+}
+
+func TestResolveLatestReleaseTagForStableChannelSkipsPrereleaseShapedTags(t *testing.T) {
+ tmpDir := t.TempDir()
+ timeoutPath := filepath.Join(tmpDir, "timeout")
+ curlPath := filepath.Join(tmpDir, "curl")
+
+ if err := os.WriteFile(timeoutPath, []byte("#!/usr/bin/env bash\nshift\nexec \"$@\"\n"), 0755); err != nil {
+ t.Fatalf("write timeout stub: %v", err)
+ }
+
+ curlStub := `#!/usr/bin/env bash
+for arg in "$@"; do
+ if [[ "$arg" == "https://api.github.com/repos/rcourtman/Pulse/releases" ]]; then
+ printf '%s\n' '[{"draft":false,"prerelease":false,"tag_name":"v6.0.0-rc.2"},{"draft":false,"prerelease":false,"tag_name":"v5.1.29"}]'
+ exit 0
+ fi
+done
+echo "unexpected curl invocation: $*" >&2
+exit 1
+`
+ if err := os.WriteFile(curlPath, []byte(curlStub), 0755); err != nil {
+ t.Fatalf("write curl stub: %v", err)
+ }
+
+ script := `
+ PATH="` + tmpDir + `:$PATH"
+ GITHUB_REPO="rcourtman/Pulse"
+ get_latest_release_from_redirect() {
+ printf '%s\n' v6.0.0-rc.2
+ }
+` + extractRootInstallShellFunction(t, "is_stable_release_tag") + `
+` + extractRootInstallShellFunction(t, "latest_stable_release_tag_from_json") + `
+` + extractRootInstallShellFunction(t, "resolve_latest_release_tag_for_channel") + `
+ resolve_latest_release_tag_for_channel stable
+ `
+
+ out, err := exec.Command("bash", "-c", script).CombinedOutput()
+ if err != nil {
+ t.Fatalf("bash: %v\n%s", err, out)
+ }
+
+ if got := strings.TrimSpace(string(out)); got != "v5.1.29" {
+ t.Fatalf("stable release = %q, want v5.1.29", got)
+ }
+}
+
+func TestResolveLatestReleaseTagForStableChannelRejectsPrereleaseRedirect(t *testing.T) {
+ script := `
+ GITHUB_REPO="rcourtman/Pulse"
+ curl() { return 1; }
+ timeout() { shift; "$@"; }
+ get_latest_release_from_redirect() {
+ printf '%s\n' v6.0.0-rc.2
+ }
+` + extractRootInstallShellFunction(t, "is_stable_release_tag") + `
+` + extractRootInstallShellFunction(t, "latest_stable_release_tag_from_json") + `
+` + extractRootInstallShellFunction(t, "resolve_latest_release_tag_for_channel") + `
+ if resolve_latest_release_tag_for_channel stable; then
+ echo "stable channel accepted prerelease redirect" >&2
+ exit 1
+ fi
+ `
+
+ out, err := exec.Command("bash", "-c", script).CombinedOutput()
+ if err != nil {
+ t.Fatalf("bash: %v\n%s", err, out)
+ }
+}
+
+func TestResolveInstallScriptDownloadURLUsesStableReleaseTag(t *testing.T) {
+ tmpDir := t.TempDir()
+ timeoutPath := filepath.Join(tmpDir, "timeout")
+ curlPath := filepath.Join(tmpDir, "curl")
+
+ if err := os.WriteFile(timeoutPath, []byte("#!/usr/bin/env bash\nshift\nexec \"$@\"\n"), 0755); err != nil {
+ t.Fatalf("write timeout stub: %v", err)
+ }
+
+ curlStub := `#!/usr/bin/env bash
+for arg in "$@"; do
+ if [[ "$arg" == "https://api.github.com/repos/rcourtman/Pulse/releases" ]]; then
+ printf '%s\n' '[{"draft":false,"prerelease":true,"tag_name":"v6.0.0-rc.2"},{"draft":false,"prerelease":false,"tag_name":"v5.1.29"}]'
+ exit 0
+ fi
+done
+echo "unexpected curl invocation: $*" >&2
+exit 1
+`
+ if err := os.WriteFile(curlPath, []byte(curlStub), 0755); err != nil {
+ t.Fatalf("write curl stub: %v", err)
+ }
+
+ script := `
+ PATH="` + tmpDir + `:$PATH"
+ GITHUB_REPO="rcourtman/Pulse"
+ FORCE_VERSION=""
+ FORCE_CHANNEL=""
+ UPDATE_CHANNEL=""
+ get_latest_release_from_redirect() {
+ printf '%s\n' v6.0.0-rc.2
+ }
+` + extractRootInstallShellFunction(t, "is_stable_release_tag") + `
+` + extractRootInstallShellFunction(t, "latest_stable_release_tag_from_json") + `
+` + extractRootInstallShellFunction(t, "resolve_latest_release_tag_for_channel") + `
+` + extractRootInstallShellFunction(t, "resolve_install_script_download_url") + `
+ resolve_install_script_download_url
+ `
+
+ out, err := exec.Command("bash", "-c", script).CombinedOutput()
+ if err != nil {
+ t.Fatalf("bash: %v\n%s", err, out)
+ }
+
+ got := strings.TrimSpace(string(out))
+ want := "https://github.com/rcourtman/Pulse/releases/download/v5.1.29/install.sh"
+ if got != want {
+ t.Fatalf("download url = %q, want %q", got, want)
+ }
+}
+
func TestResolveInstallScriptDownloadURLUsesRCReleaseTag(t *testing.T) {
tmpDir := t.TempDir()
timeoutPath := filepath.Join(tmpDir, "timeout")
@@ -1940,6 +2090,8 @@ func TestRepoDockerDocsURLFallsBackToReleaseLandingPageWhenVersionUnknown(t *tes
curl() { return 1; }
timeout() { return 1; }
` + extractRootInstallShellFunction(t, "repo_web_url") + `
+` + extractRootInstallShellFunction(t, "is_stable_release_tag") + `
+` + extractRootInstallShellFunction(t, "latest_stable_release_tag_from_json") + `
` + extractRootInstallShellFunction(t, "resolve_latest_release_tag_for_channel") + `
` + extractRootInstallShellFunction(t, "repo_release_docs_ref") + `
` + extractRootInstallShellFunction(t, "repo_docs_url_for_path") + `
@@ -2196,7 +2348,7 @@ func TestResolveTargetReleaseIgnoresHostConfiguredRCChannelForFreshLXCInstall(t
curlStub := `#!/usr/bin/env bash
for arg in "$@"; do
if [[ "$arg" == "https://api.github.com/repos/rcourtman/Pulse/releases" ]]; then
- printf '%s\n' '[{"draft":false,"prerelease":true,"tag_name":"v6.0.0-rc.1"},{"draft":false,"prerelease":false,"tag_name":"v5.1.28"}]'
+ printf '%s\n' '[{"draft":false,"prerelease":false,"tag_name":"v6.0.0-rc.1"},{"draft":false,"prerelease":false,"tag_name":"v5.1.28"}]'
exit 0
fi
done
@@ -2219,6 +2371,8 @@ exit 1
print_warn() { :; }
get_latest_release_from_redirect() { return 1; }
` + extractRootInstallShellFunction(t, "read_configured_update_channel") + `
+` + extractRootInstallShellFunction(t, "is_stable_release_tag") + `
+` + extractRootInstallShellFunction(t, "latest_stable_release_tag_from_json") + `
` + extractRootInstallShellFunction(t, "resolve_target_release") + `
resolve_target_release
printf '%s\n' "$LATEST_RELEASE"