#!/bin/bash # Copyright 2014 The Kubernetes Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # A single script that runs a predefined set of update-* scripts, as they often go together. set -o errexit set -o nounset set -o pipefail setglobal KUBE_ROOT = "$[dirname $(BASH_SOURCE)]/.." source "$(KUBE_ROOT)/hack/lib/init.sh" source "$(KUBE_ROOT)/hack/lib/util.sh" setglobal SILENT = 'true' setglobal ALL = 'false' setglobal V = ''"" while getopts ":va" opt { match $opt { with a setglobal ALL = 'true' with v setglobal SILENT = 'false' setglobal V = '"-v'" with \? echo "Invalid flag: -$OPTARG" > !2 exit 1 } } trap 'exit 1' SIGINT if $SILENT { echo "Running in silent mode, run with -v if you want to see script logs." } if ! $ALL { echo "Running in short-circuit mode; run with -a to force all scripts to run." } "$(KUBE_ROOT)/hack/godep-restore.sh" $(V) setglobal BASH_TARGETS = '" update-generated-protobuf update-codegen update-generated-docs update-generated-swagger-docs update-swagger-spec update-openapi-spec update-api-reference-docs update-federation-openapi-spec update-federation-swagger-spec update-federation-generated-swagger-docs update-federation-api-reference-docs update-staging-godeps update-bazel'" for t in [$BASH_TARGETS] { echo -e "$(color_yellow)Running $t$(color_norm)" if $SILENT { if ! bash "$KUBE_ROOT/hack/$t.sh" !1 > /dev/null { echo -e "$(color_red)Running $t FAILED$(color_norm)" if ! $ALL { exit 1 } } } else { if ! bash "$KUBE_ROOT/hack/$t.sh" { echo -e "$(color_red)Running $t FAILED$(color_norm)" if ! $ALL { exit 1 } } } } echo -e "$(color_green)Update scripts completed successfully$(color_norm)"