From d54ebf4bdc18db5ef89e75571ac2242353edb72c Mon Sep 17 00:00:00 2001 From: Martin Maly Date: Wed, 4 May 2022 12:22:27 -0700 Subject: [PATCH] Use commit SHA for image tags by default --- porch/Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/porch/Makefile b/porch/Makefile index 05630d8fc5..1a398bcb98 100644 --- a/porch/Makefile +++ b/porch/Makefile @@ -28,7 +28,16 @@ MODULES = \ # GCP project to use for development export GCP_PROJECT_ID ?= $(shell gcloud config get-value project) export IMAGE_REPO ?= gcr.io/$(GCP_PROJECT_ID) -export IMAGE_TAG ?= latest +export IMAGE_TAG +ifndef IMAGE_TAG + git_tag := $(shell git rev-parse --short HEAD || "latest" ) + $(shell git diff --quiet) + ifneq ($(.SHELLSTATUS), 0) + git_tag := $(git_tag)-dirty + endif + + IMAGE_TAG=$(git_tag) +endif PORCH_SERVER_IMAGE ?= porch-server PORCH_FUNCTION_RUNNER_IMAGE ?= porch-function-runner