From b9bd795baaf5d1f76c23e9060c2f5e760cbb68f5 Mon Sep 17 00:00:00 2001 From: Albian Krasniqi <62391739+waodim@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:50:34 +0200 Subject: [PATCH] Fixes pre-release action by generating correct manifest (#2026) * Fixes github pre-release action that created wrong manifests * Adapt config.mk to being configurable by using env var * Reintroduce accidentally deleted stuff * Adapt config.mk file to check whether env var is set * Fix wrong name --------- Co-authored-by: Lukas Hinterreiter <90035514+luhi-DT@users.noreply.github.com> --- .github/workflows/release.yaml | 9 +++------ hack/make/manifests/config.mk | 22 ++++++++++++---------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 638a162e13..dca0794e9d 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -272,6 +272,7 @@ jobs: run: | export "IMAGE=${{ matrix.url }}/${{ secrets[matrix.repository] }}" export "TAG=$(echo "${{ github.ref }}" | awk -F"/" '{print $3}')" + export "CHART_VERSION=$(echo "${{ github.ref_name }}")" make manifests - name: Generate CRD run: make manifests/crd/release @@ -280,12 +281,8 @@ jobs: with: body_path: ./CHANGELOG.md files: | - config/deploy/kubernetes/gke-autopilot.yaml - config/deploy/kubernetes/kubernetes-csi.yaml - config/deploy/kubernetes/kubernetes.yaml - config/deploy/openshift/openshift-csi.yaml - config/deploy/openshift/openshift.yaml - config/deploy/dynatrace-operator-crd.yaml + config/deploy/kubernetes/kubernetes-all.yaml + config/deploy/openshift/openshift-all.yaml token: ${{ secrets.GITHUB_TOKEN }} prerelease: true draft: true diff --git a/hack/make/manifests/config.mk b/hack/make/manifests/config.mk index 25694b302c..e19405544c 100644 --- a/hack/make/manifests/config.mk +++ b/hack/make/manifests/config.mk @@ -19,17 +19,19 @@ OPENSHIFT_CSIDRIVER_YAML=$(MANIFESTS_DIR)openshift/openshift-csi.yaml OPENSHIFT_OLM_YAML=$(MANIFESTS_DIR)openshift/openshift-olm.yaml OPENSHIFT_ALL_YAML=$(MANIFESTS_DIR)openshift/openshift-all.yaml -ifneq ($(shell git branch --show-current | grep "^release-"),) - # if the current branch is a release branch - ifneq ($(shell grep "^version:" $(HELM_CHART_DEFAULT_DIR)/Chart.yaml | grep snapshot),) - CHART_VERSION=$(shell git branch --show-current | cut -d'-' -f2-).0 +ifeq ($(shell echo $CHART_VERSION),) + ifneq ($(shell git branch --show-current | grep "^release-"),) + # if the current branch is a release branch + ifneq ($(shell grep "^version:" $(HELM_CHART_DEFAULT_DIR)/Chart.yaml | grep snapshot),) + CHART_VERSION=$(shell git branch --show-current | cut -d'-' -f2-).0 + else + CHART_VERSION= + endif + else ifeq ($(shell git branch --show-current), main) + # if the current branch is the main branch + CHART_VERSION=0.0.0-snapshot else + # otherwise do not change Chart.yaml CHART_VERSION= endif -else ifeq ($(shell git branch --show-current), main) - # if the current branch is the main branch - CHART_VERSION=0.0.0-snapshot -else - # otherwise do not change Chart.yaml - CHART_VERSION= endif