diff --git a/.github/workflows/gobuild.yml b/.github/workflows/generate-model.yml similarity index 80% rename from .github/workflows/gobuild.yml rename to .github/workflows/generate-model.yml index 5f689ef437a..1977ba69d60 100644 --- a/.github/workflows/gobuild.yml +++ b/.github/workflows/generate-model.yml @@ -14,7 +14,7 @@ # limitations under the License. # -name: Go Generate Model +name: Generate Model on: push: @@ -55,11 +55,13 @@ jobs: - name: Check No Schema file modified run: | git add . - MODIFIED_KUBE_SCHEMA=`git status | grep -v 'validation-schema.json' | grep 'kube-schema.json\|src/generated/java' | wc -l` - if [ $MODIFIED_KUBE_SCHEMA -eq "0" ]; then + IGNORED_PATTERNS="validation-schema.json" + INCLUDE_PATTERNS="kube-schema.json\|src/generated/java\|openapi/schemas/" + MODIFIED_FILES_COUNT=$(git status | grep -v "$IGNORED_PATTERNS" | grep "$INCLUDE_PATTERNS" | wc -l) + if [ $MODIFIED_FILES_COUNT -eq "0" ]; then echo "No Schema files modified. Build Success."; else - git status | grep -v 'validation-schema.json' | grep 'kube-schema.json\|src/generated/java' + git status | grep -v "$IGNORED_PATTERNS" | grep "$INCLUDE_PATTERNS" echo "Schema files modified. Build Failure"; exit 1; fi; diff --git a/Makefile b/Makefile index 2e58b842174..2444feba0c8 100644 --- a/Makefile +++ b/Makefile @@ -29,10 +29,13 @@ generate-openapi: ./kubernetes-model-generator/openapi/generator/generator ./kubernetes-model-generator/openapi/schemas # Legacy generation of the model: TODO: remove -.PHONY: generate-model -generate-model: +.PHONY: generate-model-legacy +generate-model-legacy: cd kubernetes-model-generator && ./generateModel.sh +.PHONY: generate-model +generate-model: generate-openapi generate-model-legacy + .PHONY: sonar sonar: mvn $(MAVEN_OPTIONS) clean install sonar:sonar -Psonar