blob: 99a07e12224fecbfaf82b656eea85493fe1759bc [file] [log] [blame]
Jakub Josefc5a223a2017-03-01 14:40:08 +01001def common = new com.mirantis.mk.Common()
2def aptly = new com.mirantis.mk.Aptly()
chnyda6a3553e2017-03-21 13:20:15 +01003
4
5def packages
6try {
7 packages = PACKAGES
8} catch (MissingPropertyException e) {
9 packages = ""
10}
11
12def components
13try {
14 components = COMPONENTS
15} catch (MissingPropertyException e) {
16 components = ""
17}
18
chnyda5626fc92017-11-28 17:34:06 +010019def storages
20try {
21 storages = STORAGES.tokenize(',')
22} catch (MissingPropertyException e) {
23 storages = ['local']
24}
25
Jakub Josefc5a223a2017-03-01 14:40:08 +010026node() {
27 try{
28 stage("promote") {
29 lock("aptly-api") {
chnyda5626fc92017-11-28 17:34:06 +010030 for (storage in storages) {
chnyda9e82e992017-12-04 15:01:54 +010031
32 if (storage == "local") {
33 storage = ""
34 }
35
chnyda5626fc92017-11-28 17:34:06 +010036 aptly.promotePublish(APTLY_URL, SOURCE, TARGET, RECREATE, components, packages, DIFF_ONLY, '-d --timeout 600', DUMP_PUBLISH.toBoolean(), storage)
37 }
Jakub Josefc5a223a2017-03-01 14:40:08 +010038 }
39 }
40 } catch (Throwable e) {
41 // If there was an error or exception thrown, the build failed
42 currentBuild.result = "FAILURE"
Jakub Josefd2efd7d2017-08-22 17:49:57 +020043 currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
Jakub Josefc5a223a2017-03-01 14:40:08 +010044 throw e
45 } finally {
46 common.sendNotification(currentBuild.result,"",["slack"])
47 }
Jakub Josefd2efd7d2017-08-22 17:49:57 +020048}