Skip to content

Commit

Permalink
Merge pull request rancher#478 from thomasferrandiz/updatecli-multus
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasferrandiz authored Jun 12, 2024
2 parents 14561ab + 93feff0 commit ca6cfef
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
22 changes: 22 additions & 0 deletions updatecli/scripts/update-multus.sh
Original file line number Diff line number Diff line change
@@ -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
56 changes: 56 additions & 0 deletions updatecli/updatecli.d/updatemultus.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ca6cfef

Please sign in to comment.