File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,15 @@ IMAGE_TAG ?= "dev"
16
16
SPECIFIC_UNIT_TEST := $(if $(TEST ) ,-run $(TEST ) ,)
17
17
export GO111MODULE =on
18
18
19
+ # ART builds are performed in dist-git, with content (but not commits) copied
20
+ # from the source repo. Thus at build time if your code is inspecting the local
21
+ # git repo it is getting unrelated commits and tags from the dist-git repo,
22
+ # not the source repo.
23
+ # For ART image builds, SOURCE_GIT_COMMIT, SOURCE_GIT_TAG, SOURCE_DATE_EPOCH
24
+ # variables are inserted in Dockerfile to enable recovering the original git
25
+ # metadata at build time.
26
+ GIT_COMMIT := $(if $(SOURCE_GIT_COMMIT ) ,$(SOURCE_GIT_COMMIT ) ,$(shell git rev-parse HEAD) )
27
+
19
28
.PHONY : build test run clean vendor schema-check \
20
29
vendor-update coverage coverage-html e2e .FORCE
21
30
@@ -54,7 +63,7 @@ build-linux: build_cmd=build
54
63
build-linux : arch_flags=GOOS=linux GOARCH=386
55
64
build-linux : clean $(CMDS )
56
65
57
- $(CMDS ) : version_flags=-ldflags "-X $(PKG ) /pkg/version.GitCommit=`git rev-parse --short HEAD` -X $(PKG ) /pkg/version.OLMVersion=`cat OLM_VERSION`"
66
+ $(CMDS ) : version_flags=-ldflags "-X $(PKG ) /pkg/version.GitCommit=$( GIT_COMMIT ) -X $(PKG ) /pkg/version.OLMVersion=`cat OLM_VERSION`"
58
67
$(CMDS ) :
59
68
CGO_ENABLED=0 $(arch_flags ) go $(build_cmd ) $(MOD_FLAGS ) $(version_flags ) -o bin/$(shell basename $@ ) $@
60
69
You can’t perform that action at this time.
0 commit comments