Skip to content

Commit 951e9b6

Browse files
committed
remove dependence on OLM_VERSION file
1 parent 6b40038 commit 951e9b6

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

Makefile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ BUILD_DATE := $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
1212
# variables are inserted in Dockerfile to enable recovering the original git
1313
# metadata at build time.
1414
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))
1520

1621
GO_BUILD_OPTS := -mod=vendor
1722
GO_BUILD_TAGS := -tags "json1"
@@ -69,7 +74,7 @@ $(REGISTRY_CMDS): version_flags=-ldflags "-X '$(REGISTRY_PKG)/cmd/opm/version.gi
6974
$(REGISTRY_CMDS):
7075
go build $(version_flags) $(GO_BUILD_OPTS) $(GO_BUILD_TAGS) -o $@ $(REGISTRY_PKG)/cmd/$(notdir $@)
7176

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)"
7378
$(OLM_CMDS):
7479
go build $(version_flags) $(GO_BUILD_OPTS) $(GO_BUILD_TAGS) -o bin/$(shell basename $@) $@
7580

@@ -136,11 +141,11 @@ vendor: update-plugin-deps
136141

137142
.PHONY: manifests
138143
manifests: ## Generate manifests
139-
./scripts/generate_crds_manifests.sh
144+
OLM_VERSION=$(OLM_VERSION) ./scripts/generate_crds_manifests.sh
140145

141146
.PHONY: diff
142147
diff:
143-
git diff --stat HEAD --ignore-submodules --exit-code
148+
git diff HEAD --ignore-submodules --exit-code
144149

145150
verify-vendor: vendor
146151
$(MAKE) diff
@@ -181,7 +186,7 @@ crc-build:
181186
.PHONY: crc-deploy
182187
crc-deploy:
183188
echo "Deploying OLM"
184-
./scripts/crc-deploy.sh
189+
OLM_VERSION=$(OLM_VERSION) ./scripts/crc-deploy.sh
185190

186191
.PHONY: crc
187192
crc: crc-start crc-build crc-deploy

operator-lifecycle-manager.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ COPY .git/refs/heads/. .git/refs/heads
1212
RUN mkdir -p .git/objects
1313

1414
COPY . .
15-
RUN make build/olm bin/cpb
15+
RUN make manifests build/olm bin/cpb
1616

1717
FROM registry.ci.openshift.org/ocp/4.13:base
1818

19-
ADD manifests/ /manifests
19+
COPY --from=builder /build/manifests /manifests
2020
LABEL io.openshift.release.operator=true
2121

2222
# Copy the binary to a standard location where it will run.

scripts/generate_crds_manifests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ CONTROLLER_GEN="go run ./vendor/sigs.k8s.io/controller-tools/cmd/controller-gen"
1212
HELM="go run helm.sh/helm/v3/cmd/helm"
1313

1414

15-
ver=$(cat ./staging/operator-lifecycle-manager/OLM_VERSION)
15+
ver=${OLM_VERSION:-"0.0.0-dev"}
1616
tmpdir="$(mktemp -p . -d 2>/dev/null || mktemp -d ./tmpdir.XXXXXXX)"
1717
chartdir="${tmpdir}/chart"
1818
crddir="${chartdir}/crds"

0 commit comments

Comments
 (0)