ci: revert to same as demo-frontend (commit-back)
Some checks failed
Build & Deploy Go API / build (push) Has been cancelled
Some checks failed
Build & Deploy Go API / build (push) Has been cancelled
This commit is contained in:
@@ -12,7 +12,7 @@ jobs:
|
|||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- name: Install build tools
|
- name: Install build tools
|
||||||
run: apk add --no-cache curl git docker-cli jq 2>/dev/null || true
|
run: apk add --no-cache curl git docker-cli 2>/dev/null || true
|
||||||
|
|
||||||
- name: Clone + prepare
|
- name: Clone + prepare
|
||||||
run: |
|
run: |
|
||||||
@@ -42,14 +42,17 @@ jobs:
|
|||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
REGISTRY: ${{ env.REGISTRY }}
|
REGISTRY: ${{ env.REGISTRY }}
|
||||||
|
|
||||||
- name: Update ArgoCD
|
- name: Update image tag in values.yaml (commit-back GitOps)
|
||||||
run: |
|
run: |
|
||||||
|
cd /root/.cache/demo-go-api
|
||||||
SHORT=${GITHUB_SHA::8}
|
SHORT=${GITHUB_SHA::8}
|
||||||
# Use kubectl to update ArgoCD image tag directly (no git push needed)
|
sed -i "s/^ tag:.*/ tag: \"${SHORT}\"/" deploy/helm/values.yaml
|
||||||
PATCH=$(jq -n --arg tag "$SHORT" --arg reg "$REGISTRY" \
|
git config user.email "ci@local"
|
||||||
'{"spec":{"source":{"helm":{"parameters":[{"name":"image.registry","value":$reg},{"name":"image.tag","value":$tag}]}}}}')
|
git config user.name "gitea-ci"
|
||||||
kubectl -n cicd patch application demo-go-api --type=merge -p "$PATCH"
|
git add deploy/helm/values.yaml
|
||||||
echo "✓ ArgoCD updated with tag ${SHORT}"
|
git commit -m "ci: update image tag to ${SHORT}" || echo "nothing to commit"
|
||||||
|
git push origin main
|
||||||
|
echo "✓ Pushed tag ${SHORT}"
|
||||||
env:
|
env:
|
||||||
GITHUB_SHA: ${{ github.sha }}
|
GITHUB_SHA: ${{ github.sha }}
|
||||||
REGISTRY: ${{ env.REGISTRY }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|||||||
Reference in New Issue
Block a user