You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ar...@apache.org on 2022/08/04 22:29:04 UTC
[tvm] branch main updated: [ci][docker] Add retries for docker pull (#12306)
This is an automated email from the ASF dual-hosted git repository.
areusch pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new 485bfaf1ea [ci][docker] Add retries for docker pull (#12306)
485bfaf1ea is described below
commit 485bfaf1ea9d7afaf7fa6cb3e03415364ffc4412
Author: driazati <94...@users.noreply.github.com>
AuthorDate: Thu Aug 4 15:28:58 2022 -0700
[ci][docker] Add retries for docker pull (#12306)
---
Jenkinsfile | 27 +++++++++++++++++++++++++--
ci/jenkins/Prepare.groovy.j2 | 6 +++++-
2 files changed, 30 insertions(+), 3 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 74cf3c08b4..ec642d60ef 100755
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -45,7 +45,7 @@
// 'python3 jenkins/generate.py'
// Note: This timestamp is here to ensure that updates to the Jenkinsfile are
// always rebased on main before merging:
-// Generated at 2022-08-02T21:01:38.958652
+// Generated at 2022-08-04T10:10:32.335972
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
// NOTE: these lines are scanned by docker/dev_common.sh. Please update the regex as needed. -->
@@ -182,7 +182,30 @@ def docker_init(image) {
ecr_pull(image)
} else {
sh(
- script: "docker pull ${image}",
+ script: """
+ set -eux
+ retry() {
+ local retries=\$1
+ shift
+
+ local count=0
+ until "\$@"; do
+ exit=\$?
+ wait=\$((2 ** \$count))
+ count=\$((\$count + 1))
+ if [ \$count -lt \$retries ]; then
+ echo "Retry \$count/\$retries exited \$exit, retrying in \$wait seconds..."
+ sleep \$wait
+ else
+ echo "Retry \$count/\$retries exited \$exit, no more retries left."
+ return \$exit
+ fi
+ done
+ return 0
+}
+
+ retry 3 docker pull ${image}
+ """,
label: 'Pull docker image',
)
}
diff --git a/ci/jenkins/Prepare.groovy.j2 b/ci/jenkins/Prepare.groovy.j2
index 981ff264ca..8504c0dfb3 100644
--- a/ci/jenkins/Prepare.groovy.j2
+++ b/ci/jenkins/Prepare.groovy.j2
@@ -76,7 +76,11 @@ def docker_init(image) {
ecr_pull(image)
} else {
sh(
- script: "docker pull ${image}",
+ script: """
+ set -eux
+ {{ m.bash_retry() }}
+ retry 3 docker pull ${image}
+ """,
label: 'Pull docker image',
)
}