From f84f971f8dfee12b56a6b8fd1fb4b42fd58a38da Mon Sep 17 00:00:00 2001 From: subhamkrai Date: Wed, 28 Feb 2024 10:47:49 +0530 Subject: [PATCH] build: add gen-csv files in downstream repo This commit add the csv related changes to downstream and later will be removed from upstream also renaming make 'csv' to 'gen-csv' and also adds validation check in ci to verify right files are modified. Signed-off-by: subhamkrai --- .github/workflows/build.yml | 6 +++++ Makefile | 6 ++--- images/ceph/Makefile | 1 - tests/scripts/validate_modified_files.sh | 33 ++++++++++++++---------- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe4301cef8704..6688c9f7da1df 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -47,6 +47,12 @@ jobs: - name: validate build run: tests/scripts/validate_modified_files.sh build + - name: run csv + run: make gen-csv + + - name: validate csv + run: tests/scripts/validate_modified_files.sh gen-csv + - name: run codegen run: GOPATH=$(go env GOPATH) make codegen diff --git a/Makefile b/Makefile index 140093b5ffd4c..afc3eaf3d4094 100644 --- a/Makefile +++ b/Makefile @@ -184,9 +184,9 @@ prune: ## Prune cached artifacts. @$(MAKE) -C images prune # Change how CRDs are generated for CSVs -csv: export MAX_DESC_LEN=0 # sets the description length to 0 since CSV cannot be bigger than 1MB -csv: export NO_OB_OBC_VOL_GEN=true -csv: csv-clean crds ## Generate a CSV file for OLM. +gen-csv: export MAX_DESC_LEN=0 # sets the description length to 0 since CSV cannot be bigger than 1MB +gen-csv: export NO_OB_OBC_VOL_GEN=true +gen-csv: csv-clean crds ## Generate a CSV file for OLM. $(MAKE) -C images/ceph csv csv-clean: ## Remove existing OLM files. diff --git a/images/ceph/Makefile b/images/ceph/Makefile index 495fc037f87e3..de3b4db64249f 100755 --- a/images/ceph/Makefile +++ b/images/ceph/Makefile @@ -81,7 +81,6 @@ ifeq ($(INCLUDE_CSV_TEMPLATES),true) @$(MAKE) csv @cp -r ../../build/csv $(TEMP)/ceph-csv-templates @rm $(TEMP)/ceph-csv-templates/csv-gen.sh - @$(MAKE) csv-clean else mkdir $(TEMP)/ceph-csv-templates diff --git a/tests/scripts/validate_modified_files.sh b/tests/scripts/validate_modified_files.sh index 1b51d81ca9d78..e282775fdfe41 100755 --- a/tests/scripts/validate_modified_files.sh +++ b/tests/scripts/validate_modified_files.sh @@ -9,11 +9,12 @@ MOD_ERR="changes found by mod.check. You may need to run make clean" CRD_ERR="changes found by 'make crds'. please run 'make crds' locally and update your PR" BUILD_ERR="changes found by make build', please commit your go.sum or other changed files" HELM_ERR="changes found by 'make gen-rbac'. please run 'make gen-rbac' locally and update your PR" +CSV_ERR="changes found by 'make gen-csv'. please run 'make gen-csv' locally and update your PR" ############# # FUNCTIONS # ############# -function validate(){ +function validate() { git=$(git status --porcelain) for file in $git; do if [ -n "$file" ]; then @@ -29,22 +30,26 @@ function validate(){ # MAIN # ######## case "$1" in - codegen) - validate "$CODEGEN_ERR" +codegen) + validate "$CODEGEN_ERR" ;; - modcheck) - validate "$MOD_ERR" +modcheck) + validate "$MOD_ERR" ;; - crd) - validate "$CRD_ERR" +crd) + validate "$CRD_ERR" ;; - build) - validate "$BUILD_ERR" +build) + validate "$BUILD_ERR" ;; - gen-rbac) - validate "$HELM_ERR" +gen-rbac) + validate "$HELM_ERR" + ;; +gen-csv) + validate "$CSV_ERR" + ;; +*) + echo $"Usage: $0 {codegen|modcheck|crd|build|gen-rbac|gen-csv}" + exit 1 ;; - *) - echo $"Usage: $0 {codegen|modcheck|crd|build|gen-rbac}" - exit 1 esac