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 | } |
| 25 | |
Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 26 | node() { |
| 27 | try{ |
| 28 | stage("promote") { |
| 29 | lock("aptly-api") { |
chnyda | 5626fc9 | 2017-11-28 17:34:06 +0100 | [diff] [blame^] | 30 | for (storage in storages) { |
| 31 | aptly.promotePublish(APTLY_URL, SOURCE, TARGET, RECREATE, components, packages, DIFF_ONLY, '-d --timeout 600', DUMP_PUBLISH.toBoolean(), storage) |
| 32 | } |
Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 33 | } |
| 34 | } |
| 35 | } catch (Throwable e) { |
| 36 | // If there was an error or exception thrown, the build failed |
| 37 | currentBuild.result = "FAILURE" |
Jakub Josef | d2efd7d | 2017-08-22 17:49:57 +0200 | [diff] [blame] | 38 | currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message |
Jakub Josef | c5a223a | 2017-03-01 14:40:08 +0100 | [diff] [blame] | 39 | throw e |
| 40 | } finally { |
| 41 | common.sendNotification(currentBuild.result,"",["slack"]) |
| 42 | } |
Jakub Josef | d2efd7d | 2017-08-22 17:49:57 +0200 | [diff] [blame] | 43 | } |