github.com/shashidharatd/test-infra@v0.0.0-20171006011030-71304e1ca560/prow/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  all: build test
    16  
    17  
    18  HOOK_VERSION             ?= 0.170
    19  SINKER_VERSION           ?= 0.21
    20  DECK_VERSION             ?= 0.52
    21  SPLICE_VERSION           ?= 0.27
    22  TOT_VERSION              ?= 0.5
    23  HOROLOGIUM_VERSION       ?= 0.8
    24  PLANK_VERSION            ?= 0.49
    25  JENKINS-OPERATOR_VERSION ?= 0.46
    26  TIDE_VERSION             ?= 0.7
    27  
    28  # These are the usual GKE variables.
    29  PROJECT       ?= k8s-prow
    30  BUILD_PROJECT ?= k8s-prow-builds
    31  ZONE          ?= us-central1-f
    32  CLUSTER       ?= prow
    33  
    34  # Build and push specific variables.
    35  REGISTRY ?= gcr.io
    36  PUSH     ?= gcloud docker -- push
    37  
    38  DOCKER_LABELS=--label io.k8s.prow.git-describe="$(shell git describe --tags --always --dirty)"
    39  
    40  update-config: get-cluster-credentials
    41  	kubectl create configmap config --from-file=config=config.yaml --dry-run -o yaml | kubectl replace configmap config -f -
    42  
    43  update-plugins: get-cluster-credentials
    44  	kubectl create configmap plugins --from-file=plugins=plugins.yaml --dry-run -o yaml | kubectl replace configmap plugins -f -
    45  
    46  get-cluster-credentials:
    47  	gcloud container clusters get-credentials "$(CLUSTER)" --project="$(PROJECT)" --zone="$(ZONE)"
    48  
    49  get-build-cluster-credentials:
    50  	gcloud container clusters get-credentials "$(CLUSTER)" --project="$(BUILD_PROJECT)" --zone="$(ZONE)"
    51  
    52  build:
    53  	go install ./cmd/...
    54  
    55  test:
    56  	go test -race -cover $$(go list ./... | grep -v "\/vendor\/")
    57  
    58  .PHONY: update-config update-plugins build test get-cluster-credentials
    59  
    60  alpine-image:
    61  	docker build -t "$(REGISTRY)/$(PROJECT)/alpine" $(DOCKER_LABELS) cmd/images/alpine
    62  	$(PUSH) "$(REGISTRY)/$(PROJECT)/alpine"
    63  
    64  git-image: alpine-image
    65  	docker build -t "$(REGISTRY)/$(PROJECT)/git" $(DOCKER_LABELS) cmd/images/git
    66  	$(PUSH) "$(REGISTRY)/$(PROJECT)/git"
    67  
    68  hook-image: git-image
    69  	CGO_ENABLED=0 go build -o cmd/hook/hook k8s.io/test-infra/prow/cmd/hook
    70  	docker build -t "$(REGISTRY)/$(PROJECT)/hook:$(HOOK_VERSION)" $(DOCKER_LABELS) cmd/hook
    71  	$(PUSH) "$(REGISTRY)/$(PROJECT)/hook:$(HOOK_VERSION)"
    72  
    73  hook-deployment: get-cluster-credentials
    74  	kubectl apply -f cluster/hook_deployment.yaml
    75  
    76  hook-service: get-cluster-credentials
    77  	kubectl apply -f cluster/hook_service.yaml
    78  
    79  sinker-image: alpine-image
    80  	CGO_ENABLED=0 go build -o cmd/sinker/sinker k8s.io/test-infra/prow/cmd/sinker
    81  	docker build -t "$(REGISTRY)/$(PROJECT)/sinker:$(SINKER_VERSION)" $(DOCKER_LABELS) cmd/sinker
    82  	$(PUSH) "$(REGISTRY)/$(PROJECT)/sinker:$(SINKER_VERSION)"
    83  
    84  sinker-deployment: get-cluster-credentials
    85  	kubectl apply -f cluster/sinker_deployment.yaml
    86  
    87  deck-image: alpine-image
    88  	CGO_ENABLED=0 go build -o cmd/deck/deck k8s.io/test-infra/prow/cmd/deck
    89  	docker build -t "$(REGISTRY)/$(PROJECT)/deck:$(DECK_VERSION)" $(DOCKER_LABELS) cmd/deck
    90  	$(PUSH) "$(REGISTRY)/$(PROJECT)/deck:$(DECK_VERSION)"
    91  
    92  deck-deployment: get-cluster-credentials
    93  	kubectl apply -f cluster/deck_deployment.yaml
    94  
    95  deck-service: get-cluster-credentials
    96  	kubectl apply -f cluster/deck_service.yaml
    97  
    98  splice-image: git-image
    99  	CGO_ENABLED=0 go build -o cmd/splice/splice k8s.io/test-infra/prow/cmd/splice
   100  	docker build -t "$(REGISTRY)/$(PROJECT)/splice:$(SPLICE_VERSION)" $(DOCKER_LABELS) cmd/splice
   101  	$(PUSH) "$(REGISTRY)/$(PROJECT)/splice:$(SPLICE_VERSION)"
   102  
   103  splice-deployment: get-cluster-credentials
   104  	kubectl apply -f cluster/splice_deployment.yaml
   105  
   106  tot-image: alpine-image
   107  	CGO_ENABLED=0 go build -o cmd/tot/tot k8s.io/test-infra/prow/cmd/tot
   108  	docker build -t "$(REGISTRY)/$(PROJECT)/tot:$(TOT_VERSION)" $(DOCKER_LABELS) cmd/tot
   109  	$(PUSH) "$(REGISTRY)/$(PROJECT)/tot:$(TOT_VERSION)"
   110  
   111  tot-deployment: get-cluster-credentials
   112  	kubectl apply -f cluster/tot_deployment.yaml
   113  
   114  tot-service: get-cluster-credentials
   115  	kubectl apply -f cluster/tot_service.yaml
   116  
   117  horologium-image: alpine-image
   118  	CGO_ENABLED=0 go build -o cmd/horologium/horologium k8s.io/test-infra/prow/cmd/horologium
   119  	docker build -t "$(REGISTRY)/$(PROJECT)/horologium:$(HOROLOGIUM_VERSION)" $(DOCKER_LABELS) cmd/horologium
   120  	$(PUSH) "$(REGISTRY)/$(PROJECT)/horologium:$(HOROLOGIUM_VERSION)"
   121  
   122  horologium-deployment: get-cluster-credentials
   123  	kubectl apply -f cluster/horologium_deployment.yaml
   124  
   125  plank-image: alpine-image
   126  	CGO_ENABLED=0 go build -o cmd/plank/plank k8s.io/test-infra/prow/cmd/plank
   127  	docker build -t "$(REGISTRY)/$(PROJECT)/plank:$(PLANK_VERSION)" $(DOCKER_LABELS) cmd/plank
   128  	$(PUSH) "$(REGISTRY)/$(PROJECT)/plank:$(PLANK_VERSION)"
   129  
   130  plank-deployment: get-cluster-credentials
   131  	kubectl apply -f cluster/plank_deployment.yaml
   132  
   133  jenkins-operator-image: alpine-image
   134  	CGO_ENABLED=0 go build -o cmd/jenkins-operator/jenkins-operator k8s.io/test-infra/prow/cmd/jenkins-operator
   135  	docker build -t "$(REGISTRY)/$(PROJECT)/jenkins-operator:$(JENKINS_VERSION)" $(DOCKER_LABELS) cmd/jenkins-operator
   136  	$(PUSH) "$(REGISTRY)/$(PROJECT)/jenkins-operator:$(JENKINS_VERSION)"
   137  
   138  jenkins-operator-deployment: get-cluster-credentials
   139  	kubectl apply -f cluster/jenkins_deployment.yaml
   140  
   141  tide-image: git-image
   142  	CGO_ENABLED=0 go build -o cmd/tide/tide k8s.io/test-infra/prow/cmd/tide
   143  	docker build -t "$(REGISTRY)/$(PROJECT)/tide:$(TIDE_VERSION)" $(DOCKER_LABELS) cmd/tide
   144  	$(PUSH) "$(REGISTRY)/$(PROJECT)/tide:$(TIDE_VERSION)"
   145  
   146  tide-deployment: get-cluster-credentials
   147  	kubectl apply -f cluster/tide_deployment.yaml
   148  
   149  .PHONY: hook-image hook-deployment hook-service sinker-image sinker-deployment deck-image deck-deployment deck-service splice-image splice-deployment tot-image tot-service tot-deployment horologium-image horologium-deployment plank-image plank-deployment jenkins-operator-image jenkins-operator-deployment tide-image tide-deployment