You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bn...@apache.org on 2021/10/25 15:40:45 UTC

[trafficserver-ci] branch main updated: simplify git checkout retriesd

This is an automated email from the ASF dual-hosted git repository.

bnolsen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/trafficserver-ci.git


The following commit(s) were added to refs/heads/main by this push:
     new f4eeedf  simplify git checkout retriesd
     new ec08958  Merge pull request #63 from traeak/refactor_checkout_retries
f4eeedf is described below

commit f4eeedf584e7f9e30b7974bd971680d7e16433b6
Author: Brian Olsen <br...@comcast.com>
AuthorDate: Mon Oct 25 15:14:08 2021 +0000

    simplify git checkout retriesd
---
 jenkins/branch/autest.pipeline         | 11 ++---------
 jenkins/branch/cache-tests.pipeline    | 11 ++---------
 jenkins/branch/clang_analyzer.pipeline | 17 +++++------------
 jenkins/branch/clang_format.pipeline   | 11 ++---------
 jenkins/branch/coverage.pipeline       | 12 +++---------
 jenkins/branch/in_tree.pipeline        | 18 ++++++------------
 jenkins/branch/os_build.pipeline       | 11 ++---------
 jenkins/branch/out_of_tree.pipeline    | 18 ++++++------------
 jenkins/branch/rat.pipeline            | 14 ++++----------
 9 files changed, 32 insertions(+), 91 deletions(-)

diff --git a/jenkins/branch/autest.pipeline b/jenkins/branch/autest.pipeline
index 860d939..f67bd7a 100644
--- a/jenkins/branch/autest.pipeline
+++ b/jenkins/branch/autest.pipeline
@@ -36,15 +36,8 @@ pipeline {
 							branch = '*/' + env.GITHUB_BRANCH
 						}
 
-						try {
-							checkout([$class: 'GitSCM',
-								branches: [[name: branch]],
-								userRemoteConfigs: [[url: env.GITHUB_URL]],
-								extensions: [[$class: 'CloneOption', timeout: 10]]
-							])
-						} catch (error) {
-							echo "Clone failed, retry"
-							retry(2) {
+            timeout(time: 1, unit: 'MINUTES') {
+							retry(3) {
 								checkout([$class: 'GitSCM',
 									branches: [[name: branch]],
 									userRemoteConfigs: [[url: env.GITHUB_URL]],
diff --git a/jenkins/branch/cache-tests.pipeline b/jenkins/branch/cache-tests.pipeline
index b13fe4e..3b0554c 100644
--- a/jenkins/branch/cache-tests.pipeline
+++ b/jenkins/branch/cache-tests.pipeline
@@ -36,15 +36,8 @@ pipeline {
 							branch = '*/' + env.GITHUB_BRANCH
 						}
 
-						try {
-							checkout([$class: 'GitSCM',
-								branches: [[name: branch]],
-								userRemoteConfigs: [[url: env.GITHUB_URL]],
-								extensions: [[$class: 'CloneOption', timeout: 10]]
-							])
-						} catch (error) {
-							echo "Clone failed, retry"
-							retry(2) {
+            timeout(time: 1, unit: 'MINUTES') {
+							retry(3) {
 								checkout([$class: 'GitSCM',
 									branches: [[name: branch]],
 									userRemoteConfigs: [[url: env.GITHUB_URL]],
diff --git a/jenkins/branch/clang_analyzer.pipeline b/jenkins/branch/clang_analyzer.pipeline
index 49dc5fa..f80a257 100644
--- a/jenkins/branch/clang_analyzer.pipeline
+++ b/jenkins/branch/clang_analyzer.pipeline
@@ -5,8 +5,8 @@ pipeline {
 			image 'controller.trafficserver.org/ats/ubuntu:20.04'
 			args '-v /home/jenkins/clang-analyzer:/tmp/clang-analyzer:rw --network=host'
 			label 'branch'
-		}			
-	}			
+		}
+	}
 
 	stages {
 		stage('Initialization') {
@@ -33,7 +33,7 @@ pipeline {
 				dir('ci') {
 					git url: 'https://github.com/apache/trafficserver-ci',
 						branch: 'main'
-				}		
+				}
 				dir('src') {
 					script {
 						String branch = env.SHA1
@@ -41,15 +41,8 @@ pipeline {
 							branch = '*/' + env.GITHUB_BRANCH
 						}
 
-						try {
-							checkout([$class: 'GitSCM',
-								branches: [[name: branch]],
-								userRemoteConfigs: [[url: env.GITHUB_URL]],
-								extensions: [[$class: 'CloneOption', timeout: 10]]
-							])
-						} catch (error) {
-							echo "Clone failed, retry"
-							retry(2) {
+            timeout(time: 1, unit: 'MINUTES') {
+							retry(3) {
 								checkout([$class: 'GitSCM',
 									branches: [[name: branch]],
 									userRemoteConfigs: [[url: env.GITHUB_URL]],
diff --git a/jenkins/branch/clang_format.pipeline b/jenkins/branch/clang_format.pipeline
index 475173b..5c6b5a0 100644
--- a/jenkins/branch/clang_format.pipeline
+++ b/jenkins/branch/clang_format.pipeline
@@ -40,15 +40,8 @@ pipeline {
 							branch = '*/' + env.GITHUB_BRANCH
 						}
 
-						try {
-							checkout([$class: 'GitSCM',
-								branches: [[name: branch]],
-								userRemoteConfigs: [[url: env.GITHUB_URL]],
-								extensions: [[$class: 'CloneOption', timeout: 10]]
-							])
-						} catch (error) {
-							echo "Clone failed, retry"
-							retry(2) {
+            timeout(time: 1, unit: 'MINUTES') {
+							retry(3) {
 								checkout([$class: 'GitSCM',
 									branches: [[name: branch]],
 									userRemoteConfigs: [[url: env.GITHUB_URL]],
diff --git a/jenkins/branch/coverage.pipeline b/jenkins/branch/coverage.pipeline
index bc2d247..4d0deb0 100644
--- a/jenkins/branch/coverage.pipeline
+++ b/jenkins/branch/coverage.pipeline
@@ -43,15 +43,9 @@ pipeline {
 						if (! branch) {
 							branch = '*/' + env.GITHUB_BRANCH
 						}
-						try {
-							checkout([$class: 'GitSCM',
-								branches: [[name: branch]],
-								userRemoteConfigs: [[url: env.GITHUB_URL]],
-								extensions: [[$class: 'CloneOption', timeout: 10]]
-							])
-						} catch (error) {
-							echo "Clone failed, retry"
-							retry(2) {
+
+            timeout(time: 1, unit: 'MINUTES') {
+							retry(3) {
 								checkout([$class: 'GitSCM',
 									branches: [[name: branch]],
 									userRemoteConfigs: [[url: env.GITHUB_URL]],
diff --git a/jenkins/branch/in_tree.pipeline b/jenkins/branch/in_tree.pipeline
index 1a202a3..3d849a1 100644
--- a/jenkins/branch/in_tree.pipeline
+++ b/jenkins/branch/in_tree.pipeline
@@ -7,7 +7,7 @@ pipeline {
 			label 'branch'
 		}
 	}
-	
+
 	environment {
 		CCACHE_DIR = "/tmp/ccache"
 	}
@@ -31,7 +31,7 @@ pipeline {
 				}
 			}
 		}
-		
+
 		stage('Clone') {
 			steps {
 				dir('ci') {
@@ -44,15 +44,9 @@ pipeline {
 						if (! branch) {
 							branch = '*/' + env.GITHUB_BRANCH
 						}
-						try {
-							checkout([$class: 'GitSCM',
-								branches: [[name: branch]],
-								userRemoteConfigs: [[url: env.GITHUB_URL]],
-								extensions: [[$class: 'CloneOption', timeout: 10]]
-							])
-						} catch (error) {
-							echo "Clone failed, retry"
-							retry(2) {
+
+            timeout(time: 1, unit: 'MINUTES') {
+							retry(3) {
 								checkout([$class: 'GitSCM',
 									branches: [[name: branch]],
 									userRemoteConfigs: [[url: env.GITHUB_URL]],
@@ -64,7 +58,7 @@ pipeline {
 				}
 			}
 		}
-		
+
 		stage('Build') {
 			steps {
 				dir('src') {
diff --git a/jenkins/branch/os_build.pipeline b/jenkins/branch/os_build.pipeline
index 61e1bda..75d84fb 100644
--- a/jenkins/branch/os_build.pipeline
+++ b/jenkins/branch/os_build.pipeline
@@ -37,15 +37,8 @@ pipeline {
 							branch = '*/' + env.GITHUB_BRANCH
 						}
 
-						try {
-							checkout([$class: 'GitSCM',
-								branches: [[name: branch]],
-								userRemoteConfigs: [[url: env.GITHUB_URL]],
-								extensions: [[$class: 'CloneOption', timeout: 10]]
-							])
-						} catch (error) {
-							echo "Clone failed, retry"
-							retry(2) {
+            timeout(time: 1, unit: 'MINUTES') {
+							retry(3) {
 								checkout([$class: 'GitSCM',
 									branches: [[name: branch]],
 									userRemoteConfigs: [[url: env.GITHUB_URL]],
diff --git a/jenkins/branch/out_of_tree.pipeline b/jenkins/branch/out_of_tree.pipeline
index 696ead2..c1b6752 100644
--- a/jenkins/branch/out_of_tree.pipeline
+++ b/jenkins/branch/out_of_tree.pipeline
@@ -7,7 +7,7 @@ pipeline {
 			label 'branch'
 		}
 	}
-	
+
 	environment {
 		CCACHE_DIR = "/tmp/ccache"
 	}
@@ -31,7 +31,7 @@ pipeline {
 				}
 			}
 		}
-		
+
 		stage('Clone') {
 			steps {
 				dir('ci') {
@@ -44,15 +44,9 @@ pipeline {
 						if (! branch) {
 							branch = '*/' + env.GITHUB_BRANCH
 						}
-						try {
-							checkout([$class: 'GitSCM',
-								branches: [[name: branch]],
-								userRemoteConfigs: [[url: env.GITHUB_URL]],
-								extensions: [[$class: 'CloneOption', timeout: 10]]
-							])
-						} catch (error) {
-							echo "Clone failed, retry"
-							retry(2) {
+
+            timeout(time: 1, unit: 'MINUTES') {
+							retry(3) {
 								checkout([$class: 'GitSCM',
 									branches: [[name: branch]],
 									userRemoteConfigs: [[url: env.GITHUB_URL]],
@@ -64,7 +58,7 @@ pipeline {
 				}
 			}
 		}
-		
+
 		stage('Build') {
 			steps {
 				dir('src') {
diff --git a/jenkins/branch/rat.pipeline b/jenkins/branch/rat.pipeline
index 20586cd..f9819f1 100644
--- a/jenkins/branch/rat.pipeline
+++ b/jenkins/branch/rat.pipeline
@@ -41,15 +41,9 @@ pipeline {
 						if (! branch) {
 							branch = '*/' + env.GITHUB_BRANCH
 						}
-						try {
-							checkout([$class: 'GitSCM',
-								branches: [[name: branch]],
-								userRemoteConfigs: [[url: env.GITHUB_URL]],
-								extensions: [[$class: 'CloneOption', timeout: 10]]
-							])
-						} catch (error) {
-							echo "Clone failed, retry"
-							retry(2) {
+
+            timeout(time: 1, unit: 'MINUTES') {
+							retry(3) {
 								checkout([$class: 'GitSCM',
 									branches: [[name: branch]],
 									userRemoteConfigs: [[url: env.GITHUB_URL]],
@@ -73,7 +67,7 @@ pipeline {
 			}
 		}
 	}
-	
+
 	post {
 		cleanup {
 			cleanWs()