Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 improve the verify-crd-compatibility make target #1499

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/crd-diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ jobs:
go-version-file: go.mod

- name: Run make verify-crd-compatibility
run: make verify-crd-compatibility CRD_DIFF_ORIGINAL_REF=${{ github.event.pull_request.base.sha }} CRD_DIFF_UPDATED_REF=${{ github.event.pull_request.head.sha }}
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_clusterextensions.yaml"

6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ bingo-upgrade: $(BINGO) #EXHELP Upgrade tools

.PHONY: verify-crd-compatibility
CRD_DIFF_ORIGINAL_REF := main
CRD_DIFF_UPDATED_REF := HEAD
CRD_DIFF_UPDATED_SOURCE := file://config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml
Copy link
Contributor

@tmshort tmshort Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this isn't treated as an absolute path?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. It will read it as a relative path.

CRD_DIFF_CONFIG := crd-diff-config.yaml
verify-crd-compatibility: $(CRD_DIFF)
$(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml" "git://${CRD_DIFF_UPDATED_REF}?path=config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml"
verify-crd-compatibility: $(CRD_DIFF) manifests
Copy link
Contributor

@tmshort tmshort Nov 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding manifests to this target will cause it to also be run in the CI, and if there's a diff, it won't be caught by the GitHub workflow, because it's looking directly at SHAs.
That being said, this should fail make verify

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. In CI, the expectation is that it is looking at the committed changes. I would push for us to rely on the distinct checks for "uncommitted, generated, changes" in CI.

$(CRD_DIFF) --config="${CRD_DIFF_CONFIG}" "git://${CRD_DIFF_ORIGINAL_REF}?path=config/base/crd/bases/olm.operatorframework.io_clusterextensions.yaml" ${CRD_DIFF_UPDATED_SOURCE}

.PHONY: test
test: manifests generate fmt vet test-unit test-e2e #HELP Run all tests.
Expand Down