Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 1 | def common = new com.mirantis.mk.Common() |
| 2 | def aptly = new com.mirantis.mk.Aptly() |
chnyda | 6a3553e | 2017-03-21 13:20:15 +0100 | [diff] [blame] | 3 | |
| 4 | |
| 5 | def packages |
| 6 | try { |
| 7 | packages = PACKAGES |
| 8 | } catch (MissingPropertyException e) { |
| 9 | packages = "" |
| 10 | } |
| 11 | |
| 12 | def components |
| 13 | try { |
| 14 | components = COMPONENTS |
| 15 | } catch (MissingPropertyException e) { |
| 16 | components = "" |
| 17 | } |
| 18 | |
chnyda | 5626fc9 | 2017-11-28 17:34:06 +0100 | [diff] [blame] | 19 | def storages |
| 20 | try { |
| 21 | storages = STORAGES.tokenize(',') |
| 22 | } catch (MissingPropertyException e) { |
| 23 | storages = ['local'] |
| 24 | } |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 25 | timeout(time: 12, unit: 'HOURS') { |
| 26 | node() { |
| 27 | try{ |
| 28 | stage("promote") { |
| 29 | lock("aptly-api") { |
| 30 | for (storage in storages) { |
chnyda | 5626fc9 | 2017-11-28 17:34:06 +0100 | [diff] [blame] | 31 | |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 32 | 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) |
chnyda | 9e82e99 | 2017-12-04 15:01:54 +0100 | [diff] [blame] | 36 | } |
chnyda | 5626fc9 | 2017-11-28 17:34:06 +0100 | [diff] [blame] | 37 | } |
Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 38 | } |
Jakub Josef | a63f986 | 2018-01-11 17:58:38 +0100 | [diff] [blame] | 39 | } 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"]) |
azvyagintsev | 1e5a967 | 2018-01-15 16:21:44 +0200 | [diff] [blame^] | 46 | def _extra_descr = "${SOURCE}=>${TARGET}:\n${COMPONENTS} ${packages}" |
| 47 | currentBuild.description = currentBuild.description ? _extra_descr + " " + currentBuild.description : _extra_descr |
Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 48 | } |
Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 49 | } |
azvyagintsev | 1e5a967 | 2018-01-15 16:21:44 +0200 | [diff] [blame^] | 50 | } |