From c692ca1d48685c7fd2253146c93491412cd0d158 Mon Sep 17 00:00:00 2001 From: timflannagan Date: Thu, 17 Feb 2022 10:02:03 -0500 Subject: [PATCH 1/2] Remove the root OLM_VERSION file This file is now out-of-date as we no longer use this file to track OLM release versioning. Signed-off-by: timflannagan --- OLM_VERSION | 1 - 1 file changed, 1 deletion(-) delete mode 100644 OLM_VERSION diff --git a/OLM_VERSION b/OLM_VERSION deleted file mode 100644 index 1cf0537c34..0000000000 --- a/OLM_VERSION +++ /dev/null @@ -1 +0,0 @@ -0.19.0 From d5860c195b1bb29270e0e9197e40911872bd6dbf Mon Sep 17 00:00:00 2001 From: timflannagan Date: Thu, 17 Feb 2022 11:37:18 -0500 Subject: [PATCH 2/2] Ensure the correct OLM version information is produced Update the build and release related Makefile targets to consume the latest annotated git tag information. Signed-off-by: timflannagan --- Dockerfile | 1 - Makefile | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 961037796a..fceed3a84a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,6 @@ COPY .git/HEAD .git/HEAD COPY .git/refs/heads/. .git/refs/heads RUN mkdir -p .git/objects COPY Makefile Makefile -COPY OLM_VERSION OLM_VERSION COPY pkg pkg COPY vendor vendor COPY go.mod go.mod diff --git a/Makefile b/Makefile index 98632a27fb..ca073a3727 100644 --- a/Makefile +++ b/Makefile @@ -29,6 +29,8 @@ GO := GO111MODULE=on GOFLAGS="$(MOD_FLAGS)" go GINKGO := $(GO) run github.com/onsi/ginkgo/v2/ginkgo BINDATA := $(GO) run github.com/go-bindata/go-bindata/v3/go-bindata GIT_COMMIT := $(shell git rev-parse HEAD) +GIT_VERSION := $(shell git describe --dirty --tags --always) +GIT_TAG := $(shell git describe --tags --abbrev=0) # Phony prerequisite for targets that rely on the go build cache to determine staleness. .PHONY: build test clean vendor \ @@ -98,7 +100,7 @@ build-util: bin/cpb bin/cpb: FORCE CGO_ENABLED=0 $(arch_flags) go build $(MOD_FLAGS) -ldflags '-extldflags "-static"' -o $@ ./util/cpb -$(CMDS): version_flags=-ldflags "-X $(PKG)/pkg/version.GitCommit=$(GIT_COMMIT) -X $(PKG)/pkg/version.OLMVersion=`cat OLM_VERSION`" +$(CMDS): version_flags=-ldflags "-X $(PKG)/pkg/version.GitCommit=$(GIT_COMMIT) -X $(PKG)/pkg/version.OLMVersion=$(GIT_VERSION)" $(CMDS): $(arch_flags) go $(build_cmd) $(MOD_FLAGS) $(version_flags) -tags $(BUILD_TAGS) -o bin/$(shell basename $@) $@ @@ -222,9 +224,7 @@ verify-manifests: manifests verify: verify-codegen verify-mockgen verify-manifests -# before running release, bump the version in OLM_VERSION and push to master, -# then tag those builds in quay with the version in OLM_VERSION -release: ver=v$(shell cat OLM_VERSION) +release: ver=$(GIT_TAG) release: manifests @echo "Generating the $(ver) release" docker pull $(IMAGE_REPO):$(ver)