From 3e236dbfb92f9a5d60902055ea4aa298ec04956a Mon Sep 17 00:00:00 2001 From: Steve Scaffidi Date: Sun, 27 Oct 2024 17:31:39 -0400 Subject: [PATCH] auto-set version from git tags --- Makefile | 15 +++++++++++++-- .../istio-fortsa.clusterserviceversion.yaml | 8 ++++---- config/manager/kustomization.yaml | 2 +- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 23fbf82..0363e26 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,18 @@ # To re-generate a bundle for another specific version without changing the standard setup, you can: # - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2) # - use environment variables to overwrite this value (e.g export VERSION=0.0.2) -VERSION ?= 0.0.5 + +# git tags should be of the format vX.Y.Z (semver-compliant) +GIT_TAG := $(shell git describe --tags) + +# version to use inside bundles and catalog etc +VERSION ?= $(GIT_TAG:v%=%) + +# tag to use for the docker image +IMG_TAG ?= v$(VERSION) + +# in the OLM bundle, the operator version has to have the format X.Y.Z (semver-compliant) +#BUNDLE_OLM_VERSION := $(VERSION) # CHANNELS define the bundle channels used in the bundle. # Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable") @@ -50,7 +61,7 @@ endif # This is useful for CI or a project to utilize a specific version of the operator-sdk toolkit. OPERATOR_SDK_VERSION ?= v1.36.1 # Image URL to use all building/pushing image targets -IMG ?= $(IMAGE_TAG_BASE):$(VERSION) +IMG ?= $(IMAGE_TAG_BASE):$(IMG_TAG) # ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary. ENVTEST_K8S_VERSION = 1.29.0 diff --git a/bundle/manifests/istio-fortsa.clusterserviceversion.yaml b/bundle/manifests/istio-fortsa.clusterserviceversion.yaml index 8dfa101..28136b3 100644 --- a/bundle/manifests/istio-fortsa.clusterserviceversion.yaml +++ b/bundle/manifests/istio-fortsa.clusterserviceversion.yaml @@ -4,10 +4,10 @@ metadata: annotations: alm-examples: '[]' capabilities: Basic Install - createdAt: "2024-10-27T14:59:27Z" + createdAt: "2024-10-27T21:24:58Z" operators.operatorframework.io/builder: operator-sdk-v1.36.1 operators.operatorframework.io/project_layout: go.kubebuilder.io/v4 - name: istio-fortsa.v0.0.5 + name: istio-fortsa.v0.0.6 namespace: placeholder spec: apiservicedefinitions: {} @@ -136,7 +136,7 @@ spec: - --leader-elect command: - /manager - image: ghcr.io/hercynium/istio-fortsa:0.0.5 + image: ghcr.io/hercynium/istio-fortsa:v0.0.6 livenessProbe: httpGet: path: /healthz @@ -219,4 +219,4 @@ spec: minKubeVersion: 1.24.0 provider: name: istio-fortsa - version: 0.0.5 + version: 0.0.6 diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 512d785..530df7d 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -5,4 +5,4 @@ kind: Kustomization images: - name: controller newName: ghcr.io/hercynium/istio-fortsa - newTag: 0.0.5 + newTag: v0.0.6