Skip to content

Commit dc8a2bd

Browse files
committed
Mitigate #2387: Improve cloning logic
- Clone submodules in parallel - Improve workaround to #3415. Don't rely on GitHub to perform the merge on PRs
1 parent b067da1 commit dc8a2bd

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

.drone.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# We override the default clone step to workaround a bug with GitHub (see #3415)
21
clone:
2+
git:
3+
image: plugins/git
4+
recursive: false
5+
6+
pipeline:
7+
# We add a custom clone step to workaround a bug with GitHub (see #3415)
8+
# and speed up cloning submodules
39
clone:
410
image: plugins/git
511
commands:
6-
- sleep 5s
7-
- git init
8-
- git remote add origin $DRONE_REMOTE_URL
9-
- git fetch --no-tags origin $DRONE_COMMIT_REF
10-
- if [ $DRONE_BUILD_EVENT = "push" ]; then git reset --hard -q $DRONE_COMMIT_SHA; else git checkout -qf FETCH_HEAD; fi
11-
- git submodule update --init --recursive
12+
- ./project/scripts/ci-clone
1213

13-
pipeline:
1414
# TESTS:
1515
# We run tests in parallel. Tests run in a copy of the working directory to avoid conflict
1616
test_legacy:

project/scripts/ci-clone

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env sh
2+
set -eux
3+
4+
# if build is PR rebase on top of target branch
5+
if [ "$DRONE_BUILD_EVENT" = "pull_request" ]; then
6+
git config user.email "[email protected]"
7+
git config user.name "Allan Renucci"
8+
git pull --rebase "$DRONE_REMOTE_URL" "$DRONE_BRANCH"
9+
fi
10+
11+
# clone submodules in parallel
12+
git submodule update --init --recursive --jobs 3

0 commit comments

Comments
 (0)