#!/usr/bin/env 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. # This script builds hyperkube and then the hyperkube image. # REGISTRY and VERSION must be set. # Example usage: # $ export REGISTRY=gcr.io/someone # $ export VERSION=v1.4.0-testfix # ./hack/dev-push-hyperkube.sh # That will build and push gcr.io/someone/hyperkube-amd64:v1.4.0-testfix set -o errexit set -o nounset set -o pipefail global KUBE_ROOT := ""$[dirname $(BASH_SOURCE)]/.."" source "$(KUBE_ROOT)/build/common.sh" if [[ -z "${REGISTRY:-}" ]] { echo "REGISTRY must be set" exit -1 } if [[ -z "${VERSION:-}" ]] { echo "VERSION must be set" exit -1 } global IMAGE := ""$(REGISTRY)/hyperkube-amd64:$(VERSION)"" kube::build::verify_prereqs kube::build::build_image kube::build::run_build_command make WHAT=cmd/hyperkube kube::build::copy_output make -C "$(KUBE_ROOT)/cluster/images/hyperkube" build docker push $(IMAGE) (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: { (DQ (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ (${ VSub_Name BASH_SOURCE))})] ) left_token: spids: [87 95] ) (/..) ) } spids: [85] ) ] spids: [85] ) (C {(source)} {(DQ (${ VSub_Name KUBE_ROOT) (/build/common.sh))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [116 119] ) ) } ) ) terminator: ) ] action: [(C {(echo)} {(DQ ("REGISTRY must be set"))}) (C {(exit)} {(-1)})] spids: [-1 125] ) ] spids: [-1 139] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolUnary op_id: BoolUnary_z child: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [148 151] ) ) } ) ) terminator: ) ] action: [(C {(echo)} {(DQ ("VERSION must be set"))}) (C {(exit)} {(-1)})] spids: [-1 157] ) ] spids: [-1 171] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:IMAGE) op: Equal rhs: {(DQ (${ VSub_Name REGISTRY) ("/hyperkube-amd64:") (${ VSub_Name VERSION))} spids: [174] ) ] spids: [174] ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (build) (Lit_Other ":") (Lit_Other ":") (verify_prereqs)} ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (build) (Lit_Other ":") (Lit_Other ":") (build_image)}) (C {(kube) (Lit_Other ":") (Lit_Other ":") (build) (Lit_Other ":") (Lit_Other ":") (run_build_command)} {(make)} {(Lit_VarLike "WHAT=") (cmd/hyperkube)} ) (C {(kube) (Lit_Other ":") (Lit_Other ":") (build) (Lit_Other ":") (Lit_Other ":") (copy_output)}) (C {(make)} {(-C)} {(DQ (${ VSub_Name KUBE_ROOT) (/cluster/images/hyperkube))} {(build)}) (C {(docker)} {(push)} {(DQ (${ VSub_Name IMAGE))}) ] )