generated from mathias/template-go-web
template: substitute placeholders
This commit is contained in:
+11
-11
@@ -8,7 +8,7 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
IMAGE: __PROJECT_NAME__
|
IMAGE: spatial-agent-app
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
guard:
|
guard:
|
||||||
@@ -137,16 +137,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/spatial-agent-app/deployment.yaml"
|
||||||
sed -i "s|image: localhost:5000/__PROJECT_NAME__:.*|image: localhost:5000/__PROJECT_NAME__:${IMAGE_TAG}|" "$DEPLOYMENT"
|
sed -i "s|image: localhost:5000/spatial-agent-app:.*|image: localhost:5000/spatial-agent-app:${IMAGE_TAG}|" "$DEPLOYMENT"
|
||||||
grep -q "localhost:5000/__PROJECT_NAME__:${IMAGE_TAG}" "$DEPLOYMENT" \
|
grep -q "localhost:5000/spatial-agent-app:${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="spatial-agent-app CI" \
|
||||||
-c user.email="ci@__PROJECT_NAME__.local" \
|
-c user.email="ci@spatial-agent-app.local" \
|
||||||
commit -m "chore(deploy): __PROJECT_NAME__ → ${IMAGE_TAG}" "$DEPLOYMENT"
|
commit -m "chore(deploy): spatial-agent-app → ${IMAGE_TAG}" "$DEPLOYMENT"
|
||||||
git push origin main
|
git push origin main
|
||||||
echo "✓ pushed to infra repo"
|
echo "✓ pushed to infra repo"
|
||||||
fi
|
fi
|
||||||
@@ -161,11 +161,11 @@ jobs:
|
|||||||
|
|
||||||
- name: Verify rollout
|
- name: Verify rollout
|
||||||
run: |
|
run: |
|
||||||
kubectl rollout status deployment/__PROJECT_NAME__ \
|
kubectl rollout status deployment/spatial-agent-app \
|
||||||
--namespace __PROJECT_NAME__ \
|
--namespace spatial-agent-app \
|
||||||
--timeout=120s \
|
--timeout=120s \
|
||||||
|| {
|
|| {
|
||||||
kubectl get pods -n __PROJECT_NAME__ -o wide
|
kubectl get pods -n spatial-agent-app -o wide
|
||||||
kubectl get events -n __PROJECT_NAME__ --sort-by='.lastTimestamp' | tail -20
|
kubectl get events -n spatial-agent-app --sort-by='.lastTimestamp' | tail -20
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user