-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added updatecli to update Flannel chart
Signed-off-by: Roberto Bonafiglia <[email protected]>
- Loading branch information
Showing
2 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
if [ -n "$FLANNEL_VERSION" ]; then | ||
app_version=$(echo "$FLANNEL_VERSION" | grep -Eo 'v[0-9]+.[0-9]+.[0-9+]') | ||
current_flannel_version=$(sed -nr 's/^\+ tag: ('v[0-9]+.[0-9]+.[0-9+]')/\1/p' packages/rke2-flannel/generated-changes/patch/values.yaml.patch | head -1) | ||
current_app_version=$(echo "$current_flannel_version" | grep -Eo 'v[0-9]+.[0-9]+.[0-9+]') | ||
if [ "$current_flannel_version" != "$FLANNEL_VERSION" ]; then | ||
echo "Updating Flannel chart to $FLANNEL_VERSION" | ||
if [ "$app_version" != "$current_app_version" ]; then | ||
sed -i "s/ version: .*/ version: $app_version/g" packages/rke2-flannel/generated-changes/patch/Chart.yaml.patch | ||
sed -i "s/- tag: $current_app_version/- tag: $app_version/g" packages/rke2-flannel/generated-changes/patch/values.yaml.patch | ||
sed -i "s/+ tag: $current_flannel_version/+ tag: $FLANNEL_VERSION/g" packages/rke2-flannel/generated-changes/patch/values.yaml.patch | ||
yq -i ".url = \"https://github.com/flannel-io/flannel/releases/download/$app_version/flannel.tgz\" | | ||
.packageVersion = 00" packages/rke2-flannel/package.yaml | ||
else | ||
sed -i "s/+ tag: $current_flannel_version/+ tag: $FLANNEL_VERSION/g" packages/rke2-flannel/generated-changes/patch/values.yaml.patch | ||
package_version=$(yq '.packageVersion' packages/rke2-flannel/package.yaml) | ||
new_version=$(printf "%02d" $(($package_version + 1))) | ||
yq -i ".packageVersion = $new_version" packages/rke2-flannel/package.yaml | ||
fi | ||
GOCACHE='/home/runner/.cache/go-build' GOPATH='/home/runner/go' PACKAGE='rke2-flannel' make prepare | ||
GOCACHE='/home/runner/.cache/go-build' GOPATH='/home/runner/go' PACKAGE='rke2-flannel' make patch | ||
make clean | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
name: "Update Flannel version" | ||
|
||
sources: | ||
flannel: | ||
name: Get flannel version | ||
kind: githubrelease | ||
spec: | ||
owner: rancher | ||
repository: image-build-flannel | ||
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: | ||
flannelImage: | ||
name: "Bump to latest flannel version on the chart" | ||
kind: shell | ||
scmid: default | ||
sourceid: flannel | ||
spec: | ||
command: 'updatecli/scripts/update-flannel.sh' | ||
environments: | ||
- name: FLANNEL_VERSION | ||
value: '{{ source "flannel" }}' | ||
|
||
|
||
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 Flannel version to {{ source "flannel" }}' | ||
kind: github/pullrequest | ||
spec: | ||
automerge: false | ||
labels: | ||
- chore | ||
- skip-changelog | ||
- status/auto-created | ||
scmid: default |