github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/boskos/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  PROJECT ?= k8s-prow-builds
    16  ZONE ?= us-central1-f
    17  CLUSTER ?= prow
    18  NAMESPACE ?= test-pods
    19  HUB ?= gcr.io/k8s-testimages
    20  
    21  TAG := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty)
    22  
    23  boskos:
    24  	go build k8s.io/test-infra/boskos/
    25  
    26  client:
    27  	go build -o client/client k8s.io/test-infra/boskos/client/
    28  
    29  reaper:
    30  	go build -o reaper/reaper k8s.io/test-infra/boskos/reaper/
    31  
    32  janitor:
    33  	go build -o janitor/janitor k8s.io/test-infra/boskos/janitor/
    34  
    35  metrics:
    36  	go build -o metrics/metrics k8s.io/test-infra/boskos/metrics/
    37  
    38  server-image:
    39  	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o boskos k8s.io/test-infra/boskos/
    40  	docker build -t "$(HUB)/boskos:$(TAG)" .
    41  	docker push "$(HUB)/boskos:$(TAG)"
    42  	rm boskos
    43  
    44  reaper-image:
    45  	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o reaper/reaper k8s.io/test-infra/boskos/reaper/
    46  	docker build -t "$(HUB)/reaper:$(TAG)" reaper
    47  	docker push "$(HUB)/reaper:$(TAG)"
    48  	rm reaper/reaper
    49  
    50  janitor-image:
    51  	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o janitor/janitor k8s.io/test-infra/boskos/janitor/
    52  	docker build --no-cache -t "$(HUB)/janitor:$(TAG)" janitor
    53  	docker push "$(HUB)/janitor:$(TAG)"
    54  	rm janitor/janitor
    55  
    56  metrics-image:
    57  	CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o metrics/metrics k8s.io/test-infra/boskos/metrics/
    58  	docker build -t "$(HUB)/metrics:$(TAG)" metrics
    59  	docker push "$(HUB)/metrics:$(TAG)"
    60  	rm metrics/metrics
    61  
    62  server-deployment: get-cluster-credentials
    63  	kubectl apply -f deployment.yaml
    64  
    65  reaper-deployment: get-cluster-credentials
    66  	kubectl apply -f reaper/deployment.yaml
    67  
    68  janitor-deployment: get-cluster-credentials
    69  	kubectl apply -f janitor/deployment.yaml
    70  
    71  metrics-deployment: get-cluster-credentials
    72  	kubectl apply -f metrics/deployment.yaml
    73  
    74  service: get-cluster-credentials
    75  	kubectl apply -f service.yaml
    76  
    77  update-config: get-cluster-credentials
    78  	#TODO: create the resources.yaml and use it instead
    79  	kubectl create configmap resources --from-file=config=resources.yaml --dry-run -o yaml | kubectl --namespace="$(NAMESPACE)" replace configmap resources -f -
    80  
    81  get-cluster-credentials:
    82  	gcloud container clusters get-credentials "$(CLUSTER)" --project="$(PROJECT)" --zone="$(ZONE)"
    83  
    84  .PHONY: boskos client reaper janitor metrics server-image reaper-image janitor-image metrics-image server-deployment reaper-deployment janitor-deployment metrics-deployment service update-config get-cluster-credentials