template: substitute placeholders
CD / Detect unsubstituted template (push) Has been cancelled
CD / Lint / Test / Vet (push) Has been cancelled
CD / Build & Import (push) Has been cancelled
CD / Deploy via GitOps (push) Has been cancelled

This commit is contained in:
mathias
2026-07-19 08:29:47 +00:00
parent 9acb65c97b
commit 3bf8e6a39f
+12 -12
View File
@@ -8,7 +8,7 @@ on:
branches: [main] branches: [main]
env: env:
IMAGE: __PROJECT_NAME__ IMAGE: cad-atlas
jobs: jobs:
guard: guard:
@@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- id: detect - id: detect
run: | run: |
if grep -q '__MODULE_PATH__' go.mod; then if grep -q 'git.d-ma.be/mathias/cad-atlas' go.mod; then
echo "is_template=true" >> "$GITHUB_OUTPUT" echo "is_template=true" >> "$GITHUB_OUTPUT"
else else
echo "is_template=false" >> "$GITHUB_OUTPUT" echo "is_template=false" >> "$GITHUB_OUTPUT"
@@ -98,16 +98,16 @@ jobs:
rm -rf /tmp/infra rm -rf /tmp/infra
git clone -b main ssh://git@10.0.1.20:30022/mathias/infra.git /tmp/infra git clone -b main ssh://git@10.0.1.20:30022/mathias/infra.git /tmp/infra
cd /tmp/infra cd /tmp/infra
DEPLOYMENT="k3s/apps/__PROJECT_NAME__/deployment.yaml" DEPLOYMENT="k3s/apps/cad-atlas/deployment.yaml"
sed -i "s|image: localhost:5000/__PROJECT_NAME__:.*|image: localhost:5000/__PROJECT_NAME__:${IMAGE_TAG}|" "$DEPLOYMENT" sed -i "s|image: localhost:5000/cad-atlas:.*|image: localhost:5000/cad-atlas:${IMAGE_TAG}|" "$DEPLOYMENT"
grep -q "localhost:5000/__PROJECT_NAME__:${IMAGE_TAG}" "$DEPLOYMENT" \ grep -q "localhost:5000/cad-atlas:${IMAGE_TAG}" "$DEPLOYMENT" \
|| { echo "✗ image tag patch failed"; exit 1; } || { echo "✗ image tag patch failed"; exit 1; }
if git diff --quiet "$DEPLOYMENT"; then if git diff --quiet "$DEPLOYMENT"; then
echo " image tag unchanged — skipping push" echo " image tag unchanged — skipping push"
else else
git -c user.name="__PROJECT_NAME__ CI" \ git -c user.name="cad-atlas CI" \
-c user.email="ci@__PROJECT_NAME__.local" \ -c user.email="ci@cad-atlas.local" \
commit -m "chore(deploy): __PROJECT_NAME__ → ${IMAGE_TAG}" "$DEPLOYMENT" commit -m "chore(deploy): cad-atlas → ${IMAGE_TAG}" "$DEPLOYMENT"
git push origin main git push origin main
echo "✓ pushed to infra repo" echo "✓ pushed to infra repo"
fi fi
@@ -122,11 +122,11 @@ jobs:
- name: Verify rollout - name: Verify rollout
run: | run: |
kubectl rollout status deployment/__PROJECT_NAME__ \ kubectl rollout status deployment/cad-atlas \
--namespace __PROJECT_NAME__ \ --namespace cad-atlas \
--timeout=120s \ --timeout=120s \
|| { || {
kubectl get pods -n __PROJECT_NAME__ -o wide kubectl get pods -n cad-atlas -o wide
kubectl get events -n __PROJECT_NAME__ --sort-by='.lastTimestamp' | tail -20 kubectl get events -n cad-atlas --sort-by='.lastTimestamp' | tail -20
exit 1 exit 1
} }