#!/bin/bash # Copyright 2016 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. # Make bucket and a folder for e2e-node test logs. # Populate the folder from the logs stored in /tmp/_artifacts/ in the same way as a # jenkins build would, and then print the URL to view the test results on Gubernator set -o errexit set -o nounset set -o pipefail source cluster/lib/logging.sh if [[ $# -eq 0 || ! $1 =~ ^[Yy]$ ]] { read -p "Do you want to run gubernator.sh and upload logs publicly to GCS? [y/n]" yn echo if [[ ! $yn =~ ^[Yy]$ ]] { exit 1 } } # Check that user has gsutil if [[ $(which gsutil) == "" ]] { echo "Could not find gsutil when running \`which gsutil\`" exit 1 } # Check that user has gcloud if [[ $(which gcloud) == "" ]] { echo "Could not find gcloud when running: \`which gcloud\`" exit 1 } # Check that user has Credentialed Active account if ! gcloud auth list | grep -q "ACTIVE" { echo "Could not find active account when running: \`gcloud auth list\`" exit 1 }setconst global FOO = "bar" readonly gcs_acl = '"public-read'" global bucket_name := ""$(USER)-g8r-logs"" echo "" env V=2 kube::log::status "Using bucket $(bucket_name)" # Check if the bucket exists if ! gsutil ls gs:// | grep -q "gs://$(bucket_name)/" { env V=2 kube::log::status "Creating public bucket $(bucket_name)" gsutil mb gs://$(bucket_name)/ # Make all files in the bucket publicly readable gsutil acl ch -u AllUsers:R gs://$(bucket_name) } else { env V=2 kube::log::status "Bucket already exists" } # Path for e2e-node test results global GCS_JOBS_PATH := ""gs://$(bucket_name)/logs/e2e-node"" global ARTIFACTS := $(ARTIFACTS:-"/tmp/_artifacts") global BUILD_LOG_PATH := ""$(ARTIFACTS)/build-log.txt"" if [[ ! -e $BUILD_LOG_PATH ]] { echo "Could not find build-log.txt at $(BUILD_LOG_PATH)" exit 1 } # Get start and end timestamps based on build-log.txt file contents # Line where the actual tests start global start_line := $[grep -n -m 1 "^=" $(BUILD_LOG_PATH) | sed 's/\([0-9]*\).*/\1/] # Create text file starting where the tests start global after_start := $[tail -n +$(start_line) $(BUILD_LOG_PATH)] echo $(after_start) >> build-log-cut.txt # Match the first timestamp global start_time_raw := $[grep -m 1 -o '[0-9][0-9][0-9][0-9][[:blank:]][0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]*' build-log-cut.txt] rm build-log-cut.txt # Make the date readable by date command (ex: 0101 00:00:00.000 -> 01/01 00:00:00.000) global start_time := $[echo $(start_time_raw) | sed 's/^.\{2\}/&\//] env V=2 kube::log::status "Started at $(start_time)" # Match the last timestamp in the build-log file global end_time := $[grep -o '[0-9][0-9][0-9][0-9][[:blank:]][0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]*' $(BUILD_LOG_PATH) | tail -1 | sed 's/^.\{2\}/&\//] # Convert to epoch time for Gubernator global start_time_epoch := $[date -d $(start_time) +%s] global end_time_epoch := $[date -d $(end_time) +%s] # Make folder name for build from timestamp global BUILD_STAMP := $[echo $start_time | sed 's/\///' | sed 's/ /_/] global GCS_LOGS_PATH := ""$(GCS_JOBS_PATH)/$(BUILD_STAMP)"" # Check if folder for same logs already exists if gsutil ls $(GCS_JOBS_PATH) | grep -q $(BUILD_STAMP) { env V=2 kube::log::status "Log files already uploaded" echo "Gubernator linked below:" echo "k8s-gubernator.appspot.com/build/$(GCS_LOGS_PATH)?local=on" exit } for result in [$[find $(ARTIFACTS) -type d -name "results]] { if [[ $result != "" && $result != "${ARTIFACTS}/results" && $result != $ARTIFACTS ]] { mv $result/* $ARTIFACTS } } # Upload log files for upload_attempt in [$[seq 3]] { if [[ -d "${ARTIFACTS}" && -n $(ls -A "${ARTIFACTS}") ]] { env V=2 kube::log::status "Uploading artifacts" gsutil -m -q -o "GSUtil:use_magicfile=True" cp -a $(gcs_acl) -r -c \ -z log,xml,json $(ARTIFACTS) "$(GCS_LOGS_PATH)/artifacts" || continue } break } for upload_attempt in [$[seq 3]] { if [[ -e "${BUILD_LOG_PATH}" ]] { env V=2 kube::log::status "Uploading build log" gsutil -q cp -Z -a $(gcs_acl) $(BUILD_LOG_PATH) $(GCS_LOGS_PATH) || continue } break } # Find the k8s version for started.json global version := ''"" if [[ -e "version" ]] { global version := $[cat "version] } elif [[ -e "hack/lib/version.sh" ]] { export KUBE_ROOT="." source "hack/lib/version.sh" kube::version::get_version_vars global version := $(KUBE_GIT_VERSION-) } if [[ -n "${version}" ]] { env V=2 kube::log::status "Found Kubernetes version: $(version)" } else { env V=2 kube::log::status "Could not find Kubernetes version" } #Find build result from build-log.txt if grep -Fxq "Test Suite Passed" $(BUILD_LOG_PATH) { global build_result := '"SUCCESS'" } else { global build_result := '"FAILURE'" } env V=4 kube::log::status "Build result is $(build_result)" if [[ -e "${ARTIFACTS}/started.json" ]] { rm "$(ARTIFACTS)/started.json" } if [[ -e "${ARTIFACTS}/finished.json" ]] { rm "$(ARTIFACTS)/finished.json" } env V=2 kube::log::status "Constructing started.json and finished.json files" echo "{" >> "$(ARTIFACTS)/started.json" echo " \"version\": \"$(version)\"," >> "$(ARTIFACTS)/started.json" echo " \"timestamp\": $(start_time_epoch)," >> "$(ARTIFACTS)/started.json" echo " \"jenkins-node\": \"$(NODE_NAME:-)\"" >> "$(ARTIFACTS)/started.json" echo "}" >> "$(ARTIFACTS)/started.json" echo "{" >> "$(ARTIFACTS)/finished.json" echo " \"result\": \"$(build_result)\"," >> "$(ARTIFACTS)/finished.json" echo " \"timestamp\": $(end_time_epoch)" >> "$(ARTIFACTS)/finished.json" echo "}" >> "$(ARTIFACTS)/finished.json" # Upload started.json env V=2 kube::log::status "Uploading started.json and finished.json" env V=2 kube::log::status "Run started at $(start_time)" global json_file := ""$(GCS_LOGS_PATH)/started.json"" for upload_attempt in [$[seq 3]] { env V=2 kube::log::status "Uploading started.json to $(json_file) (attempt $(upload_attempt))" gsutil -q -h "Content-Type:application/json" cp -a $(gcs_acl) "$(ARTIFACTS)/started.json" \ $(json_file) || continue break } # Upload finished.json for upload_attempt in [$[seq 3]] { env V=2 kube::log::status "Uploading finished.json to $(GCS_LOGS_PATH) (attempt $(upload_attempt))" gsutil -q -h "Content-Type:application/json" cp -a $(gcs_acl) "$(ARTIFACTS)/finished.json" \ "$(GCS_LOGS_PATH)/finished.json" || continue break } echo "Gubernator linked below:" echo "k8s-gubernator.appspot.com/build/$(bucket_name)/logs/e2e-node/$(BUILD_STAMP)" (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (C {(source)} {(cluster/lib/logging.sh)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalOr left: (BoolBinary op_id:BoolBinary_eq left:{($ VSub_Pound "$#")} right:{(0)}) right: (LogicalNot child: (BoolBinary op_id: BoolBinary_EqualTilde left: {($ VSub_Number "$1")} right: {(Lit_Other "^") (Lit_Other "[") (Yy) (Lit_Other "]") (Lit_Other "$")} ) ) ) ) terminator: ) ] action: [ (C {(read)} {(-p)} {(DQ ("Do you want to run gubernator.sh and upload logs publicly to GCS? [y/n]"))} {(yn)} ) (C {(echo)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolBinary op_id: BoolBinary_EqualTilde left: {($ VSub_Name "$yn")} right: {(Lit_Other "^") (Lit_Other "[") (Yy) (Lit_Other "]") (Lit_Other "$") } ) ) ) terminator: ) ] action: [(C {(exit)} {(1)})] spids: [-1 142] ) ] spids: [-1 150] ) ] spids: [-1 106] ) ] spids: [-1 152] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(gsutil)})]) left_token: spids: [162 166] ) } right: {(DQ )} ) ) terminator: ) ] action: [ (C {(echo)} { (DQ ("Could not find gsutil when running ") (EscapedLiteralPart token:) ("which gsutil") (EscapedLiteralPart token:) ) } ) (C {(exit)} {(1)}) ] spids: [-1 176] ) ] spids: [-1 193] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: { (CommandSubPart command_list: (CommandList children:[(C {(which)} {(gcloud)})]) left_token: spids: [203 207] ) } right: {(DQ )} ) ) terminator: ) ] action: [ (C {(echo)} { (DQ ("Could not find gcloud when running: ") (EscapedLiteralPart token:) ("which gcloud") (EscapedLiteralPart token:) ) } ) (C {(exit)} {(1)}) ] spids: [-1 217] ) ] spids: [-1 234] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(C {(gcloud)} {(auth)} {(list)}) (C {(grep)} {(-q)} {(DQ (ACTIVE))})] negated: True ) terminator: ) ] action: [ (C {(echo)} { (DQ ("Could not find active account when running: ") (EscapedLiteralPart token:) ("gcloud auth list") (EscapedLiteralPart token:) ) } ) (C {(exit)} {(1)}) ] spids: [-1 261] ) ] spids: [-1 278] ) (Assignment keyword: Assign_Readonly pairs: [(assign_pair lhs:(LhsName name:gcs_acl) op:Equal rhs:{(DQ (public-read))} spids:[283])] spids: [281] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:bucket_name) op: Equal rhs: {(DQ (${ VSub_Name USER) (-g8r-logs))} spids: [288] ) ] spids: [288] ) (C {(echo)} {(DQ )}) (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Using bucket ") (${ VSub_Name bucket_name))} ] more_env: [(env_pair name:V val:{(2)} spids:[301])] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (C {(gsutil)} {(ls)} {(gs) (Lit_Other ":") (//)}) (C {(grep)} {(-q)} {(DQ ("gs://") (${ VSub_Name bucket_name) (/))}) ] negated: True ) terminator: ) ] action: [ (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Creating public bucket ") (${ VSub_Name bucket_name))} ] more_env: [(env_pair name:V val:{(2)} spids:[353])] ) (C {(gsutil)} {(mb)} {(gs) (Lit_Other ":") (//) (${ VSub_Name bucket_name) (/)}) (C {(gsutil)} {(acl)} {(ch)} {(-u)} {(AllUsers) (Lit_Other ":") (R)} {(gs) (Lit_Other ":") (//) (${ VSub_Name bucket_name)} ) ] spids: [-1 350] ) ] else_action: [ (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Bucket already exists"))} ] more_env: [(env_pair name:V val:{(2)} spids:[411])] ) ] spids: [408 426] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GCS_JOBS_PATH) op: Equal rhs: {(DQ ("gs://") (${ VSub_Name bucket_name) (/logs/e2e-node))} spids: [432] ) ] spids: [432] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ARTIFACTS) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(DQ (/tmp/_artifacts))}) spids: [443 449] ) } spids: [442] ) ] spids: [442] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BUILD_LOG_PATH) op: Equal rhs: {(DQ (${ VSub_Name ARTIFACTS) (/build-log.txt))} spids: [451] ) ] spids: [451] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalNot child: (BoolUnary op_id:BoolUnary_e child:{($ VSub_Name "$BUILD_LOG_PATH")}) ) ) terminator: ) ] action: [ (C {(echo)} {(DQ ("Could not find build-log.txt at ") (${ VSub_Name BUILD_LOG_PATH))}) (C {(exit)} {(1)}) ] spids: [-1 473] ) ] spids: [-1 490] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:start_line) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(-n)} {(-m)} {(1)} {(DQ ("^="))} {(${ VSub_Name BUILD_LOG_PATH)}) (C {(sed)} {(SQ <"s/\\([0-9]*\\).*/\\1/">)}) ] negated: False ) ] ) left_token: spids: [500 524] ) } spids: [499] ) ] spids: [499] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:after_start) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(tail)} {(-n)} {(Lit_Other "+") (${ VSub_Name start_line)} {(${ VSub_Name BUILD_LOG_PATH)} ) ] ) left_token: spids: [530 543] ) } spids: [529] ) ] spids: [529] ) (SimpleCommand words: [{(echo)} {(DQ (${ VSub_Name after_start))}] redirects: [(Redir op_id:Redir_DGreat fd:-1 arg_word:{(build-log-cut.txt)} spids:[553])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:start_time_raw) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(grep)} {(-m)} {(1)} {(-o)} { (SQ < "[0-9][0-9][0-9][0-9][[:blank:]][0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]*" > ) } {(build-log-cut.txt)} ) ] ) left_token: spids: [561 575] ) } spids: [560] ) ] spids: [560] ) (C {(rm)} {(build-log-cut.txt)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:start_time) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {(${ VSub_Name start_time_raw)}) (C {(sed)} {(SQ <"s/^.\\{2\\}/&\\//">)}) ] negated: False ) ] ) left_token: spids: [585 599] ) } spids: [584] ) ] spids: [584] ) (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Started at ") (${ VSub_Name start_time))} ] more_env: [(env_pair name:V val:{(2)} spids:[601])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:end_time) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(grep)} {(-o)} { (SQ < "[0-9][0-9][0-9][0-9][[:blank:]][0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9]*" > ) } {(${ VSub_Name BUILD_LOG_PATH)} ) (C {(tail)} {(-1)}) (C {(sed)} {(SQ <"s/^.\\{2\\}/&\\//">)}) ] negated: False ) ] ) left_token: spids: [623 649] ) } spids: [622] ) ] spids: [622] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:start_time_epoch) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(date)} {(-d)} {(DQ (${ VSub_Name start_time))} {(Lit_Other "+") (Lit_Other "%") (s)} ) ] ) left_token: spids: [655 669] ) } spids: [654] ) ] spids: [654] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:end_time_epoch) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(date)} {(-d)} {(DQ (${ VSub_Name end_time))} {(Lit_Other "+") (Lit_Other "%") (s)} ) ] ) left_token: spids: [672 686] ) } spids: [671] ) ] spids: [671] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:BUILD_STAMP) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name "$start_time")}) (C {(sed)} {(SQ <"s/\\///">)}) (C {(sed)} {(SQ <"s/ /_/">)}) ] negated: False ) ] ) left_token: spids: [693 713] ) } spids: [692] ) ] spids: [692] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:GCS_LOGS_PATH) op: Equal rhs: {(DQ (${ VSub_Name GCS_JOBS_PATH) (/) (${ VSub_Name BUILD_STAMP))} spids: [716] ) ] spids: [716] ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (C {(gsutil)} {(ls)} {(DQ (${ VSub_Name GCS_JOBS_PATH))}) (C {(grep)} {(-q)} {(DQ (${ VSub_Name BUILD_STAMP))}) ] negated: False ) terminator: ) ] action: [ (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Log files already uploaded"))} ] more_env: [(env_pair name:V val:{(2)} spids:[759])] ) (C {(echo)} {(DQ ("Gubernator linked below:"))}) (C {(echo)} {(DQ (k8s-gubernator.appspot.com/build/) (${ VSub_Name GCS_LOGS_PATH) ("?local=on"))} ) (C {(exit)}) ] spids: [-1 756] ) ] spids: [-1 795] ) (ForEach iter_name: result iter_words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(find)} {(${ VSub_Name ARTIFACTS)} {(-type)} {(d)} {(-name)} {(DQ (results))}) ] ) left_token: spids: [804 820] ) } ] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalAnd left: (BoolBinary op_id: BoolBinary_GlobNEqual left: {($ VSub_Name "$result")} right: {(DQ )} ) right: (LogicalAnd left: (BoolBinary op_id: BoolBinary_GlobNEqual left: {($ VSub_Name "$result")} right: {(DQ (${ VSub_Name ARTIFACTS) (/results))} ) right: (BoolBinary op_id: BoolBinary_GlobNEqual left: {($ VSub_Name "$result")} right: {($ VSub_Name "$ARTIFACTS")} ) ) ) ) terminator: ) ] action: [ (C {(mv)} {($ VSub_Name "$result") (/) (Lit_Other "*")} {($ VSub_Name "$ARTIFACTS")}) ] spids: [-1 861] ) ] spids: [-1 873] ) ] spids: [823 875] ) spids: [803 821] ) (ForEach iter_name: upload_attempt iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(seq)} {(3)})]) left_token: spids: [887 891] ) } ] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (LogicalAnd left: (BoolUnary op_id:BoolUnary_d child:{(DQ (${ VSub_Name ARTIFACTS))}) right: (BoolUnary op_id: BoolUnary_n child: { (CommandSubPart command_list: (CommandList children: [(C {(ls)} {(-A)} {(DQ (${ VSub_Name ARTIFACTS))})] ) left_token: spids: [913 923] ) } ) ) ) terminator: ) ] action: [ (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status) } {(DQ ("Uploading artifacts"))} ] more_env: [(env_pair name:V val:{(2)} spids:[931])] ) (AndOr children: [ (C {(gsutil)} {(-m)} {(-q)} {(-o)} {(DQ ("GSUtil:use_magicfile=True"))} {(cp)} {(-a)} {(DQ (${ VSub_Name gcs_acl))} {(-r)} {(-c)} {(-z)} {(log) (Lit_Comma ",") (xml) (Lit_Comma ",") (json)} {(DQ (${ VSub_Name ARTIFACTS))} {(DQ (${ VSub_Name GCS_LOGS_PATH) (/artifacts))} ) (ControlFlow token:) ] op_id: Op_DPipe ) ] spids: [-1 928] ) ] spids: [-1 1001] ) (ControlFlow token:) ] spids: [894 1006] ) spids: [886 892] ) (ForEach iter_name: upload_attempt iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(seq)} {(3)})]) left_token: spids: [1014 1018] ) } ] do_arg_iter: False body: (DoGroup children: [ (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id:BoolUnary_e child:{(DQ (${ VSub_Name BUILD_LOG_PATH))}) ) terminator: ) ] action: [ (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status) } {(DQ ("Uploading build log"))} ] more_env: [(env_pair name:V val:{(2)} spids:[1042])] ) (AndOr children: [ (C {(gsutil)} {(-q)} {(cp)} {(-Z)} {(-a)} {(DQ (${ VSub_Name gcs_acl))} {(DQ (${ VSub_Name BUILD_LOG_PATH))} {(DQ (${ VSub_Name GCS_LOGS_PATH))} ) (ControlFlow token:) ] op_id: Op_DPipe ) ] spids: [-1 1039] ) ] spids: [-1 1091] ) (ControlFlow token:) ] spids: [1021 1096] ) spids: [1013 1019] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:version) op:Equal rhs:{(DQ )} spids:[1103])] spids: [1103] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr:(BoolUnary op_id:BoolUnary_e child:{(DQ (version))})) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(cat)} {(DQ (version))})]) left_token: spids: [1124 1130] ) } spids: [1123] ) ] spids: [1123] ) ] spids: [-1 1120] ) (if_arm cond: [ (Sentence child: (DBracket expr:(BoolUnary op_id:BoolUnary_e child:{(DQ (hack/lib/version.sh))})) terminator: ) ] action: [ (C {(export)} {(Lit_VarLike "KUBE_ROOT=") (DQ (.))}) (C {(source)} {(DQ (hack/lib/version.sh))}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (version) (Lit_Other ":") (Lit_Other ":") (get_version_vars) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(SQ )}) spids: [1174 1177] ) ) } spids: [1172] ) ] spids: [1172] ) ] spids: [1132 1145] ) ] spids: [-1 1180] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr:(BoolUnary op_id:BoolUnary_n child:{(DQ (${ VSub_Name version))})) terminator: ) ] action: [ (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Found Kubernetes version: ") (${ VSub_Name version))} ] more_env: [(env_pair name:V val:{(2)} spids:[1200])] ) ] spids: [-1 1197] ) ] else_action: [ (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Could not find Kubernetes version"))} ] more_env: [(env_pair name:V val:{(2)} spids:[1221])] ) ] spids: [1218 1236] ) (If arms: [ (if_arm cond: [(C {(grep)} {(-Fxq)} {(DQ ("Test Suite Passed"))} {(DQ (${ VSub_Name BUILD_LOG_PATH))})] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:build_result) op: Equal rhs: {(DQ (SUCCESS))} spids: [1262] ) ] spids: [1262] ) ] spids: [-1 1259] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:build_result) op: Equal rhs: {(DQ (FAILURE))} spids: [1270] ) ] spids: [1270] ) ] spids: [1267 1275] ) (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Build result is ") (${ VSub_Name build_result))} ] more_env: [(env_pair name:V val:{(4)} spids:[1278])] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_e child: {(DQ (${ VSub_Name ARTIFACTS) (/started.json))} ) ) terminator: ) ] action: [(C {(rm)} {(DQ (${ VSub_Name ARTIFACTS) (/started.json))})] spids: [-1 1313] ) ] spids: [-1 1325] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_e child: {(DQ (${ VSub_Name ARTIFACTS) (/finished.json))} ) ) terminator: ) ] action: [(C {(rm)} {(DQ (${ VSub_Name ARTIFACTS) (/finished.json))})] spids: [-1 1344] ) ] spids: [-1 1356] ) (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Constructing started.json and finished.json files"))} ] more_env: [(env_pair name:V val:{(2)} spids:[1359])] ) (SimpleCommand words: [{(echo)} {(DQ ("{"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name ARTIFACTS) (/started.json))} spids: [1380] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ (" ") (EscapedLiteralPart token:) (version) (EscapedLiteralPart token:) (": ") (EscapedLiteralPart token:) (${ VSub_Name version) (EscapedLiteralPart token:) (",") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name ARTIFACTS) (/started.json))} spids: [1405] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ (" ") (EscapedLiteralPart token:) (timestamp) (EscapedLiteralPart token:) (": ") (${ VSub_Name start_time_epoch) (",") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name ARTIFACTS) (/started.json))} spids: [1428] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ (" ") (EscapedLiteralPart token:) (jenkins-node) (EscapedLiteralPart token:) (": ") (EscapedLiteralPart token:) (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [1446 1449] ) (EscapedLiteralPart token:) ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name ARTIFACTS) (/started.json))} spids: [1453] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ("}"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name ARTIFACTS) (/started.json))} spids: [1468] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ("{"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name ARTIFACTS) (/finished.json))} spids: [1484] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ (" ") (EscapedLiteralPart token:) (result) (EscapedLiteralPart token:) (": ") (EscapedLiteralPart token:) (${ VSub_Name build_result) (EscapedLiteralPart token:) (",") ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name ARTIFACTS) (/finished.json))} spids: [1509] ) ] ) (SimpleCommand words: [ {(echo)} { (DQ (" ") (EscapedLiteralPart token:) (timestamp) (EscapedLiteralPart token:) (": ") (${ VSub_Name end_time_epoch) ) } ] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name ARTIFACTS) (/finished.json))} spids: [1531] ) ] ) (SimpleCommand words: [{(echo)} {(DQ ("}"))}] redirects: [ (Redir op_id: Redir_DGreat fd: -1 arg_word: {(DQ (${ VSub_Name ARTIFACTS) (/finished.json))} spids: [1546] ) ] ) (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Uploading started.json and finished.json"))} ] more_env: [(env_pair name:V val:{(2)} spids:[1560])] ) (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} {(DQ ("Run started at ") (${ VSub_Name start_time))} ] more_env: [(env_pair name:V val:{(2)} spids:[1575])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:json_file) op: Equal rhs: {(DQ (${ VSub_Name GCS_LOGS_PATH) (/started.json))} spids: [1593] ) ] spids: [1593] ) (ForEach iter_name: upload_attempt iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(seq)} {(3)})]) left_token: spids: [1608 1612] ) } ] do_arg_iter: False body: (DoGroup children: [ (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} { (DQ ("Uploading started.json to ") (${ VSub_Name json_file) (" (attempt ") (${ VSub_Name upload_attempt) (")") ) } ] more_env: [(env_pair name:V val:{(2)} spids:[1618])] ) (AndOr children: [ (C {(gsutil)} {(-q)} {(-h)} {(DQ ("Content-Type:application/json"))} {(cp)} {(-a)} {(DQ (${ VSub_Name gcs_acl))} {(DQ (${ VSub_Name ARTIFACTS) (/started.json))} {(DQ (${ VSub_Name json_file))} ) (ControlFlow token:) ] op_id: Op_DPipe ) (ControlFlow token:) ] spids: [1615 1684] ) spids: [1607 1613] ) (ForEach iter_name: upload_attempt iter_words: [ { (CommandSubPart command_list: (CommandList children:[(C {(seq)} {(3)})]) left_token: spids: [1696 1700] ) } ] do_arg_iter: False body: (DoGroup children: [ (SimpleCommand words: [ {(kube) (Lit_Other ":") (Lit_Other ":") (log) (Lit_Other ":") (Lit_Other ":") (status)} { (DQ ("Uploading finished.json to ") (${ VSub_Name GCS_LOGS_PATH) (" (attempt ") (${ VSub_Name upload_attempt) (")") ) } ] more_env: [(env_pair name:V val:{(2)} spids:[1706])] ) (AndOr children: [ (C {(gsutil)} {(-q)} {(-h)} {(DQ ("Content-Type:application/json"))} {(cp)} {(-a)} {(DQ (${ VSub_Name gcs_acl))} {(DQ (${ VSub_Name ARTIFACTS) (/finished.json))} {(DQ (${ VSub_Name GCS_LOGS_PATH) (/finished.json))} ) (ControlFlow token:) ] op_id: Op_DPipe ) (ControlFlow token:) ] spids: [1703 1773] ) spids: [1695 1701] ) (C {(echo)} {(DQ ("Gubernator linked below:"))}) (C {(echo)} { (DQ (k8s-gubernator.appspot.com/build/) (${ VSub_Name bucket_name) (/logs/e2e-node/) (${ VSub_Name BUILD_STAMP) ) } ) ] )