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:
16
.drone.yml
16
.drone.yml
@@ -22,3 +22,19 @@ steps:
|
|||||||
--destination=192.168.68.11:30500/invest-api:latest
|
--destination=192.168.68.11:30500/invest-api:latest
|
||||||
--insecure
|
--insecure
|
||||||
--skip-tls-verify
|
--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
|
||||||
|
|||||||
@@ -9,3 +9,7 @@ resources:
|
|||||||
- deployment.yaml
|
- deployment.yaml
|
||||||
- service.yaml
|
- service.yaml
|
||||||
- ingress.yaml
|
- ingress.yaml
|
||||||
|
|
||||||
|
images:
|
||||||
|
- name: 192.168.68.11:30500/invest-api
|
||||||
|
newTag: latest
|
||||||
|
|||||||
Reference in New Issue
Block a user