-
Notifications
You must be signed in to change notification settings - Fork 1
267 lines (209 loc) · 9.79 KB
/
update-kubevirt.yaml
File metadata and controls
267 lines (209 loc) · 9.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
name: Update KubeVirt Chart
on:
schedule:
# Täglich um 2 Uhr morgens UTC
- cron: '0 2 * * *'
workflow_dispatch:
inputs:
force_version:
description: 'Force specific version (e.g. v1.7.0)'
required: false
type: string
jobs:
check-update:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install tools
run: |
# yq for YAML manipulation
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
# helm-docs
curl -sSL https://github.com/norwoodj/helm-docs/releases/download/v1.14.2/helm-docs_1.14.2_Linux_x86_64.tar.gz | tar -xz
sudo mv helm-docs /usr/local/bin/
- name: Get versions
id: versions
run: |
# Current version from Chart
CURRENT=$(yq '.appVersion' charts/kubevirt/Chart.yaml | tr -d '"')
echo "current=$CURRENT" >> $GITHUB_OUTPUT
# Latest release from GitHub
if [[ -n "${{ inputs.force_version }}" ]]; then
LATEST="${{ inputs.force_version }}"
echo "Using forced version: $LATEST"
else
LATEST=$(curl -s https://api.github.com/repos/kubevirt/kubevirt/releases/latest | jq -r .tag_name)
fi
echo "latest=$LATEST" >> $GITHUB_OUTPUT
# Check if update needed
if [[ "$CURRENT" != "$LATEST" ]]; then
echo "needs_update=true" >> $GITHUB_OUTPUT
echo "New version available: $CURRENT -> $LATEST"
else
echo "needs_update=false" >> $GITHUB_OUTPUT
echo "Already up to date: $CURRENT"
fi
- name: Update Chart files
if: steps.versions.outputs.needs_update == 'true'
run: |
NEW_VERSION="${{ steps.versions.outputs.latest }}"
NEW_VERSION_NO_V="${NEW_VERSION#v}"
echo "Updating to $NEW_VERSION..."
# 1. Chart.yaml - Only update appVersion, NOT chart version
# Chart version is independent and follows 0.x.y semantic versioning
yq -i '.appVersion = "'$NEW_VERSION'"' charts/kubevirt/Chart.yaml
# 2. values.yaml - Image Tag
yq -i '.operator.image.tag = "'$NEW_VERSION'"' charts/kubevirt/values.yaml
# 3. README.md.gotmpl - Version References
sed -i "s/v[0-9]\+\.[0-9]\+\.[0-9]\+/$NEW_VERSION/g" charts/kubevirt/README.md.gotmpl || true
- name: Fetch Release Notes
if: steps.versions.outputs.needs_update == 'true'
id: release_notes
run: |
NEW_VERSION="${{ steps.versions.outputs.latest }}"
# Get release notes
RELEASE_DATA=$(curl -s "https://api.github.com/repos/kubevirt/kubevirt/releases/tags/$NEW_VERSION")
# Extract body and save
echo "$RELEASE_DATA" | jq -r '.body' > /tmp/release-notes.md
# Get release URL
RELEASE_URL=$(echo "$RELEASE_DATA" | jq -r '.html_url')
echo "release_url=$RELEASE_URL" >> $GITHUB_OUTPUT
- name: Create PR Body
if: steps.versions.outputs.needs_update == 'true'
run: |
NEW_VERSION="${{ steps.versions.outputs.latest }}"
OLD_VERSION="${{ steps.versions.outputs.current }}"
RELEASE_URL="${{ steps.release_notes.outputs.release_url }}"
cat > /tmp/pr-body.md << 'EOF'
## KubeVirt Update: $OLD_VERSION -> $NEW_VERSION
This PR was automatically created by the KubeVirt update workflow.
### Automated Changes
- [x] Updated Chart.yaml appVersion to `$NEW_VERSION`
- [x] Updated operator image tag to `$NEW_VERSION`
- [x] Updated version references in README
- [x] Regenerated documentation
**Note:** Chart version (0.x.y) is NOT automatically updated - it follows independent semantic versioning.
### Manual Review Required
**BEFORE MERGING, you MUST complete these steps:**
#### 1. Review Release Notes
- [ ] Read [$NEW_VERSION Release Notes]($RELEASE_URL)
- [ ] Identify breaking changes
- [ ] Note new features
- [ ] Check deprecations
#### 2. Update Feature Gates
- [ ] Check if any Beta features became **GA** -> Remove from `featureGates` list
- [ ] Check for **new Alpha/Beta features** -> Add to comments in values.yaml
- [ ] Remove **deprecated features** from values.yaml
**How to check:**
```bash
# Search release notes for "feature gate" mentions
# Look for: "X is now GA", "new feature Y", "deprecated Z"
```
#### 3. Update Configuration
- [ ] Check for **renamed config options** (e.g. `bandwidthPerGiB` -> `bandwidthPerMigration`)
- [ ] Update default values if recommended in release notes
- [ ] Verify GPU passthrough settings still compatible
#### 4. Test Locally
```bash
# Lint
helm lint charts/kubevirt
# Template validation
helm template kubevirt charts/kubevirt --validate
# Dry-run
helm install kubevirt charts/kubevirt \\
-f charts/kubevirt/ci/ci-values.yaml \\
--dry-run --debug
# Install in test cluster (recommended)
helm install kubevirt charts/kubevirt \\
-f charts/kubevirt/ci/ci-values.yaml \\
--namespace kubevirt --create-namespace
# Run tests
helm test kubevirt -n kubevirt
```
#### 5. Bump Chart Version
- [ ] Decide if this is a patch (0.x.y+1), minor (0.x+1.0), or major change
- [ ] Update Chart.yaml `version` field manually
- [ ] Update `artifacthub.io/changes` annotation with changelog
#### 6. Update Documentation
- [ ] Update README.md.gotmpl with new features/changes
- [ ] Run `helm-docs --chart-search-root=charts`
- [ ] Commit documentation changes
#### 7. Verify Templates
- [ ] Check if new KubeVirt components were added (DaemonSets, Services, etc.)
- [ ] Download and compare official manifests if unsure:
```bash
curl -sL https://github.com/kubevirt/kubevirt/releases/download/$NEW_VERSION/kubevirt-operator.yaml > /tmp/operator.yaml
# Compare with templates/operator/
```
### Release Information
<details>
<summary>Click to expand KubeVirt $NEW_VERSION release notes</summary>
EOF
# Insert variables and remove leading whitespace
sed -i "s/\$NEW_VERSION/$NEW_VERSION/g" /tmp/pr-body.md
sed -i "s/\$OLD_VERSION/$OLD_VERSION/g" /tmp/pr-body.md
sed -i "s|\$RELEASE_URL|$RELEASE_URL|g" /tmp/pr-body.md
sed -i 's/^ //g' /tmp/pr-body.md
# Append release notes
cat /tmp/release-notes.md >> /tmp/pr-body.md
# Close details
cat >> /tmp/pr-body.md << 'EOF'
</details>
### Useful Links
- **Release:** $RELEASE_URL
- **Operator Manifest:** https://github.com/kubevirt/kubevirt/releases/download/$NEW_VERSION/kubevirt-operator.yaml
- **CR Example:** https://github.com/kubevirt/kubevirt/releases/download/$NEW_VERSION/kubevirt-cr.yaml
- **Changelog:** https://github.com/kubevirt/kubevirt/blob/main/CHANGELOG.md
---
**WARNING: DO NOT merge without completing the manual checklist above!**
The most critical step is updating Feature Gates - GA features MUST be removed from the featureGates list.
EOF
# Final variable replacement (whitespace already removed in first sed block)
sed -i "s/\$NEW_VERSION/$NEW_VERSION/g" /tmp/pr-body.md
sed -i "s|\$RELEASE_URL|$RELEASE_URL|g" /tmp/pr-body.md
- name: Generate documentation
if: steps.versions.outputs.needs_update == 'true'
run: |
helm-docs --chart-search-root=charts
- name: Create Pull Request
if: steps.versions.outputs.needs_update == 'true'
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "feat(kubevirt): update to ${{ steps.versions.outputs.latest }}"
branch: automated/kubevirt-${{ steps.versions.outputs.latest }}
delete-branch: true
title: "feat(kubevirt): update to ${{ steps.versions.outputs.latest }}"
body-path: /tmp/pr-body.md
labels: |
automated
kubevirt
dependencies
needs-review
draft: false
- name: Summary
if: steps.versions.outputs.needs_update == 'true'
run: |
cat >> $GITHUB_STEP_SUMMARY << EOF
### KubeVirt Update PR Created
**Version:** ${{ steps.versions.outputs.current }} -> ${{ steps.versions.outputs.latest }}
**Next Steps:**
1. Review the created PR
2. Complete the manual checklist (especially Feature Gates!)
3. Test locally
4. Merge when ready
**Important:** Don't forget to update Feature Gates in values.yaml!
EOF
- name: No update needed
if: steps.versions.outputs.needs_update == 'false'
run: |
cat >> $GITHUB_STEP_SUMMARY << EOF
### KubeVirt Chart is up to date
**Current Version:** ${{ steps.versions.outputs.current }}
No update needed.
EOF