Skip to content
Snippets Groups Projects
Commit f72cf672 authored by Will McCutchen's avatar Will McCutchen
Browse files

Don't require local gcloud installation

parent 9e3d9aa5
Branches
Tags
No related merge requests found
.PHONY: clean deploy deps image imagepush lint run stagedeploy test testci testcover
.PHONY: clean deploy deps gcloud-auth image imagepush lint run stagedeploy test testci testcover
# The version that will be used in docker tags (e.g. to push a
# go-httpbin:latest image use `make imagepush VERSION=latest)`
......@@ -8,6 +8,9 @@ VERSION ?= $(shell git rev-parse --short HEAD)
GCLOUD_PROJECT ?= httpbingo
GCLOUD_ACCOUNT ?= mccutchen@gmail.com
# Run gcloud in a container to avoid needing to install the SDK locally
GCLOUD_COMMAND ?= docker run --rm -ti --workdir /code -v $$PWD:/code -v $$HOME/.config/gcloud:/root/.config/gcloud google/cloud-sdk gcloud
# Built binaries will be placed here
DIST_PATH ?= dist
......@@ -78,11 +81,14 @@ lint: $(TOOL_GOLINT) $(TOOL_STATICCHECK)
# =============================================================================
# deploy & run locally
# =============================================================================
deploy: build
gcloud --account=$(GCLOUD_ACCOUNT) app deploy --quiet --project=$(GCLOUD_PROJECT) --version=$(VERSION) --promote
deploy: build gcloud-auth
$(GCLOUD_COMMAND) --account=$(GCLOUD_ACCOUNT) app deploy --quiet --project=$(GCLOUD_PROJECT) --version=$(VERSION) --promote
stagedeploy: build gcloud-auth
$(GCLOUD_COMMAND) --account=$(GCLOUD_ACCOUNT) app deploy --quiet --project=$(GCLOUD_PROJECT) --version=$(VERSION) --no-promote
stagedeploy: build
gcloud --account=$(GCLOUD_ACCOUNT) app deploy --quiet --project=$(GCLOUD_PROJECT) --version=$(VERSION) --no-promote
gcloud-auth:
@$(GCLOUD_COMMAND) auth list | grep '^\*' | grep -q $(GCLOUD_ACCOUNT) || $(GCLOUD_COMMAND) auth login $(GCLOUD_ACCOUNT)
run: build
$(DIST_PATH)/go-httpbin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment