Skip to content

Commit e724e97

Browse files
wikkykclaude
andcommitted
feat: cross-check capmox release files in verify-versions
Catch drift between the four files release.sh updates together: - clusterctl-settings.json (nextVersion) and sonar-project.properties (projectVersion) must match after stripping the v-prefix - clusterctl nextVersion's major.minor must be listed in metadata.yaml releaseSeries - the capmox sentinel in test/e2e/config/proxmox-*.yaml must equal v{major}.{minor}.99 for that same major.minor Pre-release suffixes (-rc.0, -beta.1, ...) are stripped from clusterctl nextVersion before checking major.minor. Co-authored-by: Claude <noreply@anthropic.com>
1 parent e97611f commit e724e97

2 files changed

Lines changed: 66 additions & 0 deletions

File tree

hack/spec/verify_versions_spec.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,34 @@ Describe 'verify-versions.sh'
8080
The status should be failure
8181
The output should include 'k8s.io/code-generator version mismatch'
8282
End
83+
84+
It 'detects capmox clusterctl/sonar drift'
85+
sonar_set_version '0.8.2' >/dev/null
86+
When run script ../verify-versions.sh
87+
The status should be failure
88+
The output should include 'capmox version mismatch'
89+
End
90+
91+
It 'detects capmox major.minor not listed in metadata.yaml'
92+
clusterctl_set_version 'v0.99.0' >/dev/null
93+
sonar_set_version '0.99.0' >/dev/null
94+
e2econfig_set_capmox 'v0.99.99' >/dev/null
95+
When run script ../verify-versions.sh
96+
The status should be failure
97+
The output should include 'v0.99 is not listed in metadata.yaml'
98+
End
99+
100+
It 'detects capmox e2e sentinel mismatch'
101+
e2econfig_set_capmox 'v0.7.99' >/dev/null
102+
When run script ../verify-versions.sh
103+
The status should be failure
104+
The output should include 'capmox e2e sentinel mismatch'
105+
End
106+
107+
It 'accepts a pre-release clusterctl version whose core is in metadata'
108+
clusterctl_set_version 'v0.8.2-rc.0' >/dev/null
109+
sonar_set_version '0.8.2-rc.0' >/dev/null
110+
When run script ../verify-versions.sh
111+
The status should be success
112+
End
83113
End

hack/verify-versions.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,42 @@ if [[ -n "${CAPI_REQUIRE}" && -n "${E2E_CAPI_VER}" ]]; then
145145
fi
146146
fi
147147

148+
# ---- capmox release version consistency ----
149+
# clusterctl-settings.json (nextVersion), sonar-project.properties
150+
# (projectVersion), metadata.yaml (releaseSeries), and the e2e sentinel
151+
# must all agree on the upcoming release's major.minor. release.sh keeps
152+
# them in sync; this check catches drift.
153+
154+
CAPMOX_NEXT=$(clusterctl_get_version)
155+
CAPMOX_SONAR=$(sonar_get_version)
156+
CAPMOX_SENTINEL=$(e2econfig_get_capmox)
157+
158+
if [[ -n "${CAPMOX_NEXT}" && -n "${CAPMOX_SONAR}" ]]; then
159+
# clusterctl carries the v-prefix, sonar does not — strip before compare.
160+
if [[ "$(strip_v_prefix "${CAPMOX_NEXT}")" != "${CAPMOX_SONAR}" ]]; then
161+
fail "capmox version mismatch: clusterctl-settings.json has '${CAPMOX_NEXT}', sonar-project.properties has '${CAPMOX_SONAR}'"
162+
fi
163+
fi
164+
165+
if [[ -n "${CAPMOX_NEXT}" ]]; then
166+
# Strip any pre-release suffix (-rc.0, -beta.1, ...) to compare major.minor.
167+
CAPMOX_CORE="${CAPMOX_NEXT%%-*}"
168+
split_version "${CAPMOX_CORE}"
169+
CAPMOX_MAJOR="${MAJOR}"
170+
CAPMOX_MINOR="${MINOR}"
171+
172+
if ! metadata_has_release "${CAPMOX_MAJOR}" "${CAPMOX_MINOR}"; then
173+
fail "capmox v${CAPMOX_MAJOR}.${CAPMOX_MINOR} is not listed in metadata.yaml"
174+
fi
175+
176+
if [[ -n "${CAPMOX_SENTINEL}" ]]; then
177+
EXPECTED_SENTINEL="v${CAPMOX_MAJOR}.${CAPMOX_MINOR}.99"
178+
if versions_differ "${CAPMOX_SENTINEL}" "${EXPECTED_SENTINEL}"; then
179+
fail "capmox e2e sentinel mismatch: clusterctl-settings.json is '${CAPMOX_NEXT}', expected sentinel '${EXPECTED_SENTINEL}' but e2e config has '${CAPMOX_SENTINEL}'"
180+
fi
181+
fi
182+
fi
183+
148184
# ---- Report results ----
149185

150186
if [[ ${#ERRORS[@]} -gt 0 ]]; then

0 commit comments

Comments
 (0)