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.

Classify every 0.0.0 sentinel build as a development build

Richard Courtmanb581de89d24b
diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.md
index 2ad16bccff..fbb17d3a95 100644
--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md
+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md
@@ -3102,6 +3102,16 @@ strings into normalized release identity fields for browser preview payloads
and operator telemetry reporting, so unpublished `git describe` / manual / dev
builds cannot pollute published stable or RC adoption reads just because they
share a semver-looking prefix.
+The development flag in that identity is defined by the `0.0.0` sentinel, not
+by prerelease spelling. `normalizeVersionString` assigns `0.0.0-<sanitized>` to
+every build string it cannot parse as a release version, so any version whose
+major, minor, and patch are all zero must report `version_channel` `dev` and
+`version_is_development` true, and must never simultaneously report as a
+published release — including a sentinel that happens to spell a preview stage,
+such as `0.0.0-rc.1`. Matching only the prerelease texts `dev` and `dev.*` left
+`0.0.0-test-version`, `0.0.0-dev-pro`, and `0.0.0-qual-*` reporting as ordinary
+prereleases with the development flag clear, so a receiver-side read that
+filtered on that flag alone kept counting them as real installations.
That release-build metadata path is now explicit too: `scripts/release_ldflags.sh`
is the canonical owner for server and agent build ldflags, and release artifact
assembly must route through it instead of hand-writing overlapping `main.Version`,
diff --git a/internal/updates/version.go b/internal/updates/version.go
index b0706a5204..ae3d5afa9a 100644
--- a/internal/updates/version.go
+++ b/internal/updates/version.go
@@ -296,7 +296,10 @@ func DescribeUsageDataVersion(raw string) UsageDataVersionIdentity {
identity.Build = parsed.Build
identity.Channel = usageDataVersionChannel(parsed)
identity.IsDevelopment = identity.Channel == "dev"
- identity.IsPublishedRelease = parsed.IsPublishedReleaseAssetVersion()
+ // A development build is never a published release. Without this the 0.0.0
+ // sentinel "0.0.0-rc.1" would satisfy IsPublishedReleaseAssetVersion and
+ // report both flags at once, which no real install can be.
+ identity.IsPublishedRelease = !identity.IsDevelopment && parsed.IsPublishedReleaseAssetVersion()
return identity
}
@@ -431,6 +434,17 @@ func detectChannelFromVersion(version string) string {
return "stable"
}
+// developmentSentinelVersion reports whether a version carries the 0.0.0
+// sentinel normalizeVersionString assigns to any build string it cannot parse
+// as a release version: a branch name, an ad-hoc test or qualification label,
+// or an empty VERSION file. Pulse never publishes a 0.0.0 release, so such a
+// build is a development build whatever its prerelease text happens to spell,
+// and the check has to precede the prerelease classification rather than fall
+// through to it.
+func developmentSentinelVersion(version *Version) bool {
+ return version != nil && version.Major == 0 && version.Minor == 0 && version.Patch == 0
+}
+
func usageDataVersionChannel(version *Version) string {
if version == nil {
return "unknown"
@@ -438,6 +452,8 @@ func usageDataVersionChannel(version *Version) string {
switch {
case version.Build != "":
return "dev"
+ case developmentSentinelVersion(version):
+ return "dev"
case version.IsPreviewPrerelease():
return version.PreviewStage()
case version.Prerelease == "":
diff --git a/internal/updates/version_test.go b/internal/updates/version_test.go
index 769d32b50f..2220d9cbcc 100644
--- a/internal/updates/version_test.go
+++ b/internal/updates/version_test.go
@@ -324,12 +324,63 @@ func TestDescribeUsageDataVersion(t *testing.T) {
wantPublished: false,
},
{
- name: "source branch falls back to prerelease dev identity",
+ name: "source branch is a development build",
input: "feature/new-usage-report",
wantVersion: "0.0.0-feature-new-usage-report",
wantRaw: "feature/new-usage-report",
- wantChannel: "prerelease",
- wantDevelopment: false,
+ wantChannel: "dev",
+ wantDevelopment: true,
+ wantPublished: false,
+ },
+ {
+ // The literal pkg/server tests passed to Run(). It reported
+ // version_is_development = 0 for 317 installs before the 0.0.0
+ // sentinel was classified as development.
+ name: "ad-hoc test label is a development build",
+ input: "test-version",
+ wantVersion: "0.0.0-test-version",
+ wantRaw: "test-version",
+ wantChannel: "dev",
+ wantDevelopment: true,
+ wantPublished: false,
+ },
+ {
+ // "dev-pro" is not "dev" and does not start with "dev.", so the
+ // prerelease-text rules alone never caught it.
+ name: "dev-pro label is a development build",
+ input: "dev-pro",
+ wantVersion: "0.0.0-dev-pro",
+ wantRaw: "dev-pro",
+ wantChannel: "dev",
+ wantDevelopment: true,
+ wantPublished: false,
+ },
+ {
+ name: "qualification label is a development build",
+ input: "qual-87699dfff-810aae8d2",
+ wantVersion: "0.0.0-qual-87699dfff-810aae8d2",
+ wantRaw: "qual-87699dfff-810aae8d2",
+ wantChannel: "dev",
+ wantDevelopment: true,
+ wantPublished: false,
+ },
+ {
+ // The sentinel outranks the preview-stage rule: a 0.0.0 build is
+ // never a published release asset, so it must not report as both.
+ name: "sentinel outranks a preview prerelease spelling",
+ input: "rc.1",
+ wantVersion: "0.0.0-rc.1",
+ wantRaw: "rc.1",
+ wantChannel: "dev",
+ wantDevelopment: true,
+ wantPublished: false,
+ },
+ {
+ name: "empty version is a development build",
+ input: "",
+ wantVersion: "0.0.0-dev",
+ wantChannel: "dev",
+ wantDevelopment: true,
wantPublished: false,
},
{