From 1ad89ab36fa2f6a13daf2017c61f51b5b74e4a00 Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Fri, 18 Oct 2024 09:46:17 -0500 Subject: [PATCH] Add a Makefile target to verify bundles We don't have any CI that checks to make sure the bundle stays up-to-date with PRs that may be changing the bundle. This usually results in dirty local builds because running `make bundle` will generate new bundles from what is kept in source based on other parts othe project, or the operator-sdk version. This commit adds in a target to run the `bundle` and then verify there haven't been any changes. We can wire this up to CI to make it easier to catch bundle changes sooner. --- Makefile | 4 ++++ hack/tree-status | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100755 hack/tree-status diff --git a/Makefile b/Makefile index 7fd3827bc..c53caf6d2 100644 --- a/Makefile +++ b/Makefile @@ -327,6 +327,10 @@ bundle: check-operator-version operator-sdk manifests update-skip-range kustomiz git restore config/manifests/kustomization.yaml $(SDK_BIN) bundle validate ./bundle +.PHONY: verify-bundle +verify-bundle: bundle ## Verify the bundle doesn't alter the state of the tree + hack/tree-status + .PHONY: bundle-image bundle-image: bundle ## Build the bundle image. $(RUNTIME) $(RUNTIME_BUILD_CMD) -f bundle.Dockerfile -t $(BUNDLE_IMG) . diff --git a/hack/tree-status b/hack/tree-status new file mode 100755 index 000000000..18d8d9257 --- /dev/null +++ b/hack/tree-status @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +STATUS=$(git status --porcelain) +if [[ -z $STATUS ]]; then + echo tree is clean +else + echo tree is dirty, please commit all changes + echo "$STATUS" + git diff + exit 1 +fi