From 9ebf14c6a6b94cfcc980ef1d656ddee02c77aa54 Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Mon, 9 Jan 2023 20:52:50 -0600 Subject: [PATCH 1/3] Changes required to prefix version with 'v'. --- .ci/setenvconfig | 6 +++++- Makefile | 2 +- hack/manifest-gen/Makefile | 2 +- hack/manifest-gen/manifest-gen.sh | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.ci/setenvconfig b/.ci/setenvconfig index 2390d81bfe..f112d67a56 100755 --- a/.ci/setenvconfig +++ b/.ci/setenvconfig @@ -667,7 +667,7 @@ GO_TAGS=release export LICENSE_PUBKEY=${PROJECT_PATH}/.ci/license.key SNAPSHOT=true -IMG_VERSION=$(cat $WORKSPACE/VERSION)-$(date +%F)-$(git rev-parse --short --verify HEAD) +IMG_VERSION=v$(cat $WORKSPACE/VERSION)-$(date +%F)-$(git rev-parse --short --verify HEAD) ENV else @@ -687,6 +687,10 @@ export LICENSE_PUBKEY=${PROJECT_PATH}/.ci/license.key SNAPSHOT=false IMG_VERSION=$TAG_NAME +# If IMG_VERSION doesn't begin with a 'v', add it. +if [[ ! "${IMG_VERSION}" =~ ^v.* ]]; then + IMG_VERSION = "v${IMG_VERSION}" +fi ENV fi diff --git a/Makefile b/Makefile index e0f06ed9ec..5c1da10e76 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ REGISTRY ?= docker.elastic.co REGISTRY_NAMESPACE ?= eck-dev NAME ?= eck-operator SNAPSHOT ?= true -VERSION ?= $(shell cat VERSION) +VERSION ?= v$(shell cat VERSION) TAG ?= $(shell git rev-parse --short=8 --verify HEAD) IMG_NAME ?= $(NAME)$(IMG_SUFFIX) IMG_VERSION ?= $(VERSION)-$(TAG) diff --git a/hack/manifest-gen/Makefile b/hack/manifest-gen/Makefile index a157196c36..cf1ec8258e 100644 --- a/hack/manifest-gen/Makefile +++ b/hack/manifest-gen/Makefile @@ -3,7 +3,7 @@ # you may not use this file except in compliance with the Elastic License 2.0. RESTRICTED_NS:= elastic-system -DOCKER_IMAGE := docker.elastic.co/eck/manifest-gen:$(shell cat ../../VERSION) +DOCKER_IMAGE := docker.elastic.co/eck/manifest-gen:v$(shell cat ../../VERSION) .PHONY: gen-global gen-global: diff --git a/hack/manifest-gen/manifest-gen.sh b/hack/manifest-gen/manifest-gen.sh index 078f70489a..14ee2b8879 100755 --- a/hack/manifest-gen/manifest-gen.sh +++ b/hack/manifest-gen/manifest-gen.sh @@ -17,6 +17,7 @@ update_chart() { local ALL_CRDS="${SCRIPT_DIR}/../../config/crds/v1/all-crds.yaml" local VERSION + # Do not prefix this version with 'v', as it's handled below for only appVersion VERSION=$(cat "${SCRIPT_DIR}/../../VERSION") local SED="sed_gnu" @@ -29,11 +30,11 @@ update_chart() { kubectl kustomize "${SCRIPT_DIR}/crd_patches/v1" > "${CRD_CHART_DIR}/templates/all-crds.yaml" # Update the versions in the main chart - "$SED" -E "s#appVersion: [0-9]+\.[0-9]+\.[0-9]+.*#appVersion: $VERSION#" "${CHART_DIR}/Chart.yaml" + "$SED" -E "s#appVersion: v[0-9]+\.[0-9]+\.[0-9]+.*#appVersion: v${VERSION}#" "${CHART_DIR}/Chart.yaml" "$SED" -E "s#version: [0-9]+\.[0-9]+\.[0-9]+.*#version: $VERSION#" "${CHART_DIR}/Chart.yaml" # Update the versions in the CRD chart - "$SED" -E "s#appVersion: [0-9]+\.[0-9]+\.[0-9]+.*#appVersion: $VERSION#" "${CRD_CHART_DIR}/Chart.yaml" + "$SED" -E "s#appVersion: v[0-9]+\.[0-9]+\.[0-9]+.*#appVersion: v${VERSION}#" "${CRD_CHART_DIR}/Chart.yaml" "$SED" -E "s#version: [0-9]+\.[0-9]+\.[0-9]+.*#version: $VERSION#" "${CRD_CHART_DIR}/Chart.yaml" } From 1da28f12ed3d3c6e0eb647b43de71265125d01cb Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Mon, 6 Feb 2023 09:53:41 -0600 Subject: [PATCH 2/3] Just remove 'v' prefix from git tag and don't use it anywhere else. Signed-off-by: Michael Montgomery --- .ci/setenvconfig | 8 ++------ Makefile | 2 +- hack/manifest-gen/Makefile | 2 +- hack/manifest-gen/manifest-gen.sh | 5 ++--- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.ci/setenvconfig b/.ci/setenvconfig index f112d67a56..f617972835 100755 --- a/.ci/setenvconfig +++ b/.ci/setenvconfig @@ -667,7 +667,7 @@ GO_TAGS=release export LICENSE_PUBKEY=${PROJECT_PATH}/.ci/license.key SNAPSHOT=true -IMG_VERSION=v$(cat $WORKSPACE/VERSION)-$(date +%F)-$(git rev-parse --short --verify HEAD) +IMG_VERSION=$(cat $WORKSPACE/VERSION)-$(date +%F)-$(git rev-parse --short --verify HEAD) ENV else @@ -686,11 +686,7 @@ GO_TAGS=release export LICENSE_PUBKEY=${PROJECT_PATH}/.ci/license.key SNAPSHOT=false -IMG_VERSION=$TAG_NAME -# If IMG_VERSION doesn't begin with a 'v', add it. -if [[ ! "${IMG_VERSION}" =~ ^v.* ]]; then - IMG_VERSION = "v${IMG_VERSION}" -fi +IMG_VERSION=${TAG_NAME#"v"} ENV fi diff --git a/Makefile b/Makefile index 5c1da10e76..e0f06ed9ec 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ REGISTRY ?= docker.elastic.co REGISTRY_NAMESPACE ?= eck-dev NAME ?= eck-operator SNAPSHOT ?= true -VERSION ?= v$(shell cat VERSION) +VERSION ?= $(shell cat VERSION) TAG ?= $(shell git rev-parse --short=8 --verify HEAD) IMG_NAME ?= $(NAME)$(IMG_SUFFIX) IMG_VERSION ?= $(VERSION)-$(TAG) diff --git a/hack/manifest-gen/Makefile b/hack/manifest-gen/Makefile index cf1ec8258e..a157196c36 100644 --- a/hack/manifest-gen/Makefile +++ b/hack/manifest-gen/Makefile @@ -3,7 +3,7 @@ # you may not use this file except in compliance with the Elastic License 2.0. RESTRICTED_NS:= elastic-system -DOCKER_IMAGE := docker.elastic.co/eck/manifest-gen:v$(shell cat ../../VERSION) +DOCKER_IMAGE := docker.elastic.co/eck/manifest-gen:$(shell cat ../../VERSION) .PHONY: gen-global gen-global: diff --git a/hack/manifest-gen/manifest-gen.sh b/hack/manifest-gen/manifest-gen.sh index 14ee2b8879..a66ba8bcd9 100755 --- a/hack/manifest-gen/manifest-gen.sh +++ b/hack/manifest-gen/manifest-gen.sh @@ -17,7 +17,6 @@ update_chart() { local ALL_CRDS="${SCRIPT_DIR}/../../config/crds/v1/all-crds.yaml" local VERSION - # Do not prefix this version with 'v', as it's handled below for only appVersion VERSION=$(cat "${SCRIPT_DIR}/../../VERSION") local SED="sed_gnu" @@ -30,11 +29,11 @@ update_chart() { kubectl kustomize "${SCRIPT_DIR}/crd_patches/v1" > "${CRD_CHART_DIR}/templates/all-crds.yaml" # Update the versions in the main chart - "$SED" -E "s#appVersion: v[0-9]+\.[0-9]+\.[0-9]+.*#appVersion: v${VERSION}#" "${CHART_DIR}/Chart.yaml" + "$SED" -E "s#appVersion: v[0-9]+\.[0-9]+\.[0-9]+.*#appVersion: ${VERSION}#" "${CHART_DIR}/Chart.yaml" "$SED" -E "s#version: [0-9]+\.[0-9]+\.[0-9]+.*#version: $VERSION#" "${CHART_DIR}/Chart.yaml" # Update the versions in the CRD chart - "$SED" -E "s#appVersion: v[0-9]+\.[0-9]+\.[0-9]+.*#appVersion: v${VERSION}#" "${CRD_CHART_DIR}/Chart.yaml" + "$SED" -E "s#appVersion: v[0-9]+\.[0-9]+\.[0-9]+.*#appVersion: ${VERSION}#" "${CRD_CHART_DIR}/Chart.yaml" "$SED" -E "s#version: [0-9]+\.[0-9]+\.[0-9]+.*#version: $VERSION#" "${CRD_CHART_DIR}/Chart.yaml" } From b0757bde03b62bca317b21e552635426588f4a88 Mon Sep 17 00:00:00 2001 From: Michael Montgomery Date: Mon, 6 Feb 2023 10:00:18 -0600 Subject: [PATCH 3/3] Remove 'v' prefix in semver in SED Signed-off-by: Michael Montgomery --- hack/manifest-gen/manifest-gen.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hack/manifest-gen/manifest-gen.sh b/hack/manifest-gen/manifest-gen.sh index a66ba8bcd9..448d333062 100755 --- a/hack/manifest-gen/manifest-gen.sh +++ b/hack/manifest-gen/manifest-gen.sh @@ -29,11 +29,11 @@ update_chart() { kubectl kustomize "${SCRIPT_DIR}/crd_patches/v1" > "${CRD_CHART_DIR}/templates/all-crds.yaml" # Update the versions in the main chart - "$SED" -E "s#appVersion: v[0-9]+\.[0-9]+\.[0-9]+.*#appVersion: ${VERSION}#" "${CHART_DIR}/Chart.yaml" + "$SED" -E "s#appVersion: [0-9]+\.[0-9]+\.[0-9]+.*#appVersion: ${VERSION}#" "${CHART_DIR}/Chart.yaml" "$SED" -E "s#version: [0-9]+\.[0-9]+\.[0-9]+.*#version: $VERSION#" "${CHART_DIR}/Chart.yaml" # Update the versions in the CRD chart - "$SED" -E "s#appVersion: v[0-9]+\.[0-9]+\.[0-9]+.*#appVersion: ${VERSION}#" "${CRD_CHART_DIR}/Chart.yaml" + "$SED" -E "s#appVersion: [0-9]+\.[0-9]+\.[0-9]+.*#appVersion: ${VERSION}#" "${CRD_CHART_DIR}/Chart.yaml" "$SED" -E "s#version: [0-9]+\.[0-9]+\.[0-9]+.*#version: $VERSION#" "${CRD_CHART_DIR}/Chart.yaml" }