Skip to content

Commit 7221e38

Browse files
author
Mrunal Patel
authored
Merge pull request #929 from mlaventure/tag-image-with-git-branch
Use git branch name as tag when building images
2 parents 629e356 + 9977d24 commit 7221e38

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44

55
PREFIX := $(DESTDIR)/usr/local
66
BINDIR := $(PREFIX)/sbin
7-
RUNC_IMAGE := runc_dev
8-
RUNC_TEST_IMAGE := runc_test
7+
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
8+
GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g")
9+
RUNC_IMAGE := runc_dev$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN))
10+
RUNC_TEST_IMAGE := runc_test$(if $(GIT_BRANCH_CLEAN),:$(GIT_BRANCH_CLEAN))
911
PROJECT := github.com/opencontainers/runc
1012
TEST_DOCKERFILE := script/test_Dockerfile
1113
BUILDTAGS := seccomp

0 commit comments

Comments
 (0)