Skip to content

Commit

Permalink
build: add gen-csv files in downstream repo
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
subhamkrai committed Mar 4, 2024
1 parent 05966e8 commit f84f971
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 18 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion images/ceph/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 19 additions & 14 deletions tests/scripts/validate_modified_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit f84f971

Please sign in to comment.