Skip to content

Commit dd4ab94

Browse files
authored
Update Workflow for JSON Schema Generation (#722)
Signed-off-by: Frank Jogeleit <[email protected]>
1 parent da02819 commit dd4ab94

File tree

5 files changed

+2064
-15091
lines changed

5 files changed

+2064
-15091
lines changed

Makefile

+13-3
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,21 @@ codegen-schema-openapi: $(KIND) $(HELM) ## Generate openapi schemas (v2 and v3)
140140
@kubectl get --raw /openapi/v3/apis/admissionregistration.k8s.io/v1 > ./schemas/openapi/v3/apis/admissionregistration.k8s.io/v1.json
141141
@$(KIND) delete cluster --name schema
142142

143+
.PHONY: codegen-schema-json
144+
codegen-schema-json: codegen-schema-openapi ## Generate json schemas
145+
@rm -rf ./schemas/json
146+
@mkdir -p ./schemas/json
147+
@chmod 777 ./schemas/json
148+
@docker run --rm --name openapi2jsonschema --mount type=bind,source="$(PWD)"/schemas/openapi/v3,target=/v3 --mount type=bind,source="$(PWD)"/schemas/json,target=/json ghcr.io/fjogeleit/openapi2jsonschema:master /v3/apis/kyverno.io/v1.json --kubernetes --stand-alone --expanded -o /json/v3
149+
@docker run --rm --name openapi2jsonschema --mount type=bind,source="$(PWD)"/schemas/openapi/v3,target=/v3 --mount type=bind,source="$(PWD)"/schemas/json,target=/json ghcr.io/fjogeleit/openapi2jsonschema:master /v3/apis/kyverno.io/v2beta1.json --kubernetes --stand-alone --expanded -o /json/v3
150+
@docker run --rm --name openapi2jsonschema --mount type=bind,source="$(PWD)"/schemas/openapi/v3,target=/v3 --mount type=bind,source="$(PWD)"/schemas/json,target=/json ghcr.io/fjogeleit/openapi2jsonschema:master /v3/apis/kyverno.io/v2.json --kubernetes --stand-alone --expanded -o /json/v3
151+
@docker run --rm --name openapi2jsonschema --mount type=bind,source="$(PWD)"/schemas/openapi/v3,target=/v3 --mount type=bind,source="$(PWD)"/schemas/json,target=/json ghcr.io/fjogeleit/openapi2jsonschema:master /v3/apis/admissionregistration.k8s.io/v1.json --kubernetes --stand-alone --expanded -o /json/v3
152+
143153
.PHONY: codegen-all
144-
codegen-all: codegen-helm-docs codegen-schema-openapi ## Generate all codegen
154+
codegen-all: codegen-helm-docs codegen-schema-json ## Generate all codegen
145155

146156
.PHONY: verify-schemas
147-
verify-schemas: codegen-schema-openapi ## Check openapi and json schemas are up to date
157+
verify-schemas: codegen-schema-json ## Check openapi and json schemas are up to date
148158
@echo Checking openapi schemas are up to date... >&2
149159
@git --no-pager diff -- schemas
150160
@echo 'If this test fails, it is because the git diff is non-empty after running "make codegen-schema-openapi".' >&2
@@ -160,7 +170,7 @@ verify-helm-docs: codegen-helm-docs ## Check Helm charts are up to date
160170
@git diff --quiet --exit-code -- charts
161171

162172
.PHONY: verify-codegen
163-
verify-codegen: verify-helm-docs ## Verify all generated code and docs are up to date
173+
verify-codegen: verify-helm-docs verify-schemas ## Verify all generated code and docs are up to date
164174

165175
#########
166176
# BUILD #

0 commit comments

Comments
 (0)