(CommandList
  children: [
    (C {(set)} {(-o)} {(errexit)})
    (C {(set)} {(-o)} {(nounset)})
    (C {(set)} {(-o)} {(pipefail)})
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (LogicalAnd
                      left: 
                        (BoolUnary
                          op_id: BoolUnary_n
                          child: 
                            {
                              (DQ 
                                (BracedVarSub
                                  token: <VSub_Name JENKINS_BUILD_STARTED>
                                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                                  spids: [123 126]
                                )
                              )
                            }
                        )
                      right: 
                        (BoolUnary
                          op_id: BoolUnary_n
                          child: 
                            {
                              (DQ 
                                (BracedVarSub
                                  token: <VSub_Name JENKINS_BUILD_FINISHED>
                                  suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                                  spids: [134 137]
                                )
                              )
                            }
                        )
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(echo)} 
              {
                (DQ 
                  (
'Error: JENKINS_BUILD_STARTED and JENKINS_BUILD_FINISHED should not both be set!'
                  )
                )
              }
            )
            (C {(exit)} {(1)})
          ]
          spids: [16777215 143]
        )
      ]
      spids: [16777215 157]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (LogicalNot
                      child: 
                        (BoolBinary
                          op_id: BoolBinary_EqualTilde
                          left: 
                            {
                              (BracedVarSub
                                token: <VSub_Name JENKINS_UPLOAD_TO_GCS>
                                suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(y)})
                                spids: [166 170]
                              )
                            }
                          right: 
                            {(Lit_Other '^') (Lit_Other '[') (yY) (Lit_Other ']') (Lit_Other '$')}
                        )
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [(C {(exit)} {(0)})]
          spids: [16777215 183]
        )
      ]
      spids: [16777215 190]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:GCS_SUBDIR) op:Equal rhs:{(DQ )} spids:[211])]
      spids: [211]
    )
    (Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (LhsName name:remote_git_repo)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (AndOr
                        children: [
                          (Pipeline
                            children: [
                              (C {(git)} {(config)} {(--get)} {(remote.remote.url)})
                              (C {(sed)} {(SQ <'s:.*github.com/::'>)})
                            ]
                            negated: False
                          )
                          (C {(true)})
                        ]
                        op_id: Op_DPipe
                      )
                    ]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [218 238]
              )
            }
          spids: [217]
        )
      ]
      spids: [215]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: (BoolUnary op_id:BoolUnary_n child:{(DQ (${ VSub_Name remote_git_repo))})
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (Case
              to_match: {(DQ (${ VSub_Name remote_git_repo))}
              arms: [
                (case_arm
                  pat_list: [{(kubernetes/kubernetes)}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:GCS_SUBDIR)
                          op: Equal
                          rhs: {(DQ )}
                          spids: [276]
                        )
                      ]
                      spids: [276]
                    )
                  ]
                  spids: [273 274 280 16777215]
                )
                (case_arm
                  pat_list: [{(kubernetes/) (Lit_Other '*')}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:GCS_SUBDIR)
                          op: Equal
                          rhs: 
                            {
                              (DQ 
                                (BracedVarSub
                                  token: <VSub_Name remote_git_repo>
                                  suffix_op: 
                                    (StringUnary
                                      op_id: VOp1_Pound
                                      arg_word: {(kubernetes) (Lit_Slash /)}
                                    )
                                  spids: [293 298]
                                ) (/)
                              )
                            }
                          spids: [291]
                        )
                      ]
                      spids: [291]
                    )
                  ]
                  spids: [287 289 302 16777215]
                )
                (case_arm
                  pat_list: [{(Lit_Other '*')}]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:GCS_SUBDIR)
                          op: Equal
                          rhs: 
                            {
                              (DQ 
                                (BracedVarSub
                                  token: <VSub_Name remote_git_repo>
                                  suffix_op: 
                                    (PatSub
                                      pat: {(EscapedLiteralPart token:<Lit_EscapedChar '\\/'>)}
                                      replace: {(_)}
                                      do_all: False
                                      do_prefix: False
                                      do_suffix: False
                                    )
                                  spids: [314 320]
                                ) (/)
                              )
                            }
                          spids: [312]
                        )
                      ]
                      spids: [312]
                    )
                  ]
                  spids: [309 310 324 16777215]
                )
              ]
              spids: [258 266 327]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolBinary
                              op_id: BoolBinary_GlobNEqual
                              left: {(DQ (${ VSub_Name remote_git_repo))}
                              right: {(DQ (kubernetes/kubernetes))}
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(export)} 
                      {(Lit_VarLike 'BUILD_METADATA_REPO=') (DQ (${ VSub_Name remote_git_repo))}
                    )
                  ]
                  spids: [16777215 349]
                )
              ]
              spids: [16777215 366]
            )
          ]
          spids: [16777215 255]
        )
      ]
      spids: [16777215 368]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolBinary
                      op_id: BoolBinary_EqualTilde
                      left: {(${ VSub_Name JOB_NAME)}
                      right: {(-pull-)}
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (C {(Lit_Other ':')} 
              {
                (BracedVarSub
                  token: <VSub_Name JENKINS_GCS_LOGS_PATH>
                  suffix_op: 
                    (StringUnary
                      op_id: VTest_ColonEquals
                      arg_word: 
                        {
                          (DQ ('gs://kubernetes-jenkins/pr-logs/pull/') (${ VSub_Name GCS_SUBDIR) 
                            (BracedVarSub
                              token: <VSub_Name ghprbPullId>
                              suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(unknown)})
                              spids: [399 403]
                            )
                          )
                        }
                    )
                  spids: [391 405]
                )
              }
            )
            (C {(Lit_Other ':')} 
              {
                (BracedVarSub
                  token: <VSub_Name JENKINS_GCS_LATEST_PATH>
                  suffix_op: 
                    (StringUnary
                      op_id: VTest_ColonEquals
                      arg_word: {(DQ ('gs://kubernetes-jenkins/pr-logs/directory'))}
                    )
                  spids: [410 416]
                )
              }
            )
            (C {(Lit_Other ':')} 
              {
                (BracedVarSub
                  token: <VSub_Name JENKINS_GCS_LOGS_INDIRECT>
                  suffix_op: 
                    (StringUnary
                      op_id: VTest_ColonEquals
                      arg_word: 
                        {(DQ ('gs://kubernetes-jenkins/pr-logs/directory/') (${ VSub_Name JOB_NAME))}
                    )
                  spids: [421 430]
                )
              }
            )
          ]
          spids: [16777215 386]
        )
      ]
      else_action: [
        (C {(Lit_Other ':')} 
          {
            (BracedVarSub
              token: <VSub_Name JENKINS_GCS_LOGS_PATH>
              suffix_op: 
                (StringUnary
                  op_id: VTest_ColonEquals
                  arg_word: {(DQ ('gs://kubernetes-jenkins/logs'))}
                )
              spids: [437 443]
            )
          }
        )
        (C {(Lit_Other ':')} 
          {
            (BracedVarSub
              token: <VSub_Name JENKINS_GCS_LATEST_PATH>
              suffix_op: 
                (StringUnary
                  op_id: VTest_ColonEquals
                  arg_word: {(DQ ('gs://kubernetes-jenkins/logs'))}
                )
              spids: [448 454]
            )
          }
        )
        (C {(Lit_Other ':')} 
          {
            (BracedVarSub
              token: <VSub_Name JENKINS_GCS_LOGS_INDIRECT>
              suffix_op: (StringUnary op_id:VTest_ColonEquals arg_word:{(DQ )})
              spids: [459 464]
            )
          }
        )
      ]
      spids: [432 466]
    )
    (Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (LhsName name:artifacts_path)
          op: Equal
          rhs: {(DQ (${ VSub_Name WORKSPACE) (/_artifacts))}
          spids: [471]
        )
      ]
      spids: [469]
    )
    (Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (LhsName name:gcs_job_path)
          op: Equal
          rhs: {(DQ (${ VSub_Name JENKINS_GCS_LOGS_PATH) (/) (${ VSub_Name JOB_NAME))}
          spids: [481]
        )
      ]
      spids: [479]
    )
    (Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (LhsName name:gcs_build_path)
          op: Equal
          rhs: {(DQ (${ VSub_Name gcs_job_path) (/) (${ VSub_Name BUILD_NUMBER))}
          spids: [494]
        )
      ]
      spids: [492]
    )
    (Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (LhsName name:gcs_latest_path)
          op: Equal
          rhs: {(DQ (${ VSub_Name JENKINS_GCS_LATEST_PATH) (/) (${ VSub_Name JOB_NAME))}
          spids: [507]
        )
      ]
      spids: [505]
    )
    (Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (LhsName name:gcs_indirect_path)
          op: Equal
          rhs: {(DQ (${ VSub_Name JENKINS_GCS_LOGS_INDIRECT))}
          spids: [520]
        )
      ]
      spids: [518]
    )
    (Assignment
      keyword: Assign_Readonly
      pairs: [(assign_pair lhs:(LhsName name:gcs_acl) op:Equal rhs:{(DQ (public-read))} spids:[529])]
      spids: [527]
    )
    (Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (LhsName name:results_url)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Name gcs_build_path>
                suffix_op: 
                  (PatSub
                    pat: {(DQ ('gs:/'))}
                    replace: {(DQ ('https://console.cloud.google.com/storage/browser'))}
                    do_all: True
                    do_prefix: False
                    do_suffix: False
                  )
                spids: [537 548]
              )
            }
          spids: [536]
        )
      ]
      spids: [534]
    )
    (Assignment
      keyword: Assign_Readonly
      pairs: [
        (assign_pair
          lhs: (LhsName name:timestamp)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [(C {(date)} {(Lit_Other '+') (Lit_Other '%') (s)})]
                  )
                left_token: <Left_CommandSub '$('>
                spids: [553 559]
              )
            }
          spids: [552]
        )
      ]
      spids: [550]
    )
    (FuncDef
      name: set_kubernetes_base_path
      body: 
        (BraceGroup
          children: [
            (ForEach
              iter_name: kubernetes_base_path
              iter_words: [{(kubernetes)} {(go/src/k8s.io/kubernetes)} {(.)}]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (AndOr
                      children: [
                        (DBracket
                          expr: 
                            (BoolUnary
                              op_id: BoolUnary_f
                              child: {(${ VSub_Name kubernetes_base_path) (/cluster/common.sh)}
                            )
                        )
                        (ControlFlow token:<ControlFlow_Break break>)
                      ]
                      op_id: Op_DAmp
                    )
                  ]
                  spids: [594 622]
                )
              spids: [586 592]
            )
          ]
          spids: [578]
        )
      spids: [571 577]
    )
    (FuncDef
      name: find_version
      body: 
        (BraceGroup
          children: [
            (Subshell
              child: 
                (CommandList
                  children: [
                    (C {(set_kubernetes_base_path)})
                    (C {(cd)} {(${ VSub_Name kubernetes_base_path)})
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: (DBracket expr:(BoolUnary op_id:BoolUnary_e child:{(DQ (version))}))
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [(C {(cat)} {(version)})]
                          spids: [16777215 685]
                        )
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: (BoolUnary op_id:BoolUnary_e child:{(DQ (hack/lib/version.sh))})
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          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)
                              }
                            )
                            (C {(echo)} 
                              {
                                (DQ 
                                  (BracedVarSub
                                    token: <VSub_Name KUBE_GIT_VERSION>
                                    suffix_op: (StringUnary op_id:VTest_Hyphen arg_word:{(SQ )})
                                    spids: [736 739]
                                  )
                                )
                              }
                            )
                          ]
                          spids: [693 706]
                        )
                      ]
                      else_action: [
                        (Pipeline
                          children: [
                            (SimpleCommand
                              words: [{(gsutil)} {(cat)} {(${ VSub_Name gcs_build_path) (/started.json)}]
                              redirects: [
                                (Redir
                                  op_id: Redir_Great
                                  fd: 2
                                  arg_word: {(/dev/null)}
                                  spids: [759]
                                )
                              ]
                            )
                            (C {(sed)} {(-n)} {(SQ <'s/ *"version": *"\\([^"]*\\)",*/\\1/p'>)})
                          ]
                          negated: False
                        )
                      ]
                      spids: [743 774]
                    )
                  ]
                )
              spids: [645 777]
            )
          ]
          spids: [642]
        )
      spids: [636 641]
    )
    (FuncDef
      name: print_started
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              pairs: [
                (assign_pair
                  lhs: (LhsName name:metadata_keys)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: 
                          (CommandList
                            children: [
                              (Pipeline
                                children: [
                                  (C {(compgen)} {(-e)})
                                  (C {(grep)} {(Lit_Other '^') (BUILD_METADATA_)})
                                ]
                                negated: False
                              )
                            ]
                          )
                        left_token: <Left_CommandSub '$('>
                        spids: [797 808]
                      )
                    }
                  spids: [796]
                )
              ]
              spids: [794]
            )
            (C {(echo)} {(DQ ('{'))})
            (C {(echo)} 
              {
                (DQ ('    ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (version) 
                  (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (${ VSub_Name version) 
                  (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (',')
                )
              }
            )
            (C {(echo)} 
              {
                (DQ ('    ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (job-version) 
                  (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (${ VSub_Name version) 
                  (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (',')
                )
              }
            )
            (C {(echo)} 
              {
                (DQ ('    ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (timestamp) 
                  (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') (${ VSub_Name timestamp) (',')
                )
              }
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolUnary op_id:BoolUnary_n child:{(DQ (${ VSub_Name metadata_keys))})
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(echo)} 
                      {
                        (DQ ('    ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (metadata) 
                          (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': {')
                        )
                      }
                    )
                    (Assignment
                      keyword: Assign_Local
                      pairs: [(assign_pair lhs:(LhsName name:sep) op:Equal rhs:{(DQ )} spids:[909])]
                      spids: [907]
                    )
                    (ForEach
                      iter_name: env_var
                      iter_words: [{($ VSub_Name '$metadata_keys')}]
                      do_arg_iter: False
                      body: 
                        (DoGroup
                          children: [
                            (Assignment
                              keyword: Assign_Local
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:var_upper)
                                  op: Equal
                                  rhs: 
                                    {
                                      (DQ 
                                        (BracedVarSub
                                          token: <VSub_Name env_var>
                                          suffix_op: 
                                            (StringUnary
                                              op_id: VOp1_Pound
                                              arg_word: {(BUILD_METADATA_)}
                                            )
                                          spids: [933 937]
                                        )
                                      )
                                    }
                                  spids: [931]
                                )
                              ]
                              spids: [929]
                            )
                            (C {(echo)} 
                              {
                                (DQ ('        ') ($ VSub_Name '$sep') 
                                  (EscapedLiteralPart
                                    token: <Lit_EscapedChar '\\"'>
                                  ) 
                                  (BracedVarSub
                                    token: <VSub_Name var_upper>
                                    suffix_op: (StringUnary op_id:VOp1_DComma arg_word:{(SQ )})
                                    spids: [947 950]
                                  ) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') 
                                  (EscapedLiteralPart
                                    token: <Lit_EscapedChar '\\"'>
                                  ) (BracedVarSub token:<VSub_Name env_var> prefix_op:VSub_Bang spids:[954 957]) 
                                  (EscapedLiteralPart
                                    token: <Lit_EscapedChar '\\"'>
                                  )
                                )
                              }
                            )
                            (Assignment
                              keyword: Assign_None
                              pairs: [
                                (assign_pair
                                  lhs: (LhsName name:sep)
                                  op: Equal
                                  rhs: {(DQ (','))}
                                  spids: [962]
                                )
                              ]
                              spids: [962]
                            )
                          ]
                          spids: [926 968]
                        )
                      spids: [922 924]
                    )
                    (C {(echo)} {(DQ ('    },'))})
                  ]
                  spids: [16777215 885]
                )
              ]
              spids: [16777215 978]
            )
            (C {(echo)} 
              {
                (DQ ('    ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (jenkins-node) 
                  (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) 
                  (BracedVarSub
                    token: <VSub_Name NODE_NAME>
                    suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                    spids: [990 993]
                  ) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>)
                )
              }
            )
            (C {(echo)} {(DQ ('}'))})
          ]
          spids: [791]
        )
      spids: [785 790]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolUnary
                      op_id: BoolUnary_n
                      child: 
                        {
                          (DQ 
                            (BracedVarSub
                              token: <VSub_Name TEST_STARTED_JSON>
                              suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                              spids: [1017 1020]
                            )
                          )
                        }
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:version)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(find_version)})])
                        left_token: <Left_CommandSub '$('>
                        spids: [1030 1032]
                      )
                    }
                  spids: [1029]
                )
              ]
              spids: [1029]
            )
            (Pipeline
              children: [
                (C {(cat)} 
                  {
                    (CommandSubPart
                      command_list: (CommandList children:[(C {(print_started)})])
                      left_token: <Left_ProcSubIn '<('>
                      spids: [1037 1039]
                    )
                  }
                )
                (C {(jq)} {(.)})
              ]
              negated: False
            )
            (C {(exit)})
          ]
          spids: [16777215 1026]
        )
      ]
      spids: [16777215 1050]
    )
    (FuncDef
      name: upload_version
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              flags: [-r]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:version)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(find_version)})])
                        left_token: <Left_CommandSub '$('>
                        spids: [1067 1069]
                      )
                    }
                  spids: [1066]
                )
              ]
              spids: [1062]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:upload_attempt) op:Equal spids:[1074])]
              spids: [1072]
            )
            (Sentence
              child: (C {(echo)} {(-n)} {(SQ <'Run starting at '>)})
              terminator: <Op_Semi ';'>
            )
            (C {(date)} {(-d)} {(DQ ('@') (${ VSub_Name timestamp))})
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolUnary op_id:BoolUnary_n child:{(DQ (${ VSub_Name version))})
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(echo)} {(DQ ('Found Kubernetes version: ') (${ VSub_Name version))})]
                  spids: [16777215 1115]
                )
              ]
              else_action: [(C {(echo)} {(DQ ('Could not find Kubernetes version'))})]
              spids: [1128 1138]
            )
            (Assignment
              keyword: Assign_Local
              flags: [-r]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:json_file)
                  op: Equal
                  rhs: {(DQ (${ VSub_Name gcs_build_path) (/started.json))}
                  spids: [1146]
                )
              ]
              spids: [1142]
            )
            (ForEach
              iter_name: upload_attempt
              iter_words: [{(Lit_LBrace '{') (1..3) (Lit_RBrace '}')}]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (C {(echo)} 
                      {
                        (DQ ('Uploading version to: ') (${ VSub_Name json_file) (' (attempt ') 
                          (${ VSub_Name upload_attempt) (')')
                        )
                      }
                    )
                    (AndOr
                      children: [
                        (C {(gsutil)} {(-q)} {(-h)} {(DQ ('Content-Type:application/json'))} {(cp)} {(-a)} 
                          {(DQ (${ VSub_Name gcs_acl))} 
                          {
                            (CommandSubPart
                              command_list: (CommandList children:[(C {(print_started)})])
                              left_token: <Left_ProcSubIn '<('>
                              spids: [1204 1206]
                            )
                          } {(DQ (${ VSub_Name json_file))}
                        )
                        (ControlFlow token:<ControlFlow_Continue continue>)
                      ]
                      op_id: Op_DPipe
                    )
                    (ControlFlow token:<ControlFlow_Break break>)
                  ]
                  spids: [1166 1222]
                )
              spids: [1160 1164]
            )
          ]
          spids: [1059]
        )
      spids: [1053 1058]
    )
    (FuncDef
      name: update_job_result_cache
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              flags: [-r]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:build_result)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [1261]
                )
              ]
              spids: [1257]
            )
            (Assignment
              keyword: Assign_Local
              flags: [-r]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:version)
                  op: Equal
                  rhs: 
                    {
                      (CommandSubPart
                        command_list: (CommandList children:[(C {(find_version)})])
                        left_token: <Left_CommandSub '$('>
                        spids: [1270 1272]
                      )
                    }
                  spids: [1269]
                )
              ]
              spids: [1265]
            )
            (Assignment
              keyword: Assign_Local
              flags: [-r]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:job_results)
                  op: Equal
                  rhs: {(${ VSub_Name gcs_job_path) (/jobResultsCache.json)}
                  spids: [1279]
                )
              ]
              spids: [1275]
            )
            (Assignment
              keyword: Assign_Local
              flags: [-r]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:tmp_results)
                  op: Equal
                  rhs: {(DQ (${ VSub_Name WORKSPACE) (/_tmp/jobResultsCache.tmp))}
                  spids: [1290]
                )
              ]
              spids: [1286]
            )
            (Assignment
              keyword: Assign_Local
              flags: [-r]
              pairs: [(assign_pair lhs:(LhsName name:cache_size) op:Equal rhs:{(300)} spids:[1319])]
              spids: [1315]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:upload_attempt) op:Equal spids:[1325])]
              spids: [1323]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: (BoolUnary op_id:BoolUnary_n child:{(DQ (${ VSub_Name version))})
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(echo)} {(DQ ('Found Kubernetes version: ') (${ VSub_Name version))})]
                  spids: [16777215 1344]
                )
              ]
              else_action: [(C {(echo)} {(DQ ('Could not find Kubernetes version'))})]
              spids: [1357 1367]
            )
            (C {(mkdir)} {(-p)} 
              {
                (BracedVarSub
                  token: <VSub_Name tmp_results>
                  suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ('*')})
                  spids: [1375 1380]
                )
              }
            )
            (SimpleCommand
              words: [{(echo)} {(DQ ('['))}]
              redirects: [
                (Redir
                  op_id: Redir_Great
                  fd: 16777215
                  arg_word: {(${ VSub_Name tmp_results)}
                  spids: [1394]
                )
              ]
            )
            (ForEach
              iter_name: upload_attempt
              iter_words: [
                {
                  (CommandSubPart
                    command_list: (CommandList children:[(C {(seq)} {(3)})])
                    left_token: <Left_CommandSub '$('>
                    spids: [1408 1412]
                  )
                }
              ]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (C {(echo)} 
                      {
                        (DQ ('Copying ') (${ VSub_Name job_results) (' to ') (${ VSub_Name tmp_results) 
                          (' (attempt ') (${ VSub_Name upload_attempt) (')')
                        )
                      }
                    )
                    (AndOr
                      children: [
                        (Pipeline
                          children: [
                            (SimpleCommand
                              words: [{(gsutil)} {(-q)} {(cat)} {(${ VSub_Name job_results)}]
                              redirects: [
                                (Redir
                                  op_id: Redir_GreatAnd
                                  fd: 2
                                  arg_word: {(-)}
                                  spids: [1455]
                                )
                              ]
                            )
                            (C {(sed)} {(-n)} {(SQ <'s/^\\({"version".*}\\),*/\\1,/p'>)})
                            (SimpleCommand
                              words: [{(tail)} {(-) (${ VSub_Name cache_size)}]
                              redirects: [
                                (Redir
                                  op_id: Redir_DGreat
                                  fd: 16777215
                                  arg_word: {(${ VSub_Name tmp_results)}
                                  spids: [1479]
                                )
                              ]
                            )
                          ]
                          negated: False
                        )
                        (ControlFlow token:<ControlFlow_Continue continue>)
                      ]
                      op_id: Op_DPipe
                    )
                    (ControlFlow token:<ControlFlow_Break break>)
                  ]
                  spids: [1415 1493]
                )
              spids: [1407 1413]
            )
            (SimpleCommand
              words: [
                {(echo)}
                {
                  (DQ ('{') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (version) 
                    (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (${ VSub_Name version) 
                    (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (', ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (buildnumber) 
                    (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (${ VSub_Name BUILD_NUMBER) 
                    (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (',')
                  )
                }
                {
                  (DQ (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (result) 
                    (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (${ VSub_Name build_result) 
                    (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) ('}')
                  )
                }
              ]
              redirects: [
                (Redir
                  op_id: Redir_DGreat
                  fd: 16777215
                  arg_word: {(${ VSub_Name tmp_results)}
                  spids: [1538]
                )
              ]
            )
            (SimpleCommand
              words: [{(echo)} {(DQ (']'))}]
              redirects: [
                (Redir
                  op_id: Redir_DGreat
                  fd: 16777215
                  arg_word: {(${ VSub_Name tmp_results)}
                  spids: [1552]
                )
              ]
            )
            (ForEach
              iter_name: upload_attempt
              iter_words: [
                {
                  (CommandSubPart
                    command_list: (CommandList children:[(C {(seq)} {(3)})])
                    left_token: <Left_CommandSub '$('>
                    spids: [1566 1570]
                  )
                }
              ]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (C {(echo)} 
                      {
                        (DQ ('Copying ') (${ VSub_Name tmp_results) (' to ') (${ VSub_Name job_results) 
                          (' (attempt ') (${ VSub_Name upload_attempt) (')')
                        )
                      }
                    )
                    (AndOr
                      children: [
                        (C {(gsutil)} {(-q)} {(-h)} {(DQ ('Content-Type:application/json'))} {(cp)} {(-a)} 
                          {(DQ (${ VSub_Name gcs_acl))} {(${ VSub_Name tmp_results)} {(${ VSub_Name job_results)}
                        )
                        (ControlFlow token:<ControlFlow_Continue continue>)
                      ]
                      op_id: Op_DPipe
                    )
                    (ControlFlow token:<ControlFlow_Break break>)
                  ]
                  spids: [1573 1633]
                )
              spids: [1565 1571]
            )
            (C {(rm)} {(-f)} {(${ VSub_Name tmp_results)})
          ]
          spids: [1254]
        )
      spids: [1248 1253]
    )
    (FuncDef
      name: upload_artifacts_and_build_result
      body: 
        (BraceGroup
          children: [
            (Assignment
              keyword: Assign_Local
              flags: [-r]
              pairs: [
                (assign_pair
                  lhs: (LhsName name:build_result)
                  op: Equal
                  rhs: {($ VSub_Number '$1')}
                  spids: [1661]
                )
              ]
              spids: [1657]
            )
            (Assignment
              keyword: Assign_Local
              pairs: [(assign_pair lhs:(LhsName name:upload_attempt) op:Equal spids:[1667])]
              spids: [1665]
            )
            (Sentence
              child: (C {(echo)} {(-n)} {(SQ <'Run finished at '>)})
              terminator: <Op_Semi ';'>
            )
            (C {(date)} {(-d)} {(DQ ('@') (${ VSub_Name timestamp))})
            (ForEach
              iter_name: upload_attempt
              iter_words: [{(Lit_LBrace '{') (1..3) (Lit_RBrace '}')}]
              do_arg_iter: False
              body: 
                (DoGroup
                  children: [
                    (C {(echo)} 
                      {
                        (DQ ('Uploading to ') (${ VSub_Name gcs_build_path) (' (attempt ') 
                          (${ VSub_Name upload_attempt) (')')
                        )
                      }
                    )
                    (C {(echo)} {(DQ ('Uploading build result: ') (${ VSub_Name build_result))})
                    (AndOr
                      children: [
                        (C {(gsutil)} {(-q)} {(-h)} {(DQ ('Content-Type:application/json'))} {(cp)} {(-a)} 
                          {(DQ (${ VSub_Name gcs_acl))} 
                          {
                            (CommandSubPart
                              command_list: 
                                (CommandList
                                  children: [
                                    (C {(echo)} {(DQ ('{'))})
                                    (C {(echo)} 
                                      {
                                        (DQ ('    ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) 
                                          (result) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') 
                                          (EscapedLiteralPart
                                            token: <Lit_EscapedChar '\\"'>
                                          ) (${ VSub_Name build_result) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (',')
                                        )
                                      }
                                    )
                                    (C {(echo)} 
                                      {
                                        (DQ ('    ') (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) 
                                          (timestamp) (EscapedLiteralPart token:<Lit_EscapedChar '\\"'>) (': ') (${ VSub_Name timestamp)
                                        )
                                      }
                                    )
                                    (C {(echo)} {(DQ ('}'))})
                                  ]
                                )
                              left_token: <Left_ProcSubIn '<('>
                              spids: [1752 1800]
                            )
                          } {(DQ (${ VSub_Name gcs_build_path) (/finished.json))}
                        )
                        (ControlFlow token:<ControlFlow_Continue continue>)
                      ]
                      op_id: Op_DPipe
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: 
                                    (LogicalAnd
                                      left: 
                                        (BoolUnary
                                          op_id: BoolUnary_d
                                          child: {(DQ (${ VSub_Name artifacts_path))}
                                        )
                                      right: 
                                        (BoolUnary
                                          op_id: BoolUnary_n
                                          child: 
                                            {
                                              (CommandSubPart
                                                command_list: 
                                                  (CommandList
                                                    children: [
                                                      (C {(ls)} {(-A)} 
                                                        {(DQ (${ VSub_Name artifacts_path))}
                                                      )
                                                    ]
                                                  )
                                                left_token: <Left_CommandSub '$('>
                                                spids: [1830 1840]
                                              )
                                            }
                                        )
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} {(DQ ('Uploading artifacts'))})
                            (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 ',') (txt) (Lit_Comma ',') (xml)} {(DQ (${ VSub_Name artifacts_path))} {(DQ (${ VSub_Name gcs_build_path) (/artifacts))}
                                )
                                (ControlFlow
                                  token: <ControlFlow_Continue continue>
                                )
                              ]
                              op_id: Op_DPipe
                            )
                          ]
                          spids: [16777215 1845]
                        )
                      ]
                      spids: [16777215 1909]
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: 
                                    (BoolUnary
                                      op_id: BoolUnary_e
                                      child: {(DQ (${ VSub_Name WORKSPACE) (/build-log.txt))}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} {(DQ ('Uploading build log'))})
                            (C {(gsutil)} {(-q)} {(cp)} {(-Z)} {(-a)} {(DQ (${ VSub_Name gcs_acl))} 
                              {(DQ (${ VSub_Name WORKSPACE) (/build-log.txt))} {(DQ (${ VSub_Name gcs_build_path))}
                            )
                          ]
                          spids: [16777215 1928]
                        )
                      ]
                      spids: [16777215 1968]
                    )
                    (If
                      arms: [
                        (if_arm
                          cond: [
                            (Sentence
                              child: 
                                (DBracket
                                  expr: 
                                    (BoolBinary
                                      op_id: BoolBinary_GlobNEqual
                                      left: {(DQ (${ VSub_Name gcs_indirect_path))}
                                      right: {(DQ )}
                                    )
                                )
                              terminator: <Op_Semi ';'>
                            )
                          ]
                          action: [
                            (C {(echo)} 
                              {
                                (DQ ('Writing ') (${ VSub_Name gcs_build_path) (' to ') 
                                  (${ VSub_Name gcs_indirect_path) (/) (${ VSub_Name BUILD_NUMBER) (.txt)
                                )
                              }
                            )
                            (AndOr
                              children: [
                                (Pipeline
                                  children: [
                                    (C {(echo)} {(DQ (${ VSub_Name gcs_build_path))})
                                    (C {(gsutil)} {(-q)} {(-h)} {(DQ ('Content-Type:text/plain'))} {(cp)} 
                                      {(-a)} {(DQ (${ VSub_Name gcs_acl))} {(-)} 
                                      {
                                        (DQ (${ VSub_Name gcs_indirect_path) (/) 
                                          (${ VSub_Name BUILD_NUMBER) (.txt)
                                        )
                                      }
                                    )
                                  ]
                                  negated: False
                                )
                                (ControlFlow
                                  token: <ControlFlow_Continue continue>
                                )
                              ]
                              op_id: Op_DPipe
                            )
                            (C {(echo)} 
                              {
                                (DQ ('Marking build ') (${ VSub_Name BUILD_NUMBER) 
                                  (' as the latest completed build for this PR')
                                )
                              }
                            )
                            (AndOr
                              children: [
                                (Pipeline
                                  children: [
                                    (C {(echo)} {(DQ (${ VSub_Name BUILD_NUMBER))})
                                    (C {(gsutil)} {(-q)} {(-h)} {(DQ ('Content-Type:text/plain'))} {(-h)} 
                                      {(DQ ('Cache-Control:private, max-age=0, no-transform'))} {(cp)} {(-a)} {(DQ (${ VSub_Name gcs_acl))} {(-)} {(DQ (${ VSub_Name gcs_job_path) (/latest-build.txt))}
                                    )
                                  ]
                                  negated: False
                                )
                                (ControlFlow
                                  token: <ControlFlow_Continue continue>
                                )
                              ]
                              op_id: Op_DPipe
                            )
                          ]
                          spids: [16777215 1998]
                        )
                      ]
                      spids: [16777215 2137]
                    )
                    (C {(echo)} 
                      {
                        (DQ ('Marking build ') (${ VSub_Name BUILD_NUMBER) 
                          (' as the latest completed build')
                        )
                      }
                    )
                    (AndOr
                      children: [
                        (Pipeline
                          children: [
                            (C {(echo)} {(DQ (${ VSub_Name BUILD_NUMBER))})
                            (C {(gsutil)} {(-q)} {(-h)} {(DQ ('Content-Type:text/plain'))} {(-h)} 
                              {(DQ ('Cache-Control:private, max-age=0, no-transform'))} {(cp)} {(-a)} {(DQ (${ VSub_Name gcs_acl))} {(-)} {(DQ (${ VSub_Name gcs_latest_path) (/latest-build.txt))}
                            )
                          ]
                          negated: False
                        )
                        (ControlFlow token:<ControlFlow_Continue continue>)
                      ]
                      op_id: Op_DPipe
                    )
                    (ControlFlow token:<ControlFlow_Break break>)
                  ]
                  spids: [1704 2216]
                )
              spids: [1698 1702]
            )
            (C {(echo)} {(-e)} 
              {
                (DQ (Lit_Other '\\') (n) (Lit_Other '\\') (n) (Lit_Other '\\') 
                  ('n*** View logs and artifacts at ') (${ VSub_Name results_url) (' ***') (Lit_Other '\\') (n) (Lit_Other '\\') (n)
                )
              }
            )
          ]
          spids: [1654]
        )
      spids: [1648 1653]
    )
    (If
      arms: [
        (if_arm
          cond: [
            (Sentence
              child: 
                (DBracket
                  expr: 
                    (BoolUnary
                      op_id: BoolUnary_z
                      child: 
                        {
                          (DQ 
                            (BracedVarSub
                              token: <VSub_Name BOOTSTRAP_MIGRATION>
                              suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                              spids: [2251 2254]
                            )
                          )
                        }
                    )
                )
              terminator: <Op_Semi ';'>
            )
          ]
          action: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolUnary
                              op_id: BoolUnary_n
                              child: 
                                {
                                  (DQ 
                                    (BracedVarSub
                                      token: <VSub_Name JENKINS_BUILD_STARTED>
                                      suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                                      spids: [2270 2273]
                                    )
                                  )
                                }
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [(C {(upload_version)})]
                  spids: [16777215 2279]
                )
                (if_arm
                  cond: [
                    (Sentence
                      child: 
                        (DBracket
                          expr: 
                            (BoolUnary
                              op_id: BoolUnary_n
                              child: 
                                {
                                  (DQ 
                                    (BracedVarSub
                                      token: <VSub_Name JENKINS_BUILD_FINISHED>
                                      suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )})
                                      spids: [2292 2295]
                                    )
                                  )
                                }
                            )
                        )
                      terminator: <Op_Semi ';'>
                    )
                  ]
                  action: [
                    (C {(upload_artifacts_and_build_result)} {(${ VSub_Name JENKINS_BUILD_FINISHED)})
                    (C {(update_job_result_cache)} {(${ VSub_Name JENKINS_BUILD_FINISHED)})
                  ]
                  spids: [2285 2301]
                )
              ]
              else_action: [
                (C {(echo)} 
                  {
                    (DQ 
                      (
'ERROR: Called without JENKINS_BUILD_STARTED or JENKINS_BUILD_FINISHED set.'
                      )
                    )
                  }
                )
                (C {(echo)} {(DQ ('ERROR: this should not happen'))})
                (C {(exit)} {(1)})
              ]
              spids: [2318 2340]
            )
          ]
          spids: [16777215 2260]
        )
      ]
      spids: [16777215 2342]
    )
  ]
)