From 2bc63a3ea7f8cdd8ea81780efcc0e2b1d15f003c Mon Sep 17 00:00:00 2001 From: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com> Date: Wed, 10 Jun 2026 05:13:29 -0400 Subject: [PATCH] feat: add `verify-csv` check (#1568) Signed-off-by: Dale Haiducek <19750917+dhaiducek@users.noreply.github.com> --- .github/workflows/pre.yml | 2 ++ Makefile | 3 +++ hack/verify-csv.sh | 41 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100755 hack/verify-csv.sh diff --git a/.github/workflows/pre.yml b/.github/workflows/pre.yml index 0c7657f56..954087afa 100644 --- a/.github/workflows/pre.yml +++ b/.github/workflows/pre.yml @@ -36,6 +36,8 @@ jobs: run: make verify-deps - name: verify-fmt-imports run: make verify-fmt-imports + - name: verify-csv + run: make verify-csv /dev/null 2>&1; then + SED_CMD="gsed" + else + echo "Error: gsed not found. Please install it with 'brew install gnu-sed'" >&2 + exit 1 + fi +fi + +# Get the createdAt timestamp from the CSV files +cluster_manager_timestamp=$(yq '.metadata.annotations.createdAt' deploy/cluster-manager/olm-catalog/latest/manifests/cluster-manager.clusterserviceversion.yaml) +klusterlet_timestamp=$(yq '.metadata.annotations.createdAt' deploy/klusterlet/olm-catalog/latest/manifests/klusterlet.clusterserviceversion.yaml) + +# Update the CSV files +echo "::group::Update CSV" +make update-csv +echo "::endgroup::" + +# Reset the createdAt timestamp to the original value +${SED_CMD} -i "s/createdAt: .*/createdAt: \"${cluster_manager_timestamp}\"/g" deploy/cluster-manager/olm-catalog/latest/manifests/cluster-manager.clusterserviceversion.yaml +${SED_CMD} -i "s/createdAt: .*/createdAt: \"${klusterlet_timestamp}\"/g" deploy/klusterlet/olm-catalog/latest/manifests/klusterlet.clusterserviceversion.yaml + +# Verify the CSV content is in sync +git diff --exit-code \ + deploy/cluster-manager/olm-catalog/latest/manifests/cluster-manager.clusterserviceversion.yaml \ + deploy/klusterlet/olm-catalog/latest/manifests/klusterlet.clusterserviceversion.yaml || + (echo '❌ CSV content is out of sync. Run "make update-csv" to update the CSV content.' && false) + +echo "✅ CSV content is in sync."