jenkins: retry pc setup (#30659)

* retry pc setup

* sleep and retry

* exception

* throw e

* remove force exit

* make a function for it

* remove force exit

* move to top

* separate exception
old-commit-hash: 93cd19e3a5
chrysler-long2
Justin Newberry 1 year ago committed by GitHub
parent 60d5e98920
commit 758426375d
  1. 14
      Jenkinsfile

14
Jenkinsfile vendored

@ -1,3 +1,15 @@
def retryWithDelay(int maxRetries, int delay, Closure body) {
for (int i = 0; i < maxRetries; i++) {
try {
body()
return
} catch (Exception e) {
sleep(delay)
}
}
throw Exception("Failed after ${maxRetries} retries")
}
def device(String ip, String step_label, String cmd) {
withCredentials([file(credentialsId: 'id_rsa', variable: 'key_file')]) {
def ssh_cmd = """
@ -92,9 +104,11 @@ def pcStage(String stageName, Closure body) {
docker.build("openpilot-base:build-${env.GIT_COMMIT}", "-f Dockerfile.openpilot_base .").inside(dockerArgs) {
timeout(time: 20, unit: 'MINUTES') {
try {
retryWithDelay (3, 15) {
sh "git config --global --add safe.directory '*'"
sh "git submodule update --init --recursive"
sh "git lfs pull"
}
body()
} finally {
sh "rm -rf ${env.WORKSPACE}/* || true"

Loading…
Cancel
Save