Skip to content

Commit 6b9b74d

Browse files
Fix catalogd-crd-diff CI check
The check fails because the CRD does not exist in the new repo. We are improving the CI and makefile target to skip when the orginal does not exist.
1 parent c637bb7 commit 6b9b74d

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.github/workflows/catalogd-crd-diff.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@ jobs:
1515

1616
- name: Run make verify-crd-compatibility
1717
working-directory: catalogd
18-
run: make verify-crd-compatibility CRD_DIFF_ORIGINAL_REF=${{ github.event.pull_request.base.sha }} CRD_DIFF_UPDATED_SOURCE="git://${{ github.event.pull_request.head.sha }}?path=config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml"
19-
18+
run: |
19+
make verify-crd-compatibility \
20+
CRD_DIFF_ORIGINAL_REF=${{ github.event.pull_request.base.sha }} \
21+
CRD_DIFF_UPDATED_SOURCE=config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml

catalogd/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ CRD_DIFF_ORIGINAL_REF := main
136136
CRD_DIFF_UPDATED_SOURCE := file://config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml
137137
CRD_DIFF_CONFIG := crd-diff-config.yaml
138138
verify-crd-compatibility: $(CRD_DIFF)
139-
$(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}
139+
@if git show ${CRD_DIFF_ORIGINAL_REF}:config/base/crd/bases/olm.operatorframework.io_clustercatalogs.yaml > /dev/null 2>&1; then \
140+
echo "Running CRD diff..."; \
141+
$(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}; \
142+
else \
143+
echo "Skipping CRD diff: CRD does not exist in ${CRD_DIFF_ORIGINAL_REF}"; \
144+
fi
140145

141146
.PHONY: lint
142147
lint: $(GOLANGCI_LINT) ## Run golangci linter.

0 commit comments

Comments
 (0)