@@ -12,6 +12,11 @@ BUILD_DATE := $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
12
12
# variables are inserted in Dockerfile to enable recovering the original git
13
13
# metadata at build time.
14
14
GIT_COMMIT := $(if $(SOURCE_GIT_COMMIT ) ,$(SOURCE_GIT_COMMIT ) ,$(shell git rev-parse HEAD) )
15
+ # ART also populates OS_GIT_MAJOR, OS_GIT_MINOR, OS_GIT_PATCH, OS_GIT_VERSION
16
+ # and BUILD_VERSION as part of the Docker ENV reflecting the OpenShift version
17
+ # for the image.
18
+ # OLM_VERSION needs to be semver2 compatible for helm v2.
19
+ OLM_VERSION := $(or $(OS_GIT_VERSION ) ,0.0.0-$(GIT_COMMIT ) )
15
20
16
21
GO_BUILD_OPTS := -mod=vendor
17
22
GO_BUILD_TAGS := -tags "json1"
@@ -69,7 +74,7 @@ $(REGISTRY_CMDS): version_flags=-ldflags "-X '$(REGISTRY_PKG)/cmd/opm/version.gi
69
74
$(REGISTRY_CMDS ) :
70
75
go build $(version_flags ) $(GO_BUILD_OPTS ) $(GO_BUILD_TAGS ) -o $@ $(REGISTRY_PKG ) /cmd/$(notdir $@ )
71
76
72
- $(OLM_CMDS ) : version_flags=-ldflags "-X $(OLM_PKG ) /pkg/version.GitCommit=$(GIT_COMMIT ) -X $(OLM_PKG ) /pkg/version.OLMVersion=`cat staging/operator-lifecycle-manager/ OLM_VERSION` "
77
+ $(OLM_CMDS ) : version_flags=-ldflags "-X $(OLM_PKG ) /pkg/version.GitCommit=$(GIT_COMMIT ) -X $(OLM_PKG ) /pkg/version.OLMVersion=$( OLM_VERSION ) "
73
78
$(OLM_CMDS ) :
74
79
go build $(version_flags ) $(GO_BUILD_OPTS ) $(GO_BUILD_TAGS ) -o bin/$(shell basename $@ ) $@
75
80
@@ -136,11 +141,11 @@ vendor: update-plugin-deps
136
141
137
142
.PHONY : manifests
138
143
manifests : # # Generate manifests
139
- ./scripts/generate_crds_manifests.sh
144
+ OLM_VERSION= $( OLM_VERSION ) ./scripts/generate_crds_manifests.sh
140
145
141
146
.PHONY : diff
142
147
diff :
143
- git diff --stat HEAD --ignore-submodules --exit-code
148
+ git diff HEAD --ignore-submodules --exit-code
144
149
145
150
verify-vendor : vendor
146
151
$(MAKE ) diff
@@ -181,7 +186,7 @@ crc-build:
181
186
.PHONY : crc-deploy
182
187
crc-deploy :
183
188
echo " Deploying OLM"
184
- ./scripts/crc-deploy.sh
189
+ OLM_VERSION= $( OLM_VERSION ) ./scripts/crc-deploy.sh
185
190
186
191
.PHONY : crc
187
192
crc : crc-start crc-build crc-deploy
0 commit comments