github.com/abayer/test-infra@v0.0.5/kettle/Makefile (about) 1 # Copyright 2016 The Kubernetes Authors. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 IMG = gcr.io/k8s-testimages/kettle 16 TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty) 17 18 # These are the usual GKE variables. 19 PROJECT ?= k8s-gubernator 20 ZONE ?= us-west1-b 21 CLUSTER ?= g8r 22 23 get-cluster-credentials: 24 kubectl config use-context gke_k8s-gubernator_us-west1-b_g8r || gcloud container clusters get-credentials "$(CLUSTER)" --project="$(PROJECT)" --zone="$(ZONE)" 25 26 build: 27 docker build -t $(IMG):$(TAG) . 28 docker tag $(IMG):$(TAG) $(IMG):latest 29 echo Built $(IMG):$(TAG) and tagged with $(IMG):latest ; 30 31 push: build 32 docker push $(IMG):$(TAG) 33 docker push $(IMG):latest 34 echo Pushed $(IMG):latest and $(IMG):$(TAG) 35 36 deploy: get-cluster-credentials 37 sed "s/:latest/:$(TAG)/g" deployment.yaml | kubectl apply -f - --record 38 39 update: get-cluster-credentials 40 kubectl set image deployment/kettle kettle=$(IMG):$(TAG) --record 41 42 rollback: get-cluster-credentials 43 kubectl rollout undo deployments/kettle 44 45 46 .PHONY: all build push 47 48 all: build