github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/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  # These are the usual GKE variables.
    24  PROJECT       ?= k8s-prow
    25  BUILD_PROJECT ?= k8s-prow-builds
    26  ZONE          ?= us-central1-f
    27  CLUSTER       ?= prow
    28  
    29  # Build and push specific variables.
    30  REGISTRY ?= gcr.io
    31  PUSH     ?= docker push
    32  
    33  export PROW_REPO_OVERRIDE ?= $(REGISTRY)/$(PROJECT)
    34  
    35  DOCKER_LABELS:=--label io.k8s.prow.git-describe="$(shell git describe --tags --always --dirty)"
    36  
    37  update-config: get-cluster-credentials
    38  	kubectl create configmap config --from-file=config.yaml=config.yaml --dry-run -o yaml | kubectl replace configmap config -f -
    39  
    40  update-plugins: get-cluster-credentials
    41  	kubectl create configmap plugins --from-file=plugins.yaml=plugins.yaml --dry-run -o yaml | kubectl replace configmap plugins -f -
    42  
    43  update-cat-api-key: get-cluster-credentials
    44  	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 -
    45  
    46  .PHONY: update-config update-plugins update-cat-api-key
    47  
    48  get-cluster-credentials:
    49  	gcloud container clusters get-credentials "$(CLUSTER)" --project="$(PROJECT)" --zone="$(ZONE)"
    50  
    51  get-build-cluster-credentials:
    52  	gcloud container clusters get-credentials "$(CLUSTER)" --project="$(BUILD_PROJECT)" --zone="$(ZONE)"
    53  
    54  build:
    55  	go install ./cmd/...
    56  
    57  test:
    58  	go test -race -cover $$(go list ./... | grep -v "\/vendor\/")
    59  
    60  .PHONY: build test get-cluster-credentials
    61  
    62  alpine-image:
    63  	docker build -t "$(REGISTRY)/$(PROJECT)/alpine:$(ALPINE_VERSION)" $(DOCKER_LABELS) cmd/images/alpine
    64  	$(PUSH) "$(REGISTRY)/$(PROJECT)/alpine:$(ALPINE_VERSION)"
    65  
    66  git-image: alpine-image
    67  	docker build -t "$(REGISTRY)/$(PROJECT)/git:$(GIT_VERSION)" $(DOCKER_LABELS) cmd/images/git
    68  	$(PUSH) "$(REGISTRY)/$(PROJECT)/git:$(GIT_VERSION)"
    69  
    70  .PHONY: alpine-image git-image
    71  
    72  bazel-release-push:
    73  	@echo Please use prow/bump.sh or bazel run //prow:release-push to build images
    74  	@echo See https://bazel.build/ for install options.
    75  	@echo Be sure to setup authentication: https://github.com/bazelbuild/rules_docker#authentication
    76  	@echo Also run gcloud auth application-default login
    77  	bazel run //prow:release-push --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64
    78  
    79  .PHONY: bazel-release-push
    80  
    81  branchprotector-image: bazel-release-push
    82  
    83  branchprotector-cronjob: get-cluster-credentials
    84  	@echo Consider bazel run //prow/cluster:branchprotector_cronjob.apply instead
    85  	kubectl apply -f cluster/branchprotector_cronjob.yaml
    86  
    87  .PHONY: branchprotector-image branchprotector-cronjob
    88  
    89  hook-image: bazel-release-push
    90  
    91  hook-deployment: get-cluster-credentials
    92  	kubectl apply -f cluster/hook_deployment.yaml
    93  
    94  hook-service: get-cluster-credentials
    95  	kubectl apply -f cluster/hook_service.yaml
    96  
    97  .PHONY: hook-image hook-deployment hook-service
    98  
    99  sinker-image: bazel-release-push
   100  
   101  sinker-deployment: get-cluster-credentials
   102  	kubectl apply -f cluster/sinker_deployment.yaml
   103  
   104  .PHONY: sinker-image sinker-deployment
   105  
   106  deck-image: bazel-release-push
   107  
   108  deck-deployment: get-cluster-credentials
   109  	kubectl apply -f cluster/deck_deployment.yaml
   110  
   111  deck-service: get-cluster-credentials
   112  	kubectl apply -f cluster/deck_service.yaml
   113  
   114  .PHONY: deck-image deck-deployment deck-service
   115  
   116  splice-image: bazel-release-push
   117  
   118  splice-deployment: get-cluster-credentials
   119  	kubectl apply -f cluster/splice_deployment.yaml
   120  
   121  .PHONY: tot-image splice-image splice-deployment
   122  
   123  tot-image: bazel-release-push
   124  
   125  tot-deployment: get-cluster-credentials
   126  	kubectl apply -f cluster/tot_deployment.yaml
   127  
   128  tot-service: get-cluster-credentials
   129  	kubectl apply -f cluster/tot_service.yaml
   130  
   131  .PHONY: tot-image tot-deployment
   132  
   133  horologium-image: bazel-release-push
   134  
   135  horologium-deployment: get-cluster-credentials
   136  	kubectl apply -f cluster/horologium_deployment.yaml
   137  
   138  .PHONY: horologium-image horologium-deployment
   139  
   140  plank-image: bazel-release-push
   141  
   142  plank-deployment: get-cluster-credentials
   143  	kubectl apply -f cluster/plank_deployment.yaml
   144  
   145  .PHONY: plank-image plank-deployment
   146  
   147  jenkins-operator-image: bazel-release-push
   148  
   149  jenkins-operator-deployment: get-cluster-credentials
   150  	kubectl apply -f cluster/jenkins_deployment.yaml
   151  
   152  pushgateway-deploy: get-cluster-credentials
   153  	kubectl apply -f cluster/pushgateway_deployment.yaml
   154  
   155  .PHONY: jenkins-operator-image jenkins-operator-deployment pushgateway-deploy
   156  
   157  tide-image: bazel-release-push
   158  
   159  tide-deployment: get-cluster-credentials
   160  	kubectl apply -f cluster/tide_deployment.yaml
   161  
   162  mem-range-deployment: get-build-cluster-credentials
   163  	kubectl apply -f cluster/mem_limit_range.yaml
   164  
   165  .PHONY: tide-image tide-deployment mem-range-deployment
   166  
   167  clonerefs-image: bazel-release-push
   168  
   169  initupload-image: bazel-release-push
   170  gcsupload-image: bazel-release-push
   171  entrypoint-image: bazel-release-push
   172  sidecar-image: bazel-release-push
   173  artifact-uploader-image: bazel-release-push
   174  
   175  .PHONY: clonerefs-image initupload-image gcsupload-image entrypoint-image sidecar-image artifact-uploader-image
   176  
   177  needs-rebase-image: bazel-release-push
   178  
   179  needs-rebase-deployment: get-cluster-credentials
   180  	kubectl apply -f cluster/needs-rebase_deployment.yaml
   181  
   182  needs-rebase-service: get-cluster-credentials
   183  	kubectl apply -f cluster/needs-rebase_service.yaml
   184  
   185  .PHONY: needs-rebase-image needs-rebase-deployment needs-rebase-service
   186  
   187  checkconfig-image: bazel-release-push
   188  crier-image: bazel-release-push
   189  
   190  .PHONY: crier-image checkconfig-image