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
No related branches found
No related tags found
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 # The version that will be used in docker tags (e.g. to push a
# go-httpbin:latest image use `make imagepush VERSION=latest)` # go-httpbin:latest image use `make imagepush VERSION=latest)`
...@@ -8,6 +8,9 @@ VERSION ?= $(shell git rev-parse --short HEAD) ...@@ -8,6 +8,9 @@ VERSION ?= $(shell git rev-parse --short HEAD)
GCLOUD_PROJECT ?= httpbingo GCLOUD_PROJECT ?= httpbingo
GCLOUD_ACCOUNT ?= mccutchen@gmail.com 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 # Built binaries will be placed here
DIST_PATH ?= dist DIST_PATH ?= dist
...@@ -78,11 +81,14 @@ lint: $(TOOL_GOLINT) $(TOOL_STATICCHECK) ...@@ -78,11 +81,14 @@ lint: $(TOOL_GOLINT) $(TOOL_STATICCHECK)
# ============================================================================= # =============================================================================
# deploy & run locally # deploy & run locally
# ============================================================================= # =============================================================================
deploy: build deploy: build gcloud-auth
gcloud --account=$(GCLOUD_ACCOUNT) app deploy --quiet --project=$(GCLOUD_PROJECT) --version=$(VERSION) --promote $(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-auth:
gcloud --account=$(GCLOUD_ACCOUNT) app deploy --quiet --project=$(GCLOUD_PROJECT) --version=$(VERSION) --no-promote @$(GCLOUD_COMMAND) auth list | grep '^\*' | grep -q $(GCLOUD_ACCOUNT) || $(GCLOUD_COMMAND) auth login $(GCLOUD_ACCOUNT)
run: build run: build
$(DIST_PATH)/go-httpbin $(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