Added retry step to aptly publishing during pkg build

Change-Id: Ie9521f39aab5f43af9513944c420f303ca91825e
diff --git a/aptly-promote-pipeline.groovy b/aptly-promote-pipeline.groovy
index 08ca507..dfddfcd 100644
--- a/aptly-promote-pipeline.groovy
+++ b/aptly-promote-pipeline.groovy
@@ -36,7 +36,9 @@
               if (storage == "local") {
                 storage = ""
               }
-              aptly.promotePublish(APTLY_URL, SOURCE, TARGET, RECREATE, components, packages, DIFF_ONLY, '-d --timeout 600', DUMP_PUBLISH.toBoolean(), storage)
+              retry(2){
+                aptly.promotePublish(APTLY_URL, SOURCE, TARGET, RECREATE, components, packages, DIFF_ONLY, '-d --timeout 600', DUMP_PUBLISH.toBoolean(), storage)
+              }
             }
           }
         }else{
diff --git a/build-debian-packages-influxdb-relay.groovy b/build-debian-packages-influxdb-relay.groovy
index 3a9bc03..14b1190 100644
--- a/build-debian-packages-influxdb-relay.groovy
+++ b/build-debian-packages-influxdb-relay.groovy
@@ -79,7 +79,9 @@
                         }
                         stage("publish") {
                             aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
-                            aptly.publish(APTLY_URL)
+                            retry(2){
+                              aptly.publish(APTLY_URL)
+                            }
                         }
                     }
                 }
diff --git a/build-debian-packages-jmx-exporter.groovy b/build-debian-packages-jmx-exporter.groovy
index d6e7fbd..eaa9f05 100644
--- a/build-debian-packages-jmx-exporter.groovy
+++ b/build-debian-packages-jmx-exporter.groovy
@@ -58,7 +58,9 @@
 
                 stage("publish") {
                     aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
-                    aptly.publish(APTLY_URL)
+                    retry(2){
+                      aptly.publish(APTLY_URL)
+                    }
                 }
             }
 
diff --git a/build-debian-packages-libvirt-exporter.groovy b/build-debian-packages-libvirt-exporter.groovy
index 2051504..4c3f732 100644
--- a/build-debian-packages-libvirt-exporter.groovy
+++ b/build-debian-packages-libvirt-exporter.groovy
@@ -60,7 +60,9 @@
                     }
                     stage("publish") {
                         aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
-                        aptly.publish(APTLY_URL)
+                        retry(2){
+                          aptly.publish(APTLY_URL)
+                        }
                     }
                 }
             }
diff --git a/build-debian-packages-pipeline.groovy b/build-debian-packages-pipeline.groovy
index 8d46e8e..5d16339 100644
--- a/build-debian-packages-pipeline.groovy
+++ b/build-debian-packages-pipeline.groovy
@@ -135,7 +135,9 @@
 
           stage("publish") {
             aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
-            aptly.publish(APTLY_URL)
+            retry(2){
+              aptly.publish(APTLY_URL)
+            }
           }
         }
       }
diff --git a/build-debian-packages-prometheus-relay.groovy b/build-debian-packages-prometheus-relay.groovy
index 45e5b10..f101f57 100644
--- a/build-debian-packages-prometheus-relay.groovy
+++ b/build-debian-packages-prometheus-relay.groovy
@@ -79,7 +79,9 @@
                         }
                         stage("publish") {
                             aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
-                            aptly.publish(APTLY_URL)
+                            retry(2){
+                              aptly.publish(APTLY_URL)
+                            }
                         }
 
                         stage("rebuild docker images") {
diff --git a/build-debian-packages-telegraf.groovy b/build-debian-packages-telegraf.groovy
index 16d6259..b48c4fa 100644
--- a/build-debian-packages-telegraf.groovy
+++ b/build-debian-packages-telegraf.groovy
@@ -78,7 +78,9 @@
                         }
                         stage("publish") {
                             aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
-                            aptly.publish(APTLY_URL)
+                            retry(2){
+                              aptly.publish(APTLY_URL)
+                            }
                         }
 
                         stage("rebuild docker images") {
diff --git a/build-extra-dpdk-pipeline.groovy b/build-extra-dpdk-pipeline.groovy
index 4d096ae..e9ac981 100644
--- a/build-extra-dpdk-pipeline.groovy
+++ b/build-extra-dpdk-pipeline.groovy
@@ -53,7 +53,9 @@
         }
         stage("publish") {
             aptly.snapshotRepo(APTLY_URL, APTLY_REPO, timestamp)
-            aptly.publish(APTLY_URL)
+            retry(2){
+              aptly.publish(APTLY_URL)
+            }
         }
        }
        } catch (Throwable e) {