Add multus support in updatecli config

pull/478/head
Thomas Ferrandiz 2024-06-12 08:49:34 +00:00
parent 14561ab158
commit 93feff0b0a
2 changed files with 78 additions and 0 deletions

View File

@ -0,0 +1,22 @@
#!/bin/bash
set -eu
if [ -n "$MULTUS_VERSION" ]; then
app_version=$(echo "$MULTUS_VERSION" | grep -Eo 'v[0-9]+.[0-9]+.[0-9]+')
current_multus_version=$(yq '.image.tag' packages/rke2-multus/charts/values.yaml)
current_app_version=$(echo "$current_multus_version" | grep -Eo 'v[0-9]+.[0-9]+.[0-9]+')
if [ "$current_multus_version" != "$MULTUS_VERSION" ]; then
echo "Updating Multus chart to $MULTUS_VERSION"
if [ "$app_version" != "$current_app_version" ]; then
sed -i "s/version: .*/version: $app_version/g" packages/rke2-multus/charts/Chart.yaml
sed -i "s/appVersion: .*/appVersion: $app_version/g" packages/rke2-multus/charts/Chart.yaml
sed -i "s/ tag: $current_app_version/ tag: $app_version/g" packages/rke2-multus/charts/values.yaml
sed -i "s/ tag: $current_multus_version/ tag: $MULTUS_VERSION/g" packages/rke2-multus/charts/values.yaml
yq -i ".packageVersion = 00" packages/rke2-multus/package.yaml
else
sed -i "s/ tag: $current_multus_version/ tag: $MULTUS_VERSION/g" packages/rke2-multus/charts/values.yaml
package_version=$(yq '.packageVersion' packages/rke2-multus/package.yaml)
new_version=$(printf "%02d" $(($package_version + 1)))
yq -i ".packageVersion = $new_version" packages/rke2-multus/package.yaml
fi
fi
fi

View File

@ -0,0 +1,56 @@
---
name: "Update Multus version"
sources:
calico:
name: Get multus version
kind: githubrelease
spec:
owner: rancher
repository: image-build-multus
token: '{{ requiredEnv .github.token }}'
typefilter:
release: true
draft: false
prerelease: false
latest: true
versionfilter:
kind: latest
targets:
multusImage:
name: "Bump to latest multus version in the chart"
kind: shell
scmid: default
sourceid: multus
spec:
command: 'updatecli/scripts/update-multus.sh'
environments:
- name: MULTUS_VERSION
value: '{{ source "multus" }}'
- name: PATH
scms:
default:
kind: github
spec:
token: '{{ requiredEnv .github.token }}'
username: '{{ requiredEnv .github.username }}'
user: '{{ .github.username }}'
email: '{{ .github.email }}'
owner: '{{ .github.owner }}'
repository: '{{ .github.repository }}'
branch: '{{ .github.branch }}'
actions:
default:
title: 'Update Multus version to {{ source "multus" }}'
kind: github/pullrequest
spec:
automerge: false
labels:
- chore
- skip-changelog
- status/auto-created
scmid: default