github.com/munnerz/test-infra@v0.0.0-20190108210205-ce3d181dc989/gubernator/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 VERSION := $(shell date +v%Y%m%d)-$(shell git describe --tags --always --dirty) 16 PROJECT ?= k8s-gubernator 17 18 # TODO(fejta): convert these to bazel rules 19 20 .PHONY: migrate versions deploy cron all 21 all: versions 22 23 deploy: 24 gcloud app deploy --version="$(VERSION)" --project="$(PROJECT)" --no-promote --quiet 25 cd github && gcloud app deploy --version="$(VERSION)" --project="$(PROJECT)" --no-promote --quiet 26 27 # This is a weird one. It's a global setting that's *not* versioned. 28 cron: 29 gcloud app deploy --project="$(PROJECT)" cron.yaml 30 31 versions: 32 gcloud app versions list --project="$(PROJECT)" 33 34 # TODO(fejta): consider the following default: 35 # gcloud app versions list --sort-by=~LAST_DEPLOYED --limit=1 --format='value(id)' 36 migrate: SHELL:=/bin/bash 37 migrate: versions 38 @read -p "Promote $(SERVICE) [$(VERSION)]: " version && \ 39 gcloud app versions migrate "$${version:-$(VERSION)}" --project="$(PROJECT)" --quiet && \ 40 gcloud app versions migrate "$${version:-$(VERSION)}" --project="$(PROJECT)" --service=github --quiet 41 42 43 delete: SHELL:=/bin/bash 44 delete: versions 45 @read -p "Delete $(SERVICE) [$(VERSION)]: " version && \ 46 gcloud app versions delete "$${version:-$(VERSION)}" --project="$(PROJECT)" && \ 47 gcloud app versions delete "$${version:-$(VERSION)}" --project="$(PROJECT)" --service=github