Skip to content

Commit 3b57d79

Browse files
committed
added retrys
1 parent d6d36ce commit 3b57d79

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed

.github/workflows/chicmoz-prod.yml

+39-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,45 @@ jobs:
4141
chmod +x ".github/workflows/cleanup-script.sh"
4242
bash -x ".github/workflows/cleanup-script.sh"
4343
44+
- name: Build and Push Images
45+
run: |
46+
MAX_RETRIES=3
47+
RETRY_DELAY=10
48+
49+
build_and_push() {
50+
for i in $(seq 1 $MAX_RETRIES); do
51+
if skaffold build --filename "k8s/production/skaffold.production.yaml"; then
52+
return 0
53+
fi
54+
echo "Attempt $i failed. Retrying in $RETRY_DELAY seconds..."
55+
sleep $RETRY_DELAY
56+
done
57+
return 1
58+
}
59+
60+
if build_and_push; then
61+
echo "Build and push successful"
62+
else
63+
echo "Build and push failed after $MAX_RETRIES attempts"
64+
exit 1
65+
fi
66+
4467
- name: Save DigitalOcean kubeconfig
45-
run: doctl kubernetes cluster kubeconfig save chicmoz-prod
68+
run: doctl kubernetes cluster kubeconfig save "chicmoz-prod"
4669

4770
- name: Deploy to cluster with Skaffold
48-
run: skaffold run --filename k8s/production/skaffold.production.yaml
71+
run: |
72+
MAX_RETRIES=3
73+
RETRY_DELAY=10
74+
75+
for i in $(seq 1 $MAX_RETRIES); do
76+
if skaffold run --filename "k8s/production/skaffold.production.yaml"; then
77+
echo "Deployment successful"
78+
exit 0
79+
fi
80+
echo "Attempt $i failed. Retrying in $RETRY_DELAY seconds..."
81+
sleep $RETRY_DELAY
82+
done
83+
84+
echo "Deployment failed after $MAX_RETRIES attempts"
85+
exit 1

0 commit comments

Comments
 (0)