Fix hack/update-api-reference-docs.sh

- update toplevel api object pattern in swagger doc script
- make hack/update-api-reference-docs.sh indepenent from master
This commit is contained in:
Dr. Stefan Schimanski
2016-06-20 09:21:58 +02:00
parent a055c4e80f
commit 6d75c01b1d
4 changed files with 14 additions and 26 deletions

View File

@@ -28,12 +28,12 @@ COPY build.gradle build/
COPY gen-swagger-docs.sh build/
#run the script once to download the dependent java libraries into the image
RUN mkdir /output
RUN mkdir /swagger-source
RUN mkdir /output /swagger-source
RUN wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/api/swagger-spec/v1.json -O /swagger-source/v1.json
RUN build/gen-swagger-docs.sh v1 https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/pkg/api/v1/register.go
RUN rm /output/*
RUN rm /swagger-source/*
RUN wget https://raw.githubusercontent.com/GoogleCloudPlatform/kubernetes/master/pkg/api/v1/register.go -O /register.go
RUN build/gen-swagger-docs.sh v1
RUN rm /output/* /swagger-source/* /register.go
RUN chmod -R 777 build/
RUN chmod -R 777 gradle-cache/

View File

@@ -22,16 +22,6 @@ set -o pipefail
cd /build
# wget doesn't retry on 503, so adding a loop to make it more resilient.
for i in {1..3}; do
if wget "$2" -O register.go; then
break
fi
if [ $i -eq 3 ]; then
exit 1
fi
done
# gendocs takes "input.json" as the input swagger spec.
# $1 is expected to be <group>_<version>
cp /swagger-source/"$1".json input.json
@@ -40,8 +30,7 @@ cp /swagger-source/"$1".json input.json
#insert a TOC for top level API objects
buf="== Top Level API Objects\n\n"
top_level_models=$(grep GetObjectKind ./register.go | sed 's/func (obj \*\(.*\)) GetObjectKind(\(.*\)) .*/\1/g' \
| tr -d '()' | tr -d '{}' | tr -d ' ')
top_level_models=$(grep '&[A-Za-z]*{},' /register.go | sed 's/.*&//;s/{},//')
# check if the top level models exist in the definitions.adoc. If they exist,
# their name will be <version>.<model_name>