Added automatic update for cni plugins image on cilium chart

Signed-off-by: Roberto Bonafiglia <roberto.bonafiglia@suse.com>
main-source
Roberto Bonafiglia 2025-01-14 15:52:56 +01:00 committed by Roberto Bonafiglia
parent 679d2279e6
commit 40cac70490
2 changed files with 30 additions and 1 deletions

View File

@ -1,5 +1,15 @@
#!/bin/bash
set -eu
if [ -n "$CNI_PLUGINS_VERSION" ]; then
current_cni_plugins_version=$(sed -nr 's/\+ tag: \"(v'[0-9]+.[0-9]+.[0-9]+-build[0-9]+')\"/\1/p' packages/rke2-cilium/generated-changes/patch/values.yaml.patch)
if [ "$current_cni_plugins_version" != "$CNI_PLUGINS_VERSION" ]; then
sed -ie "s/$current_cni_plugins_version/$CNI_PLUGINS_VERSION/g" packages/rke2-cilium/generated-changes/patch/values.yaml.patch
sed -ie "s/$current_cni_plugins_version/$CNI_PLUGINS_VERSION/g" updatecli/scripts/cilium-values.yaml.patch.template
package_version=$(yq '.packageVersion' packages/rke2-cilium/package.yaml)
new_version=$(printf "%02d" $(($package_version + 1)))
yq -i ".packageVersion = $new_version" packages/rke2-cilium/package.yaml
fi
fi
if [ -n "$CILIUM_VERSION" ]; then
current_cilium_version=$(sed -nr 's/^\ version: ('[0-9]+.[0-9]+.[0-9]+')/\1/p' packages/rke2-cilium/generated-changes/patch/Chart.yaml.patch)
if [ "v$current_cilium_version" != "$CILIUM_VERSION" ]; then

View File

@ -16,6 +16,23 @@ sources:
latest: true
versionfilter:
kind: latest
cni_plugins:
name: Get CNI plugins version
kind: githubrelease
spec:
owner: rancher
repository: image-build-cni-plugins
token: '{{ requiredEnv .github.token }}'
username: '{{ requiredEnv .github.username }}'
typefilter:
latest: true
release: true
draft: false
prerelease: false
versionfilter:
kind: regex
# pattern accepts any semver constraint
pattern: "v[0-9]+.[0-9]+.[0-9]+-build[0-9]+"
targets:
ciliumImage:
@ -28,6 +45,8 @@ targets:
environments:
- name: CILIUM_VERSION
value: '{{ source "cilium" }}'
- name: CNI_PLUGINS_VERSION
value: '{{ source "cni_plugins" }}'
- name: PATH
@ -45,7 +64,7 @@ scms:
actions:
default:
title: 'Update Cilium version to {{ source "cilium" }}'
title: 'Update Cilium version to {{ source "cilium" }} and CNI plugins image to {{ source "cni_plugins" }}'
kind: github/pullrequest
spec:
automerge: false