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
|
||||
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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue