blob: 31390b019c4c183b6fa7bef1ecb955caaac28507 [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}
Jakub Josefa63f9862018-01-11 17:58:38 +010025timeout(time: 12, unit: 'HOURS') {
26 node() {
27 try{
28 stage("promote") {
29 lock("aptly-api") {
30 for (storage in storages) {
chnyda5626fc92017-11-28 17:34:06 +010031
Jakub Josefa63f9862018-01-11 17:58:38 +010032 if (storage == "local") {
33 storage = ""
34 }
35 aptly.promotePublish(APTLY_URL, SOURCE, TARGET, RECREATE, components, packages, DIFF_ONLY, '-d --timeout 600', DUMP_PUBLISH.toBoolean(), storage)
chnyda9e82e992017-12-04 15:01:54 +010036 }
chnyda5626fc92017-11-28 17:34:06 +010037 }
Jakub Josefc5a223a2017-03-01 14:40:08 +010038 }
Jakub Josefa63f9862018-01-11 17:58:38 +010039 } catch (Throwable e) {
40 // If there was an error or exception thrown, the build failed
41 currentBuild.result = "FAILURE"
42 currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
43 throw e
44 } finally {
45 common.sendNotification(currentBuild.result,"",["slack"])
azvyagintsev1e5a9672018-01-15 16:21:44 +020046 def _extra_descr = "${SOURCE}=>${TARGET}:\n${COMPONENTS} ${packages}"
47 currentBuild.description = currentBuild.description ? _extra_descr + " " + currentBuild.description : _extra_descr
Jakub Josefc5a223a2017-03-01 14:40:08 +010048 }
Jakub Josefc5a223a2017-03-01 14:40:08 +010049 }
azvyagintsev1e5a9672018-01-15 16:21:44 +020050}