This repository was archived by the owner on Mar 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·42 lines (36 loc) · 1.47 KB
/
deploy.sh
File metadata and controls
executable file
·42 lines (36 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
set -euo pipefail
# Build the web-demo image from the repo root so all packages are included.
docker build --no-cache -f apps/web-demo/Dockerfile -t waltid/digital-credentials .
# Push the freshly built image.
docker push waltid/digital-credentials
# Bounce the pod to pick up the new image (k8s will recreate it).
current_pod=$(kubectl get pods --no-headers -n demo-portal | awk '/waltid-digital-credentials/ {print $1; exit 0}')
if [ -n "${current_pod}" ]; then
echo "Deleting current pod: ${current_pod}"
kubectl delete pod "${current_pod}" -n demo-portal
else
echo "No existing waltid-digital-credentials pod found; continuing."
fi
echo "Waiting for new waltid-digital-credentials pod to become ready..."
new_pod=""
for i in {1..60}; do
new_pod=$(kubectl get pods --no-headers -n demo-portal | awk '/waltid-digital-credentials/ {print $1; exit 0}')
if [ -n "${new_pod}" ]; then
# Ensure it's ready before proceeding.
if kubectl get pod "${new_pod}" -n demo-portal 2>/dev/null | awk 'NR==2 {print $2}' | grep -q '^1/1$'; then
status=$(kubectl get pod "${new_pod}" -n demo-portal -o jsonpath='{.status.phase}')
if [ "${status}" = "Running" ]; then
echo "Pod ${new_pod} is Running and Ready."
break
fi
fi
fi
sleep 2
done
if [ -z "${new_pod}" ]; then
echo "Failed to find new waltid-digital-credentials pod after waiting."
exit 1
fi
echo "Following logs for pod: ${new_pod}"
kubectl logs -f "${new_pod}" -n demo-portal