Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add script for automatic version label bumping #1161

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
default: ""
required: true
latest_release:
description: 'Latest release'
description: "Latest release"
type: boolean
default: false

Expand Down Expand Up @@ -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 }}
Expand All @@ -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 "[email protected]"
Expand All @@ -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: |
Expand Down Expand Up @@ -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 }}
Expand Down
4 changes: 2 additions & 2 deletions components/serverless/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions config/serverless/templates/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 17 additions & 0 deletions hack/replace_serverless_crd_version.sh
Original file line number Diff line number Diff line change
@@ -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
Loading