@@ -5,13 +5,49 @@ $(RELEASE_DIR):
55 mkdir -p $(RELEASE_DIR ) /
66
77MANIFESTS_GEN := go run ./vendor/github.com/openshift/cluster-capi-operator/manifests-gen/
8+ YQ := go run github.com/mikefarah/yq/v4@v4.48.1
89
910.PHONY : check-env
1011check-env :
1112ifndef PROVIDER_VERSION
1213 $(error PROVIDER_VERSION is undefined)
1314endif
1415
16+ .PHONY : verify
17+ verify : verify-ocp-manifests
18+
19+ # NOTE: This target extracts the provider version from the existing generated manifest
20+ # and uses it for regeneration. This means the version label itself is NOT verified,
21+ # only that the rest of the manifest structure is correct.
22+ MANIFEST_FILE := manifests/0000_30_cluster-api_04_cm.infrastructure-aws.yaml
23+ .PHONY : verify-ocp-manifests
24+ verify-ocp-manifests :
25+ @echo " Extracting provider version from existing manifest..."
26+ $(eval PROVIDER_VERSION := $(shell ${YQ} eval '.metadata.labels."provider.cluster.x-k8s.io/version"' $(MANIFEST_FILE ) ) )
27+ @if [ -z " $( PROVIDER_VERSION) " ]; then \
28+ echo " Error: Could not extract provider version from $( MANIFEST_FILE) " ; \
29+ exit 1; \
30+ fi
31+ @echo " Using PROVIDER_VERSION=$( PROVIDER_VERSION) for verification"
32+ @$(MAKE ) ocp-manifests PROVIDER_VERSION=$(PROVIDER_VERSION ) || { \
33+ echo " Error: Failed to generate manifests" ; \
34+ exit 1; \
35+ }
36+ @if ./verify-diff.sh; then \
37+ echo " " ; \
38+ echo " Verification successful! Manifests are in sync." ; \
39+ else \
40+ git restore $(MANIFEST_FILE ) ; \
41+ echo " " ; \
42+ echo " Verification failed! Manifests are out of sync." ; \
43+ echo " Please run:" ; \
44+ echo " PROVIDER_VERSION=<release-version> make ocp-manifests" ; \
45+ echo " " ; \
46+ echo " Where <release-version> is the desired upstream release version tag (e.g., v2.9.2)" ; \
47+ echo " that matches the upstream version the OpenShift fork is based on." ; \
48+ exit 1; \
49+ fi
50+
1551.PHONY : update-manifests-gen
1652update-manifests-gen :
1753 cd tools && go get github.com/openshift/cluster-capi-operator/manifests-gen && go mod tidy && go mod vendor
0 commit comments