Skip to content

Commit

Permalink
ci: OpenAPI model generated files checked in pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored Jul 22, 2024
1 parent 11c881b commit 88adc1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#

name: Go Generate Model
name: Generate Model

on:
push:
Expand Down Expand Up @@ -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;
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 88adc1e

Please sign in to comment.