ci: auto-update image tag in kustomization for ArgoCD sync

Add Drone CI step to update kustomization.yaml newTag with commit SHA
after image build, enabling ArgoCD to detect manifest changes and
auto-deploy new images.
This commit is contained in:
Yaojia Wang
2026-03-18 23:32:17 +01:00
parent eac9fe963e
commit d4e06c71b7
2 changed files with 20 additions and 0 deletions

View File

@@ -22,3 +22,19 @@ steps:
--destination=192.168.68.11:30500/invest-api:latest
--insecure
--skip-tls-verify
- name: update-manifests
image: alpine/git:latest
environment:
GITEA_TOKEN:
from_secret: gitea_token
commands:
- cd /drone/src
- TAG=$(echo $DRONE_COMMIT_SHA | cut -c1-8)
- sed -i "s/newTag:.*/newTag: $TAG/" k8s/base/kustomization.yaml
- git config user.email "drone@colacoder.com"
- git config user.name "Drone CI"
- git add k8s/base/kustomization.yaml
- "git commit -m \"chore: update image tag to $TAG [skip ci]\""
- git remote set-url origin https://kai:$GITEA_TOKEN@git.colacoder.com/kai/openbb-invest-api.git
- git push origin main

View File

@@ -9,3 +9,7 @@ resources:
- deployment.yaml
- service.yaml
- ingress.yaml
images:
- name: 192.168.68.11:30500/invest-api
newTag: latest