|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright 2018 The Kubernetes Authors. |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +set -e |
| 18 | +set -x |
| 19 | + |
| 20 | +# Copy over the files from the host repo |
| 21 | +export D=$DIR/$OUTPUT |
| 22 | +mkdir -p $D |
| 23 | + |
| 24 | +# Copy the api definitions |
| 25 | +cp -r /host/repo/pkg $DIR/pkg |
| 26 | + |
| 27 | +# Copy the docs |
| 28 | +if [ -d "/host/repo/$OUTPUT" ]; then |
| 29 | + cp -r /host/repo/$OUTPUT/* $D |
| 30 | +fi |
| 31 | +if [ ! -d "$DIR/boilerplate.go.txt" ]; then |
| 32 | + touch $DIR/boilerplate.go.txt |
| 33 | +else |
| 34 | + cp /host/repo/boilerplate.go.txt $DIR/boilerplate.go.txt |
| 35 | +fi |
| 36 | + |
| 37 | +cd $DIR |
| 38 | + |
| 39 | +# Generate the artifacts |
| 40 | +apiserver-boot init repo --domain $DOMAIN |
| 41 | +apiserver-boot build generated clean |
| 42 | +apiserver-boot build generated |
| 43 | + |
| 44 | +# Generate the input .md files for the docs |
| 45 | +go build -o bin/apiserver cmd/apiserver/main.go |
| 46 | +bin/apiserver --etcd-servers=http://localhost:2379 --secure-port=9443 --print-openapi --delegated-auth=false > $OUTPUT/openapi-spec/swagger.json |
| 47 | +gen-apidocs --build-operations=false --use-tags=false --allow-errors --config-dir=$OUTPUT |
| 48 | + |
| 49 | +# Copy the input files to the host |
| 50 | +if [ ! -d "/host/repo/$OUTPUT" ]; then |
| 51 | + mkdir -p /host/repo/$OUTPUT |
| 52 | +fi |
| 53 | +cp -r $OUTPUT/* /host/repo/$OUTPUT |
0 commit comments