#!/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 global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/.." source "$(KUBE_ROOT)/hack/lib/init.sh" source "$(KUBE_ROOT)/hack/lib/util.sh" global SILENT := 'true' global ALL := 'false' global V := ''"" while getopts ":va" opt { matchstr $opt { a { global ALL := 'true' } v { global SILENT := 'false' global V := '"-v'" } \? { 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) global 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)" (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_ROOT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [67 75] ) (/..) } spids: [66] ) ] spids: [66] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/init.sh))}) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/util.sh))}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:SILENT) op:Equal rhs:{(true)} spids:[97])] spids: [97] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ALL) op:Equal rhs:{(false)} spids:[100])] spids: [100] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:V) op:Equal rhs:{(DQ )} spids:[103])] spids: [103] ) (While cond: [(Sentence child:(C {(getopts)} {(DQ (":va"))} {(opt)}) terminator:)] body: (DoGroup children: [ (Case to_match: {($ VSub_Name "$opt")} arms: [ (case_arm pat_list: [{(a)}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ALL) op:Equal rhs:{(true)} spids:[133])] spids: [133] ) ] spids: [129 130 137 -1] ) (case_arm pat_list: [{(v)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SILENT) op: Equal rhs: {(false)} spids: [144] ) ] spids: [144] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:V) op:Equal rhs:{(DQ (-v))} spids:[148])] spids: [148] ) ] spids: [140 141 154 -1] ) (case_arm pat_list: [{(EscapedLiteralPart token:)}] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Invalid flag: -") ($ VSub_Name "$OPTARG"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[168])] ) (C {(exit)} {(1)}) ] spids: [157 158 177 -1] ) ] spids: [122 126 180] ) ] spids: [119 182] ) ) (C {(trap)} {(SQ <"exit 1">)} {(SIGINT)}) (If arms: [ (if_arm cond: [(Sentence child:(C {($ VSub_Name "$SILENT")}) terminator:)] action: [ (C {(echo)} {(DQ ("Running in silent mode, run with -v if you want to see script logs."))}) ] spids: [-1 200] ) ] spids: [-1 209] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children:[(C {($ VSub_Name "$ALL")})] negated:True) terminator: ) ] action: [ (C {(echo)} {(DQ ("Running in short-circuit mode; run with -a to force all scripts to run."))} ) ] spids: [-1 220] ) ] spids: [-1 229] ) (C {(DQ (${ VSub_Name KUBE_ROOT) (/hack/godep-restore.sh))} {(${ VSub_Name V)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BASH_TARGETS) op: Equal rhs: { (DQ ("\n") ("\tupdate-generated-protobuf\n") ("\tupdate-codegen\n") ("\tupdate-generated-docs\n") ("\tupdate-generated-swagger-docs\n") ("\tupdate-swagger-spec\n") ("\tupdate-openapi-spec\n") ("\tupdate-api-reference-docs\n") ("\tupdate-federation-openapi-spec\n") ("\tupdate-federation-swagger-spec\n") ("\tupdate-federation-generated-swagger-docs\n") ("\tupdate-federation-api-reference-docs\n") ("\tupdate-staging-godeps\n") ("\tupdate-bazel") ) } spids: [244] ) ] spids: [244] ) (ForEach iter_name: t iter_words: [{($ VSub_Name "$BASH_TARGETS")}] do_arg_iter: False body: (DoGroup children: [ (C {(echo)} {(-e)} { (DQ (${ VSub_Name color_yellow) ("Running ") ($ VSub_Name "$t") (${ VSub_Name color_norm) ) } ) (If arms: [ (if_arm cond: [(Sentence child:(C {($ VSub_Name "$SILENT")}) terminator:)] action: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [ {(bash)} { (DQ ($ VSub_Name "$KUBE_ROOT") (/hack/) ($ VSub_Name "$t") (.sh) ) } ] redirects: [ (Redir op_id: Redir_Great fd: 1 arg_word: {(/dev/null)} spids: [313] ) ] ) ] negated: True ) terminator: ) ] action: [ (C {(echo)} {(-e)} { (DQ (${ VSub_Name color_red) ("Running ") ($ VSub_Name "$t") (" FAILED") (${ VSub_Name color_norm) ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {($ VSub_Name "$ALL")})] negated: True ) terminator: ) ] action: [(C {(exit)} {(1)})] spids: [-1 345] ) ] spids: [-1 353] ) ] spids: [-1 318] ) ] spids: [-1 356] ) ] spids: [-1 297] ) ] else_action: [ (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (C {(bash)} {(DQ ($ VSub_Name "$KUBE_ROOT") (/hack/) ($ VSub_Name "$t") (.sh))} ) ] negated: True ) terminator: ) ] action: [ (C {(echo)} {(-e)} { (DQ (${ VSub_Name color_red) ("Running ") ($ VSub_Name "$t") (" FAILED") (${ VSub_Name color_norm) ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {($ VSub_Name "$ALL")})] negated: True ) terminator: ) ] action: [(C {(exit)} {(1)})] spids: [-1 403] ) ] spids: [-1 411] ) ] spids: [-1 376] ) ] spids: [-1 414] ) ] spids: [359 417] ) ] spids: [272 419] ) spids: [268 270] ) (C {(echo)} {(-e)} { (DQ (${ VSub_Name color_green) ("Update scripts completed successfully") (${ VSub_Name color_norm) ) } ) ] )