Aptly: fix dump of publish with regexp
Change-Id: I6df2edd79ac1217ede60a5bc7e0dcb19a0bdd8a3
diff --git a/src/com/mirantis/mk/Aptly.groovy b/src/com/mirantis/mk/Aptly.groovy
index b1b0a2a..4fb655c 100644
--- a/src/com/mirantis/mk/Aptly.groovy
+++ b/src/com/mirantis/mk/Aptly.groovy
@@ -94,8 +94,17 @@
if (dump_publish) {
def now = new Date();
+ dumpTarget = target
def timestamp = now.format("yyyyMMddHHmmss", TimeZone.getTimeZone('UTC'));
- dumpPublishes(server, timestamp, target)
+
+ if (target.contains(')') || target.contains('*')) {
+ sourceTarget = source.split('/')
+ dumpTarget = target.split('/')[-1]
+ sourceTarget[-1] = dumpTarget
+ dumpTarget = sourceTarget.join('/')
+ }
+
+ dumpPublishes(server, timestamp, dumpTarget)
}
sh("aptly-publisher --url ${server} promote --source '${source}' --target '${target}' --force-overwrite ${opts}")
@@ -125,7 +134,7 @@
* @param opts Options: debug, timeout, ...
*/
def dumpPublishes(server, prefix, publishes='all', opts='-d --timeout 600') {
- sh("aptly-publisher dump --url ${server} --save-dir . --prefix ${prefix} -p ${publishes} ${opts}")
+ sh("aptly-publisher dump --url ${server} --save-dir . --prefix ${prefix} -p '${publishes}' ${opts}")
archiveArtifacts artifacts: "${prefix}*"
}