github.com/abayer/test-infra@v0.0.5/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 # ALPINE_VERSION is the version of the alpine image 19 ALPINE_VERSION ?= 0.1 20 # GIT_VERSION is the version of the alpine+git image 21 GIT_VERSION ?= 0.2 22 23 # YYYYmmdd-commitish 24 TAG := $(shell date -u +v%Y%m%d)-$(shell git describe --tags --always --dirty) 25 # HOOK_VERSION is the version of the hook image 26 HOOK_VERSION ?= $(TAG) 27 # SINKER_VERSION is the version of the sinker image 28 SINKER_VERSION ?= $(TAG) 29 # DECK_VERSION is the version of the deck image 30 DECK_VERSION ?= $(TAG) 31 # SPLICE_VERSION is the version of the splice image 32 SPLICE_VERSION ?= $(TAG) 33 # TOT_VERSION is the version of the tot image 34 TOT_VERSION ?= $(TAG) 35 # HOROLOGIUM_VERSION is the version of the horologium image 36 HOROLOGIUM_VERSION ?= $(TAG) 37 # PLANK_VERSION is the version of the plank image 38 PLANK_VERSION ?= $(TAG) 39 # JENKINS-OPERATOR_VERSION is the version of the jenkins-operator image 40 JENKINS-OPERATOR_VERSION ?= $(TAG) 41 # TIDE_VERSION is the version of the tide image 42 TIDE_VERSION ?= $(TAG) 43 # CLONEREFS_VERSION is the version of the clonerefs image 44 CLONEREFS_VERSION ?= $(TAG) 45 # INITUPLOAD_VERSION is the version of the initupload image 46 INITUPLOAD_VERSION ?= $(TAG) 47 # GCSUPLOAD_VERSION is the version of the gcsupload image 48 GCSUPLOAD_VERSION ?= $(TAG) 49 # ENTRYPOINT_VERSION is the version of the entrypoint image 50 ENTRYPOINT_VERSION ?= $(TAG) 51 # SIDECAR_VERSION is the version of the sidecar image 52 SIDECAR_VERSION ?= $(TAG) 53 # ARTIFACT-UPLOADER_VERSION is the version of the artifact uploader image 54 ARTIFACT-UPLOADER_VERSION ?= $(TAG) 55 # NEEDS-REBASE_VERSION is the version of the needs-rebase image 56 NEEDS_REBASE_VERSION ?= $(TAG) 57 58 # These are the usual GKE variables. 59 PROJECT ?= k8s-prow 60 BUILD_PROJECT ?= k8s-prow-builds 61 ZONE ?= us-central1-f 62 CLUSTER ?= prow 63 64 # Build and push specific variables. 65 REGISTRY ?= gcr.io 66 PUSH ?= docker push 67 68 DOCKER_LABELS:=--label io.k8s.prow.git-describe="$(shell git describe --tags --always --dirty)" 69 70 update-config: get-cluster-credentials 71 kubectl create configmap config --from-file=config.yaml=config.yaml --dry-run -o yaml | kubectl replace configmap config -f - 72 73 update-plugins: get-cluster-credentials 74 kubectl create configmap plugins --from-file=plugins.yaml=plugins.yaml --dry-run -o yaml | kubectl replace configmap plugins -f - 75 76 update-cat-api-key: get-cluster-credentials 77 kubectl create configmap cat-api-key --from-file=api-key=plugins/cat/api-key --dry-run -o yaml | kubectl replace configmap cat-api-key -f - 78 79 .PHONY: update-config update-plugins update-cat-api-key 80 81 get-cluster-credentials: 82 gcloud container clusters get-credentials "$(CLUSTER)" --project="$(PROJECT)" --zone="$(ZONE)" 83 84 get-build-cluster-credentials: 85 gcloud container clusters get-credentials "$(CLUSTER)" --project="$(BUILD_PROJECT)" --zone="$(ZONE)" 86 87 build: 88 go install ./cmd/... 89 90 test: 91 go test -race -cover $$(go list ./... | grep -v "\/vendor\/") 92 93 .PHONY: build test get-cluster-credentials 94 95 alpine-image: 96 docker build -t "$(REGISTRY)/$(PROJECT)/alpine:$(ALPINE_VERSION)" $(DOCKER_LABELS) cmd/images/alpine 97 $(PUSH) "$(REGISTRY)/$(PROJECT)/alpine:$(ALPINE_VERSION)" 98 99 git-image: alpine-image 100 docker build -t "$(REGISTRY)/$(PROJECT)/git:$(GIT_VERSION)" $(DOCKER_LABELS) cmd/images/git 101 $(PUSH) "$(REGISTRY)/$(PROJECT)/git:$(GIT_VERSION)" 102 103 .PHONY: alpine-image git-image 104 105 branchprotector-image: 106 bazel run //prow/cmd/branchprotector:push 107 108 branchprotector-cronjob: get-cluster-credentials 109 @echo Consider bazel run //prow/cluster:branchprotector_cronjob.apply instead 110 kubectl apply -f cluster/branchprotector_cronjob.yaml 111 112 .PHONY: branchprotector-image branchprotector-cronjob 113 114 hook-image: git-image 115 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cmd/hook/hook k8s.io/test-infra/prow/cmd/hook 116 docker build -t "$(REGISTRY)/$(PROJECT)/hook:$(HOOK_VERSION)" $(DOCKER_LABELS) cmd/hook 117 $(PUSH) "$(REGISTRY)/$(PROJECT)/hook:$(HOOK_VERSION)" 118 119 hook-deployment: get-cluster-credentials 120 kubectl apply -f cluster/hook_deployment.yaml 121 122 hook-service: get-cluster-credentials 123 kubectl apply -f cluster/hook_service.yaml 124 125 .PHONY: hook-image hook-deployment hook-service 126 127 sinker-image: alpine-image 128 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cmd/sinker/sinker k8s.io/test-infra/prow/cmd/sinker 129 docker build -t "$(REGISTRY)/$(PROJECT)/sinker:$(SINKER_VERSION)" $(DOCKER_LABELS) cmd/sinker 130 $(PUSH) "$(REGISTRY)/$(PROJECT)/sinker:$(SINKER_VERSION)" 131 132 sinker-deployment: get-cluster-credentials 133 kubectl apply -f cluster/sinker_deployment.yaml 134 135 .PHONY: sinker-image sinker-deployment 136 137 deck-image: alpine-image 138 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cmd/deck/deck k8s.io/test-infra/prow/cmd/deck 139 docker build -t "$(REGISTRY)/$(PROJECT)/deck:$(DECK_VERSION)" $(DOCKER_LABELS) cmd/deck 140 $(PUSH) "$(REGISTRY)/$(PROJECT)/deck:$(DECK_VERSION)" 141 142 deck-deployment: get-cluster-credentials 143 kubectl apply -f cluster/deck_deployment.yaml 144 145 deck-service: get-cluster-credentials 146 kubectl apply -f cluster/deck_service.yaml 147 148 .PHONY: deck-image deck-deployment deck-service 149 150 splice-image: git-image 151 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cmd/splice/splice k8s.io/test-infra/prow/cmd/splice 152 docker build -t "$(REGISTRY)/$(PROJECT)/splice:$(SPLICE_VERSION)" $(DOCKER_LABELS) cmd/splice 153 $(PUSH) "$(REGISTRY)/$(PROJECT)/splice:$(SPLICE_VERSION)" 154 155 splice-deployment: get-cluster-credentials 156 kubectl apply -f cluster/splice_deployment.yaml 157 158 .PHONY: splice-image splice-deployment 159 160 tot-image: alpine-image 161 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cmd/tot/tot k8s.io/test-infra/prow/cmd/tot 162 docker build -t "$(REGISTRY)/$(PROJECT)/tot:$(TOT_VERSION)" $(DOCKER_LABELS) cmd/tot 163 $(PUSH) "$(REGISTRY)/$(PROJECT)/tot:$(TOT_VERSION)" 164 165 tot-deployment: get-cluster-credentials 166 kubectl apply -f cluster/tot_deployment.yaml 167 168 tot-service: get-cluster-credentials 169 kubectl apply -f cluster/tot_service.yaml 170 171 .PHONY: tot-image tot-deployment 172 173 horologium-image: alpine-image 174 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cmd/horologium/horologium k8s.io/test-infra/prow/cmd/horologium 175 docker build -t "$(REGISTRY)/$(PROJECT)/horologium:$(HOROLOGIUM_VERSION)" $(DOCKER_LABELS) cmd/horologium 176 $(PUSH) "$(REGISTRY)/$(PROJECT)/horologium:$(HOROLOGIUM_VERSION)" 177 178 horologium-deployment: get-cluster-credentials 179 kubectl apply -f cluster/horologium_deployment.yaml 180 181 .PHONY: horologium-image horologium-deployment 182 183 plank-image: alpine-image 184 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cmd/plank/plank k8s.io/test-infra/prow/cmd/plank 185 docker build -t "$(REGISTRY)/$(PROJECT)/plank:$(PLANK_VERSION)" $(DOCKER_LABELS) cmd/plank 186 $(PUSH) "$(REGISTRY)/$(PROJECT)/plank:$(PLANK_VERSION)" 187 188 plank-deployment: get-cluster-credentials 189 kubectl apply -f cluster/plank_deployment.yaml 190 191 .PHONY: plank-image plank-deployment 192 193 jenkins-operator-image: alpine-image 194 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cmd/jenkins-operator/jenkins-operator k8s.io/test-infra/prow/cmd/jenkins-operator 195 docker build -t "$(REGISTRY)/$(PROJECT)/jenkins-operator:$(JENKINS-OPERATOR_VERSION)" $(DOCKER_LABELS) cmd/jenkins-operator 196 $(PUSH) "$(REGISTRY)/$(PROJECT)/jenkins-operator:$(JENKINS-OPERATOR_VERSION)" 197 198 jenkins-operator-deployment: get-cluster-credentials 199 kubectl apply -f cluster/jenkins_deployment.yaml 200 201 pushgateway-deploy: get-cluster-credentials 202 kubectl apply -f cluster/pushgateway_deployment.yaml 203 204 .PHONY: jenkins-operator-image jenkins-operator-deployment pushgateway-deploy 205 206 tide-image: git-image 207 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o cmd/tide/tide k8s.io/test-infra/prow/cmd/tide 208 docker build -t "$(REGISTRY)/$(PROJECT)/tide:$(TIDE_VERSION)" $(DOCKER_LABELS) cmd/tide 209 $(PUSH) "$(REGISTRY)/$(PROJECT)/tide:$(TIDE_VERSION)" 210 211 tide-deployment: get-cluster-credentials 212 kubectl apply -f cluster/tide_deployment.yaml 213 214 mem-range-deployment: get-build-cluster-credentials 215 kubectl apply -f cluster/mem_limit_range.yaml 216 217 .PHONY: tide-image tide-deployment mem-range-deployment 218 219 clonerefs-image: git-image 220 CGO_ENABLED=0 go build -o cmd/clonerefs/clonerefs k8s.io/test-infra/prow/cmd/clonerefs 221 docker build -t "$(REGISTRY)/$(PROJECT)/clonerefs:$(CLONEREFS_VERSION)" $(DOCKER_LABELS) cmd/clonerefs 222 $(PUSH) "$(REGISTRY)/$(PROJECT)/clonerefs:$(CLONEREFS_VERSION)" 223 224 initupload-image: alpine-image 225 CGO_ENABLED=0 go build -o cmd/initupload/initupload k8s.io/test-infra/prow/cmd/initupload 226 docker build -t "$(REGISTRY)/$(PROJECT)/initupload:$(INITUPLOAD_VERSION)" $(DOCKER_LABELS) cmd/initupload 227 $(PUSH) "$(REGISTRY)/$(PROJECT)/initupload:$(INITUPLOAD_VERSION)" 228 229 gcsupload-image: alpine-image 230 CGO_ENABLED=0 go build -o cmd/gcsupload/gcsupload k8s.io/test-infra/prow/cmd/gcsupload 231 docker build -t "$(REGISTRY)/$(PROJECT)/gcsupload:$(GCSUPLOAD_VERSION)" $(DOCKER_LABELS) cmd/gcsupload 232 $(PUSH) "$(REGISTRY)/$(PROJECT)/gcsupload:$(GCSUPLOAD_VERSION)" 233 234 entrypoint-image: alpine-image 235 CGO_ENABLED=0 go build -o cmd/entrypoint/entrypoint k8s.io/test-infra/prow/cmd/entrypoint 236 docker build -t "$(REGISTRY)/$(PROJECT)/entrypoint:$(ENTRYPOINT_VERSION)" $(DOCKER_LABELS) cmd/entrypoint 237 $(PUSH) "$(REGISTRY)/$(PROJECT)/entrypoint:$(ENTRYPOINT_VERSION)" 238 239 sidecar-image: alpine-image 240 CGO_ENABLED=0 go build -o cmd/sidecar/sidecar k8s.io/test-infra/prow/cmd/sidecar 241 docker build -t "$(REGISTRY)/$(PROJECT)/sidecar:$(SIDECAR_VERSION)" $(DOCKER_LABELS) cmd/sidecar 242 $(PUSH) "$(REGISTRY)/$(PROJECT)/sidecar:$(SIDECAR_VERSION)" 243 244 artifact-uploader-image: alpine-image 245 CGO_ENABLED=0 go build -o cmd/artifact-uploader/artifact-uploader k8s.io/test-infra/prow/cmd/artifact-uploader 246 docker build -t "$(REGISTRY)/$(PROJECT)/artifact-uploader:$(ARTIFACT-UPLOADER_VERSION)" $(DOCKER_LABELS) cmd/artifact-uploader 247 $(PUSH) "$(REGISTRY)/$(PROJECT)/artifact-uploader:$(ARTIFACT-UPLOADER_VERSION)" 248 249 .PHONY: clonerefs-image initupload-image gcsupload-image entrypoint-image sidecar-image artifact-uploader-image 250 251 needs-rebase-image: git-image 252 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o external-plugins/needs-rebase/needs_rebase k8s.io/test-infra/prow/external-plugins/needs-rebase 253 docker build -t "$(REGISTRY)/$(PROJECT)/needs-rebase:$(NEEDS_REBASE_VERSION)" $(DOCKER_LABELS) external-plugins/needs-rebase 254 $(PUSH) "$(REGISTRY)/$(PROJECT)/needs-rebase:$(NEEDS_REBASE_VERSION)" 255 256 needs-rebase-deployment: get-cluster-credentials 257 kubectl apply -f cluster/needs-rebase_deployment.yaml 258 259 needs-rebase-service: get-cluster-credentials 260 kubectl apply -f cluster/needs-rebase_service.yaml 261 262 .PHONY: needs-rebase-image needs-rebase-deployment needs-rebase-service