github.com/shashidharatd/test-infra@v0.0.0-20171006011030-71304e1ca560/label_sync/Makefile (about) 1 # Copyright 2017 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 all: build test 16 17 18 LABEL_SYNC_VERSION ?= 0.1 19 20 # These are the usual GKE variables. 21 PROJECT ?= k8s-prow 22 BUILD_PROJECT ?= k8s-prow-builds 23 ZONE ?= us-central1-f 24 CLUSTER ?= prow 25 26 # Build and push specific variables. 27 REGISTRY ?= gcr.io 28 PUSH ?= gcloud docker -- push 29 30 DOCKER_LABELS=--label io.k8s.prow.git-describe="$(shell git describe --tags --always --dirty)" 31 32 get-cluster-credentials: 33 gcloud container clusters get-credentials "$(CLUSTER)" --project="$(PROJECT)" --zone="$(ZONE)" 34 35 get-build-cluster-credentials: 36 gcloud container clusters get-credentials "$(CLUSTER)" --project="$(BUILD_PROJECT)" --zone="$(ZONE)" 37 38 build: 39 go install ./... 40 41 test: 42 go test -race -cover $$(go list ./... | grep -v "\/vendor\/") 43 44 .PHONY: build test get-cluster-credentials 45 46 compile-static: 47 CGO_ENABLED=0 go build -o label_sync k8s.io/test-infra/label_sync 48 49 label_sync-image: compile-static 50 docker build -t "$(REGISTRY)/$(PROJECT)/label_sync:$(LABEL_SYNC_VERSION)" $(DOCKER_LABELS) . 51 $(PUSH) "$(REGISTRY)/$(PROJECT)/label_sync:$(LABEL_SYNC_VERSION)" 52 53 label_sync-deployment: get-cluster-credentials 54 kubectl apply -f cluster/label_sync_deployment.yaml 55 56 label_sync-cronjob: get-cluster-credentials 57 kubectl apply -f cluster/label_sync_cron_job.yaml 58 59 .PHONY: label_sync-image label_sync-deployment label_sync-cronjob