Patching Software with GitOps, Helm, and Argo CD
This is a minor upgrade. Major upgrades are harder.
Argo CD deploys whatever is on main.
-
Pull the repo and open a new branch.
cd ~/git/forgejo git pull git switch -c ariadne/forgejo-17.3.2 -
Render the current chart and build an old template with Helm.
helm dependency build chart helm template forgejo chart -n forgejo > forgejo-old.yaml -
Change the software version (this is the upgrade step).
sed -i 's/version: 17.1.1/version: 17.3.2/' chart/Chart.yaml -
Render the updated chart and build a new template with Helm.
helm dependency update chart helm template forgejo chart -n forgejo > forgejo-new.yaml -
Diff the templates
This is a sanity check step, Helm requires new
Chart.yaml, andChart.lockfiles.diff forgejo-old.yaml forgejo-new.yaml | less -
Removed the templates
These don’t get deployed, only checked.
rm forgejo-old.yaml rm forgejo-new.yaml -
Commit
Chart.yaml, andChart.lockgit add chart/Chart.yaml chart/Chart.lock git commit -m "Minor upgrade: Forgejo 15.0.3 to 15.0.11" git push -u origin ariadne/forgejo-17.3.2 -
Open a PR (or merge to
main)Fast-forward … I’ll merge into main on my own repo.
git fetch origin git checkout main && git pull --ff-only git merge --ff-only origin/ariadne/forgejo-17.3.2 git push origin main -
Check kubectl to see if it deployed.
! ! Skip the wait with refresh=hard ! kubectl -n argocd annotate app forgejo argocd.argoproj.io/refresh=hard --overwrite kubectl -n argocd get app forgejo -w kubectl -n forgejo rollout status deploy/forgejo
Rolling back
git revert HEAD
git push origin main