Skip to content

Commit d2da815

Browse files
committed
Incorporate BUILD_USER into DIRTY for CI/CD Compatibility
This commit updates the Makefile.eve to incorporate the BUILD_USER variable into the DIRTY variable to avoid potential docker tag conflicts when building on a shared machine with shared docker cache especially if it is shared with CI/CD. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
1 parent cb66f65 commit d2da815

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

Makefile.eve

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ EVE_FLAVOR=generic
55
ARCHITECTURE=amd64
66
KERNEL_TAG=v6.1.38
77
PLATFORM=linux/$(ARCHITECTURE)
8+
BUILD_USER:=$(shell id -un)
89

910
SOURCE_DATE_EPOCH=$(shell git log -1 --format=%ct)
1011
BRANCH=eve-kernel-$(ARCHITECTURE)-$(KERNEL_TAG)-$(EVE_FLAVOR)
@@ -15,6 +16,13 @@ ifeq ($(BUILDKIT_PROGRESS),)
1516
export BUILDKIT_PROGRESS := plain
1617
endif
1718

19+
# if BRANCH is defined on a command line we are running under CI
20+
# we add user name to DIRTY to avoid docker tag conflicts
21+
# when building on a shared machine with shared docker cache
22+
ifeq ($(origin BRANCH), file)
23+
DIRTY:=-$(BUILD_USER)$(DIRTY)
24+
endif
25+
1826
.PHONY: all help
1927

2028
all: kernel-gcc
@@ -37,7 +45,7 @@ pull-eve-build-tools:
3745
docker pull lfedge/eve-build-tools:main
3846
.PHONY: pull-eve-build-tools
3947

40-
# do not build sbom target directly, it depends on DOCKERFILE varuable set by kernel-gcc or kernel-clang
48+
# do not build sbom target directly, it depends on DOCKERFILE variable set by kernel-gcc or kernel-clang
4149
SBOM_TARGETS=kernel-sbom-gh.spdx.json kernel-sbom-docker.spdx.json
4250
sbom: $(SBOM_TARGETS)
4351

0 commit comments

Comments
 (0)