Add retry logic to Drone CI clone step for transient DNS failures

Disable the default clone and use a custom clone step with up to 5
retry attempts in both frontend and api pipelines. This prevents
builds from failing due to transient "Could not resolve host" errors.
This commit is contained in:
Viktor Barzin 2026-02-15 17:24:56 +00:00
parent 79586015f1
commit 7833bd3ecf
No known key found for this signature in database
GPG key ID: 0EB088298288D958

View file

@ -2,6 +2,9 @@ kind: pipeline
type: kubernetes
name: frontend
clone:
disable: true
concurrency:
limit: 1
@ -14,6 +17,19 @@ trigger:
- push
steps:
- name: clone
image: alpine/git
commands:
- |
for i in 1 2 3 4 5; do
git clone --depth=50 "$DRONE_REMOTE_URL" . && exit 0
echo "Clone attempt $i failed, retrying in 5s..."
sleep 5
done
echo "Clone failed after 5 attempts"
exit 1
- git checkout "$DRONE_COMMIT"
- name: Run frontend tests
image: node:24-alpine
commands:
@ -81,6 +97,9 @@ kind: pipeline
type: kubernetes
name: api
clone:
disable: true
concurrency:
limit: 1
@ -93,6 +112,19 @@ trigger:
- push
steps:
- name: clone
image: alpine/git
commands:
- |
for i in 1 2 3 4 5; do
git clone --depth=50 "$DRONE_REMOTE_URL" . && exit 0
echo "Clone attempt $i failed, retrying in 5s..."
sleep 5
done
echo "Clone failed after 5 attempts"
exit 1
- git checkout "$DRONE_COMMIT"
- name: Cache test image
image: plugins/docker
settings: