Added 12h timeout to all pipelines
Change-Id: I085fcbda322d0877d5ffebd002fc109577788c29
diff --git a/docker-mirror-images.groovy b/docker-mirror-images.groovy
index 8f0373c..08ac439 100644
--- a/docker-mirror-images.groovy
+++ b/docker-mirror-images.groovy
@@ -25,30 +25,31 @@
throw new IllegalArgumentException("Wrong format of image name.")
}
}
-
-node("docker") {
- try {
- stage("Mirror Docker Images"){
- def creds = common.getPasswordCredentials(TARGET_REGISTRY_CREDENTIALS_ID)
- sh "docker login --username=${creds.username} --password=${creds.password.toString()} ${REGISTRY_URL}"
- def images = IMAGE_LIST.tokenize('\n')
- def imageName, imagePath, targetRegistry, imageArray
- for (image in images){
- if(image.trim().indexOf(' ') == -1){
- throw new IllegalArgumentException("Wrong format of image and target repository input")
+timeout(time: 12, unit: 'HOURS') {
+ node("docker") {
+ try {
+ stage("Mirror Docker Images"){
+ def creds = common.getPasswordCredentials(TARGET_REGISTRY_CREDENTIALS_ID)
+ sh "docker login --username=${creds.username} --password=${creds.password.toString()} ${REGISTRY_URL}"
+ def images = IMAGE_LIST.tokenize('\n')
+ def imageName, imagePath, targetRegistry, imageArray
+ for (image in images){
+ if(image.trim().indexOf(' ') == -1){
+ throw new IllegalArgumentException("Wrong format of image and target repository input")
+ }
+ imageArray = image.trim().tokenize(' ')
+ imagePath = imageArray[0]
+ targetRegistry = imageArray[1]
+ imageName = getImageName(imagePath)
+ sh """docker pull ${imagePath}
+ docker tag ${imagePath} ${targetRegistry}/${imageName}:${IMAGE_TAG}
+ docker push ${targetRegistry}/${imageName}:${IMAGE_TAG}"""
}
- imageArray = image.trim().tokenize(' ')
- imagePath = imageArray[0]
- targetRegistry = imageArray[1]
- imageName = getImageName(imagePath)
- sh """docker pull ${imagePath}
- docker tag ${imagePath} ${targetRegistry}/${imageName}:${IMAGE_TAG}
- docker push ${targetRegistry}/${imageName}:${IMAGE_TAG}"""
}
+ } catch (Throwable e) {
+ // If there was an error or exception thrown, the build failed
+ currentBuild.result = "FAILURE"
+ throw e
}
- } catch (Throwable e) {
- // If there was an error or exception thrown, the build failed
- currentBuild.result = "FAILURE"
- throw e
}
}
\ No newline at end of file