mirror of
https://github.com/yannh/kubeconform.git
synced 2026-02-11 14:09:21 +00:00
Merge pull request #64 from PaytmLabs/hotfix/scripts/versions-before-version
I added some _very_ basic regression test, which checks that the output I am currently getting for a single resource from the prometheus operator does not change. It's not perfect, but changes that do not break that test are unlikely to break for me.
This commit is contained in:
commit
f8dcb19789
1 changed files with 19 additions and 10 deletions
|
|
@ -123,16 +123,7 @@ for crdFile in sys.argv[1:]:
|
|||
|
||||
filename_format = os.getenv("FILENAME_FORMAT", "{kind}_{version}")
|
||||
filename = ""
|
||||
if "spec" in y and "validation" in y["spec"] and "openAPIV3Schema" in y["spec"]["validation"]:
|
||||
filename = filename_format.format(
|
||||
kind=y["spec"]["names"]["kind"],
|
||||
group=y["spec"]["group"].split(".")[0],
|
||||
version=y["spec"]["version"],
|
||||
).lower() + ".json"
|
||||
|
||||
schema = y["spec"]["validation"]["openAPIV3Schema"]
|
||||
write_schema_file(schema, filename)
|
||||
elif "spec" in y and "versions" in y["spec"]:
|
||||
if "spec" in y and "versions" in y["spec"] and y["spec"]["versions"]:
|
||||
for version in y["spec"]["versions"]:
|
||||
if "schema" in version and "openAPIV3Schema" in version["schema"]:
|
||||
filename = filename_format.format(
|
||||
|
|
@ -143,5 +134,23 @@ for crdFile in sys.argv[1:]:
|
|||
|
||||
schema = version["schema"]["openAPIV3Schema"]
|
||||
write_schema_file(schema, filename)
|
||||
elif "validation" in y["spec"] and "openAPIV3Schema" in y["spec"]["validation"]:
|
||||
filename = filename_format.format(
|
||||
kind=y["spec"]["names"]["kind"],
|
||||
group=y["spec"]["group"].split(".")[0],
|
||||
version=version["name"],
|
||||
).lower() + ".json"
|
||||
|
||||
schema = y["spec"]["validation"]["openAPIV3Schema"]
|
||||
write_schema_file(schema, filename)
|
||||
elif "spec" in y and "validation" in y["spec"] and "openAPIV3Schema" in y["spec"]["validation"]:
|
||||
filename = filename_format.format(
|
||||
kind=y["spec"]["names"]["kind"],
|
||||
group=y["spec"]["group"].split(".")[0],
|
||||
version=y["spec"]["version"],
|
||||
).lower() + ".json"
|
||||
|
||||
schema = y["spec"]["validation"]["openAPIV3Schema"]
|
||||
write_schema_file(schema, filename)
|
||||
|
||||
exit(0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue