Skip to content

Commit

Permalink
Update build script, generate 1.20.*
Browse files Browse the repository at this point in the history
  • Loading branch information
yannh committed Jan 23, 2021
1 parent 3eb0911 commit 0509610
Show file tree
Hide file tree
Showing 13,123 changed files with 5,251,375 additions and 86 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
111 changes: 25 additions & 86 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,93 +8,32 @@
# X.Y.Z-standalone-strict - de-referenced schemas, more useful as standalone documents, additionalProperties disallowed
# X.Y.Z-local - relative references, useful to avoid the network dependency

declare -a arr=(
# Add here the version you want to re-generate
# master
# v1.19.X
v1.19.3
)

# This list is used only list of already genrated schema definition
# (or when we need to rebuild all definitions)
declare -a arr2=(
# master
# v1.19.X
v1.19.3
# v1.18.x
v1.18.1
v1.18.0
# v1.17.x
v1.17.4
v1.17.3
v1.17.2
v1.17.1
v1.17.0
# v1.16.x
v1.16.4
v1.16.3
v1.16.2
v1.16.1
v1.16.0
# v1.15.x
v1.15.7
v1.15.6
v1.15.5
v1.15.4
v1.15.3
v1.15.2
v1.15.1
v1.15.0
# v1.14.x
v1.14.10
v1.14.9
v1.14.8
v1.14.7
v1.14.6
v1.14.5
v1.14.4
v1.14.3
v1.14.2
v1.14.1
v1.14.0
# v1.13.x
v1.13.11
v1.13.10
v1.13.9
v1.13.8
v1.13.7
v1.13.6
v1.13.5
v1.13.4
v1.13.3
v1.13.2
v1.13.1
v1.13.0
# v1.12.x
v1.12.10
v1.12.9
v1.12.8
v1.12.7
v1.12.6
v1.12.5
v1.12.4
v1.12.3
v1.12.2
v1.12.1
v1.12.0
)
# All k8s versions, starting from 1.10
K8S_VERSIONS=$(git ls-remote --refs --tags [email protected]:kubernetes/kubernetes.git | cut -d/ -f3 | grep -e '^v1\.[0-9]\{2\}\.[0-9]\{1,2\}$')
OPENAPI2JSONSCHEMABIN="docker run -it -v ${PWD}:/out/schemas docker.pkg.github.com/yannh/openapi2jsonschema/openapi2jsonschema:latest"

for version in "${arr[@]}"
do
schema=https://raw.githubusercontent.com/kubernetes/kubernetes/${version}/api/openapi-spec/swagger.json
prefix=https://kubernetesjsonschema.dev/${version}/_definitions.json
for K8S_VERSION in master $K8S_VERSIONS; do
SCHEMA=https://raw.githubusercontent.com/kubernetes/kubernetes/${K8S_VERSION}/api/openapi-spec/swagger.json
PREFIX=https://kubernetesjsonschema.dev/${K8S_VERSION}/_definitions.json

docker run -it docker.pkg.github.com/yannh/openapi2jsonschema/openapi2jsonschema:latest -o "${version}-standalone-strict" --expanded --kubernetes --stand-alone --strict "${schema}"
docker run -it docker.pkg.github.com/yannh/openapi2jsonschema/openapi2jsonschema:latest -o "${version}-standalone" --expanded --kubernetes --stand-alone "${schema}"
docker run -it docker.pkg.github.com/yannh/openapi2jsonschema/openapi2jsonschema:latest -o "${version}-local" --expanded --kubernetes "${schema}"
docker run -it docker.pkg.github.com/yannh/openapi2jsonschema/openapi2jsonschema:latest -o "${version}" --expanded --kubernetes --prefix "${prefix}" "${schema}"
docker run -it docker.pkg.github.com/yannh/openapi2jsonschema/openapi2jsonschema:latest -o "${version}-standalone-strict" --kubernetes --stand-alone --strict "${schema}"
docker run -it docker.pkg.github.com/yannh/openapi2jsonschema/openapi2jsonschema:latest -o "${version}-standalone" --kubernetes --stand-alone "${schema}"
docker run -it docker.pkg.github.com/yannh/openapi2jsonschema/openapi2jsonschema:latest -o "${version}-local" --kubernetes "${schema}"
docker run -it docker.pkg.github.com/yannh/openapi2jsonschema/openapi2jsonschema:latest -o "${version}" --kubernetes --prefix "${prefix}" "${schema}"
if [ ! -d "schemas/${K8S_VERSION}-standalone-strict" ]; then
$OPENAPI2JSONSCHEMABIN -o "schemas/${K8S_VERSION}-standalone-strict" --expanded --kubernetes --stand-alone --strict "${SCHEMA}"
$OPENAPI2JSONSCHEMABIN -o "schemas/${K8S_VERSION}-standalone-strict" --kubernetes --stand-alone --strict "${SCHEMA}"
fi

if [ ! -d "schemas/${K8S_VERSION}-standalone" ]; then
$OPENAPI2JSONSCHEMABIN -o "schemas/${K8S_VERSION}-standalone" --expanded --kubernetes --stand-alone "${SCHEMA}"
$OPENAPI2JSONSCHEMABIN -o "schemas/${K8S_VERSION}-standalone" --kubernetes --stand-alone "${SCHEMA}"
fi

if [ ! -d "schemas/${K8S_VERSION}-local" ]; then
$OPENAPI2JSONSCHEMABIN -o "schemas/${K8S_VERSION}-local" --expanded --kubernetes "${SCHEMA}"
$OPENAPI2JSONSCHEMABIN -o "schemas/${K8S_VERSION}-local" --kubernetes "${SCHEMA}"
fi

if [ ! -d "schemas/${K8S_VERSION}" ]; then
$OPENAPI2JSONSCHEMABIN -o "schemas/${K8S_VERSION}" --expanded --kubernetes --prefix "${PREFIX}" "${SCHEMA}"
$OPENAPI2JSONSCHEMABIN -o "schemas/${K8S_VERSION}" --kubernetes --prefix "${PREFIX}" "${SCHEMA}"
fi
done
Loading

0 comments on commit 0509610

Please sign in to comment.