Skip to content

Commit de2f314

Browse files
Enhance the makefile target check to skip CRDs that are new
1 parent c4ee548 commit de2f314

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

catalogd/Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,16 @@ verify: tidy fmt vet generate ## Verify the current code generation and lint
130130
git diff --exit-code
131131

132132
.PHONY: verify-crd-compatibility
133-
CRD_DIFF_ORIGINAL_REF := main
134-
CRD_DIFF_UPDATED_SOURCE := file://config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml
135133
CRD_DIFF_CONFIG := crd-diff-config.yaml
134+
CRD_DIFF_UPDATED_SOURCE := file://config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml
136135
verify-crd-compatibility: $(CRD_DIFF)
137-
$(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml" ${CRD_DIFF_UPDATED_SOURCE}
136+
@if git rev-parse --verify ${CRD_DIFF_ORIGINAL_REF} >/dev/null 2>&1 && \
137+
git show ${CRD_DIFF_ORIGINAL_REF}:${CRD_PATH} >/dev/null 2>&1; then \
138+
echo "Running CRD diff for ${CRD_PATH}..."; \
139+
$(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=${CRD_PATH}" ${CRD_DIFF_UPDATED_SOURCE}; \
140+
else \
141+
echo "Skipping CRD diff check: ${CRD_PATH} is new or ${CRD_DIFF_ORIGINAL_REF} does not exist."; \
142+
fi
138143

139144
.PHONY: lint
140145
lint: $(GOLANGCI_LINT) ## Run golangci linter.

0 commit comments

Comments
 (0)