diff --git a/.github/workflows/create-release.yaml b/.github/workflows/create-release.yaml index c74409ecf..c800e4b33 100644 --- a/.github/workflows/create-release.yaml +++ b/.github/workflows/create-release.yaml @@ -8,7 +8,7 @@ on: default: "" required: true latest_release: - description: 'Latest release' + description: "Latest release" type: boolean default: false @@ -45,6 +45,7 @@ jobs: - name: Bump values.yaml run: | ./hack/replace_serverless_chart_images.sh all . + ./hack/replace_serverless_crd_version.sh env: IMG_DIRECTORY: "prod" IMG_VERSION: ${{ github.event.inputs.name }} @@ -54,7 +55,7 @@ jobs: run: ./.github/scripts/upgrade-sec-scanners-config.sh env: IMG_VERSION: ${{ github.event.inputs.name }} - + - name: Commit&Push run: | git config --local user.email "team-otters@sap.com" @@ -74,7 +75,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.ref_name }} # Checkout to latest branch changes + ref: ${{ github.ref_name }} # Checkout to latest branch changes - name: Create tag run: | @@ -138,7 +139,7 @@ jobs: with: fetch-depth: 0 ref: ${{ github.event.inputs.name }} # checkout to latest branch changes ( by default this action checkouts to the SHA that triggers action ) - + - name: Publish release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/components/serverless/config/crd/kustomization.yaml b/components/serverless/config/crd/kustomization.yaml index 7211cdfe9..1ecec5765 100644 --- a/components/serverless/config/crd/kustomization.yaml +++ b/components/serverless/config/crd/kustomization.yaml @@ -2,7 +2,7 @@ # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default resources: -- bases/serverless.kyma-project.io_functions.yaml + - bases/serverless.kyma-project.io_functions.yaml # +kubebuilder:scaffold:crdkustomizeresource # patchesStrategicMerge: @@ -31,7 +31,7 @@ patches: commonLabels: kyma-project.io/module: serverless app.kubernetes.io/name: serverless - app.kubernetes.io/version: "{{ .Values.global.images.function_controller.version }}" + app.kubernetes.io/version: "main" app.kubernetes.io/part-of: serverless app.kubernetes.io/managed-by: kustomize diff --git a/config/serverless/templates/crds.yaml b/config/serverless/templates/crds.yaml index 0ca974fba..756127007 100644 --- a/config/serverless/templates/crds.yaml +++ b/config/serverless/templates/crds.yaml @@ -9,8 +9,7 @@ metadata: app.kubernetes.io/managed-by: kustomize app.kubernetes.io/name: serverless app.kubernetes.io/part-of: serverless - app.kubernetes.io/version: '{{ .Values.global.images.function_controller.version - }}' + app.kubernetes.io/version: main kyma-project.io/module: serverless name: functions.serverless.kyma-project.io spec: diff --git a/hack/replace_serverless_crd_version.sh b/hack/replace_serverless_crd_version.sh new file mode 100755 index 000000000..ca36003ee --- /dev/null +++ b/hack/replace_serverless_crd_version.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +KUSTOMIZATION_DIRECTORY=${PROJECT_ROOT}/components/serverless/config/crd +KUSTOMIZATION_FILE=${KUSTOMIZATION_DIRECTORY}/kustomization.yaml + +REQUIRED_ENV_VARIABLES=('IMG_VERSION' 'PROJECT_ROOT') +for VAR in "${REQUIRED_ENV_VARIABLES[@]}"; do + if [ -z "${!VAR}" ]; then + echo "${VAR} is undefined" + exit 1 + fi +done + +VERSION_SELECTOR='.commonLabels."app.kubernetes.io/version"' +yq --inplace "${VERSION_SELECTOR} = \"${IMG_VERSION}\"" ${KUSTOMIZATION_FILE} + +make -C ${PROJECT_ROOT}/components/serverless manifests