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:
parent
79586015f1
commit
7833bd3ecf
1 changed files with 32 additions and 0 deletions
32
.drone.yml
32
.drone.yml
|
|
@ -2,6 +2,9 @@ kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: frontend
|
name: frontend
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
limit: 1
|
limit: 1
|
||||||
|
|
||||||
|
|
@ -14,6 +17,19 @@ trigger:
|
||||||
- push
|
- push
|
||||||
|
|
||||||
steps:
|
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
|
- name: Run frontend tests
|
||||||
image: node:24-alpine
|
image: node:24-alpine
|
||||||
commands:
|
commands:
|
||||||
|
|
@ -81,6 +97,9 @@ kind: pipeline
|
||||||
type: kubernetes
|
type: kubernetes
|
||||||
name: api
|
name: api
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
limit: 1
|
limit: 1
|
||||||
|
|
||||||
|
|
@ -93,6 +112,19 @@ trigger:
|
||||||
- push
|
- push
|
||||||
|
|
||||||
steps:
|
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
|
- name: Cache test image
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue