#!/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. set -o errexit set -o nounset set -o pipefail global KUBE_ROOT := "$[dirname $(BASH_SOURCE)]/.." global KUBE_REMOTE_RUNTIME_ROOT := ""$(KUBE_ROOT)/pkg/kubelet/apis/cri/v1alpha1/runtime"" source "$(KUBE_ROOT)/hack/lib/init.sh" kube::golang::setup_env proc cleanup { rm -rf $(KUBE_REMOTE_RUNTIME_ROOT)/_tmp/ } trap cleanup EXIT mkdir -p $(KUBE_REMOTE_RUNTIME_ROOT)/_tmp cp $(KUBE_REMOTE_RUNTIME_ROOT)/api.pb.go $(KUBE_REMOTE_RUNTIME_ROOT)/_tmp/ global ret := '0' env KUBE_VERBOSE=3 "$(KUBE_ROOT)/hack/update-generated-runtime.sh" diff -I "gzipped FileDescriptorProto" -I "0x" -Naupr $(KUBE_REMOTE_RUNTIME_ROOT)/_tmp/api.pb.go $(KUBE_REMOTE_RUNTIME_ROOT)/api.pb.go || global ret := $Status if [[ $ret -eq 0 ]] { echo "Generated container runtime api is up to date." cp $(KUBE_REMOTE_RUNTIME_ROOT)/_tmp/api.pb.go $(KUBE_REMOTE_RUNTIME_ROOT)/ } else { echo "Generated container runtime api is out of date. Please run hack/update-generated-runtime.sh" exit 1 } (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: [64 72] ) (/..) } spids: [63] ) ] spids: [63] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:KUBE_REMOTE_RUNTIME_ROOT) op: Equal rhs: {(DQ (${ VSub_Name KUBE_ROOT) (/pkg/kubelet/apis/cri/v1alpha1/runtime))} spids: [75] ) ] spids: [75] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/hack/lib/init.sh))}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (golang) (Lit_Other ":") (Lit_Other ":") (setup_env)}) (FuncDef name: cleanup body: (BraceGroup children: [(C {(rm)} {(-rf)} {(${ VSub_Name KUBE_REMOTE_RUNTIME_ROOT) (/_tmp/)})] spids: [106] ) spids: [102 105] ) (C {(trap)} {(cleanup)} {(EXIT)}) (C {(mkdir)} {(-p)} {(${ VSub_Name KUBE_REMOTE_RUNTIME_ROOT) (/_tmp)}) (C {(cp)} {(${ VSub_Name KUBE_REMOTE_RUNTIME_ROOT) (/api.pb.go)} {(${ VSub_Name KUBE_REMOTE_RUNTIME_ROOT) (/_tmp/)} ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ret) op:Equal rhs:{(0)} spids:[150])] spids: [150] ) (SimpleCommand words: [{(DQ (${ VSub_Name KUBE_ROOT) (/hack/update-generated-runtime.sh))}] more_env: [(env_pair name:KUBE_VERBOSE val:{(3)} spids:[153])] ) (AndOr children: [ (C {(diff)} {(-I)} {(DQ ("gzipped FileDescriptorProto"))} {(-I)} {(DQ (0x))} {(-Naupr)} {(${ VSub_Name KUBE_REMOTE_RUNTIME_ROOT) (/_tmp/api.pb.go)} {(${ VSub_Name KUBE_REMOTE_RUNTIME_ROOT) (/api.pb.go)} ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:ret) op:Equal rhs:{($ VSub_QMark "$?")} spids:[191])] spids: [191] ) ] op_id: Op_DPipe ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id:BoolBinary_eq left:{($ VSub_Name "$ret")} right:{(0)}) ) terminator: ) ] action: [ (C {(echo)} {(DQ ("Generated container runtime api is up to date."))}) (C {(cp)} {(${ VSub_Name KUBE_REMOTE_RUNTIME_ROOT) (/_tmp/api.pb.go)} {(${ VSub_Name KUBE_REMOTE_RUNTIME_ROOT) (/)} ) ] spids: [-1 207] ) ] else_action: [ (C {(echo)} { (DQ ( "Generated container runtime api is out of date. Please run hack/update-generated-runtime.sh" ) ) } ) (C {(exit)} {(1)}) ] spids: [229 243] ) ] )