Added try catch block for handling aptly publisher dumps results
Change-Id: I0a9aef9049b7b6449e283105ac3823fa22f446fc
diff --git a/src/com/mirantis/mk/Aptly.groovy b/src/com/mirantis/mk/Aptly.groovy
index 90bb59a..4771084 100644
--- a/src/com/mirantis/mk/Aptly.groovy
+++ b/src/com/mirantis/mk/Aptly.groovy
@@ -141,7 +141,11 @@
*/
def dumpPublishes(server, prefix, publishes='all', opts='-d --timeout 600') {
sh("aptly-publisher dump --url ${server} --save-dir . --prefix ${prefix} -p '${publishes}' ${opts}")
- archiveArtifacts artifacts: "${prefix}*"
+ if (findFiles(glob: "${prefix}*")) {
+ archiveArtifacts artifacts: "${prefix}*"
+ } else {
+ throw new Exception("Aptly dump publishes for a prefix ${prefix}* failed. No dump files found!")
+ }
}
/**