Skip to content

Commit

Permalink
Incorporate BUILD_USER into DIRTY for CI/CD Compatibility
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
rucoder committed Nov 3, 2023
1 parent cb66f65 commit d2da815
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Makefile.eve
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ EVE_FLAVOR=generic
ARCHITECTURE=amd64
KERNEL_TAG=v6.1.38
PLATFORM=linux/$(ARCHITECTURE)
BUILD_USER:=$(shell id -un)

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

# if BRANCH is defined on a command line we are running under CI
# we add user name to DIRTY to avoid docker tag conflicts
# when building on a shared machine with shared docker cache
ifeq ($(origin BRANCH), file)
DIRTY:=-$(BUILD_USER)$(DIRTY)
endif

.PHONY: all help

all: kernel-gcc
Expand All @@ -37,7 +45,7 @@ pull-eve-build-tools:
docker pull lfedge/eve-build-tools:main
.PHONY: pull-eve-build-tools

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

Expand Down

0 comments on commit d2da815

Please sign in to comment.