Skip to content

Commit 810f425

Browse files
authored
Use commit SHA for image tags by default (#3086)
1 parent 840e7a1 commit 810f425

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

porch/Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,16 @@ MODULES = \
2828
# GCP project to use for development
2929
export GCP_PROJECT_ID ?= $(shell gcloud config get-value project)
3030
export IMAGE_REPO ?= gcr.io/$(GCP_PROJECT_ID)
31-
export IMAGE_TAG ?= latest
31+
export IMAGE_TAG
32+
ifndef IMAGE_TAG
33+
git_tag := $(shell git rev-parse --short HEAD || "latest" )
34+
$(shell git diff --quiet)
35+
ifneq ($(.SHELLSTATUS), 0)
36+
git_tag := $(git_tag)-dirty
37+
endif
38+
39+
IMAGE_TAG=$(git_tag)
40+
endif
3241

3342
PORCH_SERVER_IMAGE ?= porch-server
3443
PORCH_FUNCTION_RUNNER_IMAGE ?= porch-function-runner

0 commit comments

Comments
 (0)