update the source code

This commit is contained in:
Chao Xu 2015-10-16 11:30:00 -07:00
parent a6634adc1c
commit a3cbf49ea4
3 changed files with 24 additions and 15 deletions

View File

@ -12,6 +12,6 @@ COPY gen-swagger-docs.sh build/
#run the script once to download the dependent java libraries into the image
RUN mkdir /output
RUN build/gen-swagger-docs.sh https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/api/swagger-spec/v1.json https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/pkg/api/v1/register.go
RUN build/gen-swagger-docs.sh v1 https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/api/swagger-spec/v1.json https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/pkg/api/v1/register.go
ENTRYPOINT ["build/gen-swagger-docs.sh"]

View File

@ -20,13 +20,10 @@ set -o errexit
set -o nounset
set -o pipefail
echo $1
echo $2
cd /build/
wget "$1" -O input.json
wget "$2" -O register.go
wget "$2" -O input.json
wget "$3" -O register.go
./gradle-2.5/bin/gradle gendocs --info
@ -36,9 +33,9 @@ top_level_models=$(grep IsAnAPIObject ./register.go | sed 's/func (\*\(.*\)) IsA
| tr -d '()' | tr -d '{}' | tr -d ' ')
for m in $top_level_models
do
if grep -xq "=== v1.$m" ./definitions.adoc
if grep -xq "=== $1.$m" ./definitions.adoc
then
buf+="* <<v1."$m">>\n"
buf+="* <<$1."$m">>\n"
fi
done
sed -i "1i $buf" ./definitions.adoc

View File

@ -1,6 +1,6 @@
#!/bin/bash
# Copyright 2014 The Kubernetes Authors All rights reserved.
# Copyright 2015 The Kubernetes Authors All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -14,10 +14,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if [ "$#" -lt 1 ]; then
echo "Usage: run-gen-swagger-docs.sh <API version> <absolute output path, default to PWD>"
exit
fi
OUTPUT=${2:-${PWD}}
set -o errexit
set -o nounset
set -o pipefail
docker run -v ${OUTPUT}:/output gcr.io/google_containers/gen-swagger-docs:v1.1 https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/swagger-spec/$1.json https://raw.githubusercontent.com/kubernetes/kubernetes/master/pkg/api/$1/register.go
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
V1_PATH="$PWD/${KUBE_ROOT}/docs/api-reference/v1/"
V1BETA1_PATH="$PWD/${KUBE_ROOT}/docs/api-reference/extensions/v1beta1"
mkdir -p $V1_PATH
mkdir -p $V1BETA1_PATH
docker run -v $V1_PATH:/output gcr.io/google_containers/gen-swagger-docs:v2 \
v1 \
https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/swagger-spec/v1.json \
https://raw.githubusercontent.com/kubernetes/kubernetes/master/pkg/api/v1/register.go
docker run -v $V1BETA1_PATH:/output gcr.io/google_containers/gen-swagger-docs:v2 \
v1beta1 \
https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/swagger-spec/v1beta1.json \
https://raw.githubusercontent.com/kubernetes/kubernetes/master/pkg/apis/extensions/v1beta1/register.go