vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 1 | package com.mirantis.mk |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 2 | |
| 3 | /** |
| 4 | * |
| 5 | * KaaS Component Testing Utilities |
| 6 | * |
| 7 | */ |
| 8 | |
Владислав Наумов | e534581 | 2020-08-12 16:30:20 +0200 | [diff] [blame] | 9 | /** |
| 10 | * Check KaaS Core CICD feature flags |
| 11 | * such triggers can be used in case of switching between pipelines, |
| 12 | * conditions inside pipelines to reduce dependency on jenkins job builder and jenkins job templates itself |
| 13 | * |
| 14 | * @return (map)[ |
| 15 | * ffNameEnabled: (bool) True/False |
| 16 | * ] |
| 17 | */ |
| 18 | def checkCoreCIFeatureFlags() { |
| 19 | def common = new com.mirantis.mk.Common() |
| 20 | def ff = [ |
| 21 | build_artifacts_upgrade: false, |
| 22 | ] |
| 23 | |
| 24 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| 25 | if (commitMsg ==~ /(?s).*\[ci-build-artifacts-upgrade\].*/) { |
| 26 | ff['build_artifacts_upgrade'] = true |
| 27 | } |
| 28 | |
| 29 | common.infoMsg("Core ci feature flags status: ${ff}") |
| 30 | return ff |
| 31 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 32 | |
| 33 | /** |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 34 | * Determine scope of test suite against per-commit KaaS deployment based on keywords |
Владислав Наумов | 5a523ef | 2020-07-29 13:33:38 +0200 | [diff] [blame] | 35 | * Keyword list: https://docs.google.com/document/d/1SSPD8ZdljbqmNl_FEAvTHUTow9Ki8NIMu82IcAVhzXw/ |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 36 | * |
| 37 | * Used for components team to combine test-suites and forward desired parameters to kaas/core deployment jobs |
| 38 | * Example scheme: |
Владислав Наумов | e534581 | 2020-08-12 16:30:20 +0200 | [diff] [blame] | 39 | * New CR pushed in kubernetes/lcm-ansible -> parsing it'cs commit body and combine test-suite -> trigger deployment jobs from kaas/core |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 40 | * manage test-suite through Jenkins Job Parameters |
| 41 | * |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 42 | * @return (map)[ |
| 43 | * deployChildEnabled: (bool) True if need to deploy child cluster during demo-run |
| 44 | * runUie2eEnabled: (bool) True if need to run ui-e2e cluster during demo-run |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 45 | * ] |
| 46 | */ |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 47 | def checkDeploymentTestSuite() { |
vnaumov | bdb9022 | 2020-05-04 18:25:50 +0200 | [diff] [blame] | 48 | def common = new com.mirantis.mk.Common() |
| 49 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 50 | // Available triggers and its sane defaults |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 51 | def seedMacOs = env.SEED_MACOS ? env.SEED_MACOS.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 52 | def deployChild = env.DEPLOY_CHILD_CLUSTER ? env.DEPLOY_CHILD_CLUSTER.toBoolean() : false |
| 53 | def upgradeChild = env.UPGRADE_CHILD_CLUSTER ? env.UPGRADE_CHILD_CLUSTER.toBoolean() : false |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 54 | def attachBYO = env.ATTACH_BYO ? env.ATTACH_BYO.toBoolean() : false |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 55 | def upgradeBYO = env.UPGRADE_BYO ? env.UPGRADE_BYO.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 56 | def upgradeMgmt = env.UPGRADE_MGMT_CLUSTER ? env.UPGRADE_MGMT_CLUSTER.toBoolean() : false |
| 57 | def runUie2e = env.RUN_UI_E2E ? env.RUN_UI_E2E.toBoolean() : false |
| 58 | def runMgmtConformance = env.RUN_MGMT_CFM ? env.RUN_MGMT_CFM.toBoolean() : false |
| 59 | def runChildConformance = env.RUN_CHILD_CFM ? env.RUN_CHILD_CFM.toBoolean() : false |
| 60 | def fetchServiceBinaries = env.FETCH_BINARIES_FROM_UPSTREAM ? env.FETCH_BINARIES_FROM_UPSTREAM.toBoolean() : false |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 61 | // multiregion configuration from env variable: comma-separated string in form $mgmt_provider,$regional_provider |
| 62 | def multiregionalMappings = env.MULTIREGION_SETUP ? multiregionWorkflowParser(env.MULTIREGION_SETUP) : [ |
| 63 | enabled: false, |
| 64 | managementLocation: '', |
| 65 | regionLocation: '', |
| 66 | ] |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 67 | |
| 68 | // optional demo deployment customization |
Владислав Наумов | 905dd36 | 2020-06-08 16:37:01 +0200 | [diff] [blame] | 69 | def awsOnDemandDemo = env.ALLOW_AWS_ON_DEMAND ? env.ALLOW_AWS_ON_DEMAND.toBoolean() : false |
Ivan Berezovskiy | 07e1de1 | 2020-10-09 13:07:05 +0400 | [diff] [blame] | 70 | def awsOnRhelDemo = false |
Владислав Наумов | 6ec7430 | 2020-11-05 12:38:53 +0100 | [diff] [blame] | 71 | def vsphereOnDemandDemo = env.ALLOW_VSPHERE_ON_DEMAND ? env.ALLOW_VSPHERE_ON_DEMAND.toBoolean() : false |
eromanova | df247c3 | 2020-12-25 15:44:13 +0400 | [diff] [blame] | 72 | def equinixOnAwsDemo = false |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 73 | def enableOSDemo = true |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 74 | def enableBMDemo = true |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 75 | |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 76 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 77 | if (commitMsg ==~ /(?s).*\[seed-macos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*seed-macos.*/) { |
| 78 | seedMacOs = true |
| 79 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 80 | if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ || upgradeChild || runChildConformance) { |
| 81 | deployChild = true |
| 82 | } |
| 83 | if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) { |
| 84 | deployChild = true |
| 85 | upgradeChild = true |
| 86 | } |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 87 | if (commitMsg ==~ /(?s).*\[byo-attach\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-attach.*/) { |
| 88 | attachBYO = true |
| 89 | } |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 90 | if (commitMsg ==~ /(?s).*\[byo-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-upgrade.*/) { |
| 91 | attachBYO = true |
| 92 | upgradeBYO = true |
| 93 | } |
| 94 | if (commitMsg ==~ /(?s).*\[mgmt-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-upgrade.*/ || upgradeBYO) { |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 95 | upgradeMgmt = true |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 96 | if (upgradeBYO) { |
| 97 | // TODO (vnaumov) remove such dependency right after we can verify byo upgrade w/o mgmt upgrade |
| 98 | common.warningMsg('Forced running kaas mgmt upgrade scenario, due byo demo scenario trigger: \'[byo-upgrade]\' ') |
| 99 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 100 | } |
| 101 | if (commitMsg ==~ /(?s).*\[ui-e2e\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e.*/) { |
| 102 | runUie2e = true |
| 103 | } |
| 104 | if (commitMsg ==~ /(?s).*\[mgmt-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm.*/) { |
| 105 | runMgmtConformance = true |
| 106 | } |
| 107 | if (commitMsg ==~ /(?s).*\[child-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm.*/) { |
| 108 | runChildConformance = true |
| 109 | deployChild = true |
| 110 | } |
| 111 | if (commitMsg ==~ /(?s).*\[fetch.*binaries\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*fetch.*binaries.*/) { |
| 112 | fetchServiceBinaries = true |
| 113 | } |
eromanova | df247c3 | 2020-12-25 15:44:13 +0400 | [diff] [blame] | 114 | if (commitMsg ==~ /(?s).*\[equinix-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-demo.*/) { |
| 115 | equinixOnAwsDemo = true |
| 116 | common.warningMsg('Forced running child cluster deployment on EQUINIX METAL provider based on AWS management cluster, triggered on patchset using custom keyword: \'[equinix-demo]\' ') |
| 117 | } |
| 118 | if (commitMsg ==~ /(?s).*\[aws-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aws-demo.*/ || attachBYO || upgradeBYO || seedMacOs || equinixOnAwsDemo) { |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 119 | awsOnDemandDemo = true |
eromanova | df247c3 | 2020-12-25 15:44:13 +0400 | [diff] [blame] | 120 | if (attachBYO || upgradeBYO || seedMacOs || equinixOnAwsDemo) { |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 121 | common.warningMsg('Forced running additional kaas deployment with AWS provider, due applied trigger cross dependencies, follow docs to clarify info') |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 122 | } |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 123 | } |
Ivan Berezovskiy | 07e1de1 | 2020-10-09 13:07:05 +0400 | [diff] [blame] | 124 | if (commitMsg ==~ /(?s).*\[aws-rhel-demo\].*/) { |
| 125 | awsOnDemandDemo = false |
| 126 | awsOnRhelDemo = true |
| 127 | common.warningMsg('Forced running additional kaas deployment with AWS provider on RHEL, triggered on patchset using custom keyword: \'[aws-rhel-demo]\'.' + |
| 128 | 'Upgrade scenario for Mgmt or Child cluster is not supported currently in such deployment') |
| 129 | } |
Stanislav Riazanov | 24b9c5d | 2020-10-12 22:27:12 +0400 | [diff] [blame] | 130 | if (commitMsg ==~ /(?s).*\[vsphere-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-demo.*/) { |
| 131 | vsphereOnDemandDemo = true |
| 132 | common.warningMsg('Forced running additional kaas deployment with VSPHERE provider, triggered on patchset using custom keyword: \'[vsphere-demo]\' ') |
| 133 | } |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 134 | if (commitMsg ==~ /(?s).*\[disable-os-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-os-demo\.*/) { |
| 135 | enableOSDemo = false |
| 136 | common.errorMsg('Openstack demo deployment will be aborted, VF -1 will be set') |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 137 | } |
| 138 | |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 139 | if (commitMsg ==~ /(?s).*\[disable-bm-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-demo\.*/) { |
| 140 | enableBMDemo = false |
| 141 | common.errorMsg('BM demo deployment will be aborted, VF -1 will be set') |
| 142 | } |
| 143 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 144 | // TODO (vnaumov) remove below condition after moving all releases to UCP |
| 145 | def ucpChildMatches = (commitMsg =~ /(\[child-ucp\s*ucp-.*?\])/) |
| 146 | if (ucpChildMatches.size() > 0) { |
| 147 | deployChild = true |
| 148 | common.warningMsg('Forced UCP based child deployment triggered on patchset using custom keyword: \'[child-ucp ucp-5-1-0-3-3-0-example]\' ') |
| 149 | |
| 150 | // TODO(vnaumov) delete after ucp upgrades support |
| 151 | common.errorMsg('Child upgrade test will be skipped, UCP upgrades temporally disabled') |
| 152 | upgradeChild = false |
| 153 | } |
| 154 | |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 155 | // multiregional tests |
| 156 | def multiRegionalMatches = (commitMsg =~ /(\[multiregion\s*.*?\])/) |
| 157 | if (multiRegionalMatches.size() > 0) { |
| 158 | multiregionalMappings = multiregionWorkflowParser(multiRegionalMatches) |
| 159 | } |
| 160 | switch (multiregionalMappings['managementLocation']) { |
| 161 | case 'aws': |
Владислав Наумов | 53b07e5 | 2021-01-07 15:08:27 +0100 | [diff] [blame^] | 162 | common.warningMsg('Forced running additional kaas deployment with AWS provider according multiregional demo request') |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 163 | awsOnDemandDemo = true |
Ivan Berezovskiy | 07e1de1 | 2020-10-09 13:07:05 +0400 | [diff] [blame] | 164 | if (awsOnRhelDemo) { |
| 165 | // Run only one variant: standard AWS deployment (on Ubuntu) or on RHEL |
| 166 | awsOnDemandDemo = false |
| 167 | } |
Владислав Наумов | 53b07e5 | 2021-01-07 15:08:27 +0100 | [diff] [blame^] | 168 | |
| 169 | if (multiregionalMappings['regionLocation'] != 'aws' && seedMacOs) { // macstadium seed node has access only to *public* providers |
| 170 | error('incompatible triggers: [seed-macos] and multiregional deployment based on *private* regional provider cannot be applied simultaneously') |
| 171 | } |
Владислав Наумов | 3e4b5a3 | 2020-09-11 17:05:34 +0200 | [diff] [blame] | 172 | break |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 173 | case 'os': |
| 174 | if (enableOSDemo == false) { |
| 175 | error('incompatible triggers: [disable-os-demo] and multiregional deployment based on OSt management region cannot be applied simultaneously') |
| 176 | } |
Владислав Наумов | 3e4b5a3 | 2020-09-11 17:05:34 +0200 | [diff] [blame] | 177 | break |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 178 | } |
| 179 | |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 180 | // calculate weight of current demo run to manage lockable resources |
| 181 | def demoWeight = (deployChild) ? 2 : 1 // management = 1, child = 1 |
| 182 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 183 | common.infoMsg(""" |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 184 | Use MacOS node as seed: ${seedMacOs} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 185 | Child cluster deployment scheduled: ${deployChild} |
| 186 | Child cluster release upgrade scheduled: ${upgradeChild} |
| 187 | Child conformance testing scheduled: ${runChildConformance} |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 188 | BYO cluster attachment scheduled: ${attachBYO} |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 189 | Attached BYO cluster upgrade test scheduled: ${upgradeBYO} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 190 | Mgmt cluster release upgrade scheduled: ${upgradeMgmt} |
| 191 | Mgmt conformance testing scheduled: ${runMgmtConformance} |
| 192 | Mgmt UI e2e testing scheduled: ${runUie2e} |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 193 | AWS provider deployment scheduled: ${awsOnDemandDemo} |
Ivan Berezovskiy | 07e1de1 | 2020-10-09 13:07:05 +0400 | [diff] [blame] | 194 | AWS provider on RHEL deployment scheduled: ${awsOnRhelDemo} |
Stanislav Riazanov | 24b9c5d | 2020-10-12 22:27:12 +0400 | [diff] [blame] | 195 | VSPHERE provider deployment scheduled: ${vsphereOnDemandDemo} |
eromanova | df247c3 | 2020-12-25 15:44:13 +0400 | [diff] [blame] | 196 | EQUINIX child cluster deployment scheduled: ${equinixOnAwsDemo} |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 197 | OS provider deployment scheduled: ${enableOSDemo} |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 198 | BM provider deployment scheduled: ${enableBMDemo} |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 199 | Multiregional configuration: ${multiregionalMappings} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 200 | Service binaries fetching scheduled: ${fetchServiceBinaries} |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 201 | Current weight of the demo run: ${demoWeight} (Used to manage lockable resources) |
Владислав Наумов | 5a523ef | 2020-07-29 13:33:38 +0200 | [diff] [blame] | 202 | Triggers: https://docs.google.com/document/d/1SSPD8ZdljbqmNl_FEAvTHUTow9Ki8NIMu82IcAVhzXw/""") |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 203 | return [ |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 204 | useMacOsSeedNode : seedMacOs, |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 205 | deployChildEnabled : deployChild, |
| 206 | upgradeChildEnabled : upgradeChild, |
| 207 | runChildConformanceEnabled : runChildConformance, |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 208 | attachBYOEnabled : attachBYO, |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 209 | upgradeBYOEnabled : upgradeBYO, |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 210 | upgradeMgmtEnabled : upgradeMgmt, |
| 211 | runUie2eEnabled : runUie2e, |
| 212 | runMgmtConformanceEnabled : runMgmtConformance, |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 213 | fetchServiceBinariesEnabled: fetchServiceBinaries, |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 214 | awsOnDemandDemoEnabled : awsOnDemandDemo, |
Ivan Berezovskiy | 07e1de1 | 2020-10-09 13:07:05 +0400 | [diff] [blame] | 215 | awsOnDemandRhelDemoEnabled : awsOnRhelDemo, |
Stanislav Riazanov | 24b9c5d | 2020-10-12 22:27:12 +0400 | [diff] [blame] | 216 | vsphereOnDemandDemoEnabled : vsphereOnDemandDemo, |
eromanova | df247c3 | 2020-12-25 15:44:13 +0400 | [diff] [blame] | 217 | equinixOnAwsDemoEnabled : equinixOnAwsDemo, |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 218 | bmDemoEnabled : enableBMDemo, |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 219 | osDemoEnabled : enableOSDemo, |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 220 | multiregionalConfiguration : multiregionalMappings, |
| 221 | demoWeight : demoWeight] |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 222 | } |
| 223 | |
| 224 | /** |
| 225 | * Determine management and regional setup for demo workflow scenario |
| 226 | * |
| 227 | * |
| 228 | * @param: keyword (string) string , represents keyworkd trigger, specified in gerrit commit body, like `[multiregion aws,os]` |
| 229 | or Jenkins environment string variable in form like 'aws,os' |
| 230 | * @return (map)[ |
| 231 | enabled: (bool), |
| 232 | * managementLocation: (string), //aws,os |
| 233 | * regionLocation: (string), //aws,os |
| 234 | * ] |
| 235 | */ |
| 236 | def multiregionWorkflowParser(keyword) { |
Владислав Наумов | 8c0c39d | 2020-09-11 14:46:48 +0200 | [diff] [blame] | 237 | def common = new com.mirantis.mk.Common() |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 238 | def supportedManagementProviders = ['os', 'aws'] |
| 239 | def supportedRegionalProviders = ['os'] |
| 240 | |
| 241 | def clusterTypes = '' |
Владислав Наумов | 38ed7bf | 2020-09-11 14:43:39 +0200 | [diff] [blame] | 242 | if (keyword.toString().contains('multiregion')) { |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 243 | common.infoMsg('Multiregion definition configured via gerrit keyword trigger') |
| 244 | clusterTypes = keyword[0][0].split('multiregion')[1].replaceAll('[\\[\\]]', '').trim().split(',') |
| 245 | } else { |
| 246 | common.infoMsg('Multiregion definition configured via environment variable') |
| 247 | clusterTypes = keyword.trim().split(',') |
| 248 | } |
| 249 | |
| 250 | if (clusterTypes.size() != 2) { |
Владислав Наумов | 482fb50 | 2020-10-30 17:59:27 +0100 | [diff] [blame] | 251 | error("Incorrect regions definiton, valid scheme: [multiregion ${management}, ${region}], got: ${clusterTypes}") |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 252 | } |
| 253 | |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 254 | def desiredManagementProvider = clusterTypes[0].trim() |
| 255 | def desiredRegionalProvider = clusterTypes[1].trim() |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 256 | if (! supportedManagementProviders.contains(desiredManagementProvider) || ! supportedRegionalProviders.contains(desiredRegionalProvider)) { |
| 257 | error("""unsupported management <-> regional bundle, available options: |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 258 | management providers list - ${supportedManagementProviders} |
| 259 | regional providers list - ${supportedRegionalProviders}""") |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 260 | } |
| 261 | |
| 262 | return [ |
| 263 | enabled: true, |
| 264 | managementLocation: desiredManagementProvider, |
| 265 | regionLocation: desiredRegionalProvider, |
| 266 | ] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | /** |
| 270 | * Determine if custom si tests/pipelines refspec forwarded from gerrit change request |
| 271 | |
Владислав Наумов | 5a523ef | 2020-07-29 13:33:38 +0200 | [diff] [blame] | 272 | * Keyword list: https://docs.google.com/document/d/1SSPD8ZdljbqmNl_FEAvTHUTow9Ki8NIMu82IcAVhzXw/ |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 273 | * Used for components team to test component changes w/ custom SI refspecs using kaas/core deployment jobs |
| 274 | * Example scheme: |
| 275 | * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| 276 | * manage refspecs through Jenkins Job Parameters |
| 277 | * |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 278 | * @return (map)[* siTests: (string) final refspec for si-tests |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 279 | * siPipelines: (string) final refspec for si-pipelines |
| 280 | * ] |
| 281 | */ |
| 282 | def checkCustomSIRefspec() { |
vnaumov | bdb9022 | 2020-05-04 18:25:50 +0200 | [diff] [blame] | 283 | def common = new com.mirantis.mk.Common() |
| 284 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 285 | // Available triggers and its sane defaults |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 286 | def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master' |
| 287 | def siPipelinesRefspec = env.SI_PIPELINES_REFSPEC ?: 'master' |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 288 | def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test' |
| 289 | def siTestsDockerImageTag = env.SI_TESTS_DOCKER_IMAGE_TAG ?: 'master' |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 290 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 291 | |
| 292 | def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/) |
| 293 | def siPipelinesMatches = (commitMsg =~ /(\[si-pipelines-ref\s*refs\/changes\/.*?\])/) |
| 294 | |
| 295 | if (siTestMatches.size() > 0) { |
| 296 | siTestsRefspec = siTestMatches[0][0].split('si-tests-ref')[1].replaceAll('[\\[\\]]', '').trim() |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 297 | siTestsDockerImage = "docker-dev-local.docker.mirantis.net/review/kaas-si-test-${siTestsRefspec.split('/')[-2]}" |
| 298 | siTestsDockerImageTag = siTestsRefspec.split('/')[-1] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 299 | } |
| 300 | if (siPipelinesMatches.size() > 0) { |
| 301 | siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 302 | } |
| 303 | |
| 304 | common.infoMsg(""" |
| 305 | kaas/si-pipelines will be fetched from: ${siPipelinesRefspec} |
| 306 | kaas/si-tests will be fetched from: ${siTestsRefspec} |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 307 | kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}:${siTestsDockerImageTag} |
Владислав Наумов | 5a523ef | 2020-07-29 13:33:38 +0200 | [diff] [blame] | 308 | Keywords: https://docs.google.com/document/d/1SSPD8ZdljbqmNl_FEAvTHUTow9Ki8NIMu82IcAVhzXw/""") |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 309 | return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage, siTestsDockerImageTag: siTestsDockerImageTag] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 310 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 311 | |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 312 | /** |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 313 | * Parse additional configuration for kaas component CICD repo |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 314 | * @param configurationFile (str) path to configuration file in yaml format |
| 315 | * |
| 316 | * @return (map)[ siTestsFeatureFlags (string) dedicated feature flags that will be used in SI tests, |
| 317 | * ] |
| 318 | */ |
| 319 | def parseKaaSComponentCIParameters(configurationFile){ |
| 320 | def common = new com.mirantis.mk.Common() |
| 321 | def ciConfig = readYaml file: configurationFile |
| 322 | def ciSpec = [ |
| 323 | siTestsFeatureFlags: env.SI_TESTS_FEATURE_FLAGS ?: '', |
| 324 | ] |
| 325 | |
| 326 | if (ciConfig.containsKey('si-tests-feature-flags')) { |
| 327 | common.infoMsg("""SI tests feature flags customization detected, |
| 328 | results will be merged with existing flags: [${ciSpec['siTestsFeatureFlags']}] identification...""") |
| 329 | |
| 330 | def ffMeta = ciSpec['siTestsFeatureFlags'].tokenize(',').collect { it.trim() } |
| 331 | ffMeta.addAll(ciConfig['si-tests-feature-flags']) |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 332 | |
Владислав Наумов | cb5ffca | 2020-07-14 15:28:36 +0200 | [diff] [blame] | 333 | ciSpec['siTestsFeatureFlags'] = ffMeta.unique().join(',') |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 334 | common.infoMsg("SI tests custom feature flags: ${ciSpec['siTestsFeatureFlags']}") |
| 335 | } |
| 336 | |
| 337 | common.infoMsg("""Additional ci configuration parsed successfully: |
| 338 | siTestsFeatureFlags: ${ciSpec['siTestsFeatureFlags']}""") |
| 339 | return ciSpec |
| 340 | } |
| 341 | |
| 342 | /** |
| 343 | * Determine if custom kaas core/pipelines refspec forwarded from gerrit change request |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 344 | |
Владислав Наумов | 5a523ef | 2020-07-29 13:33:38 +0200 | [diff] [blame] | 345 | * Keyword list: https://docs.google.com/document/d/1SSPD8ZdljbqmNl_FEAvTHUTow9Ki8NIMu82IcAVhzXw/ |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 346 | * Used for components team to test component changes w/ custom Core refspecs using kaas/core deployment jobs |
| 347 | * Example scheme: |
| 348 | * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| 349 | * manage refspecs through Jenkins Job Parameters |
| 350 | * |
| 351 | * @return (map)[ core: (string) final refspec for kaas/core |
| 352 | * corePipelines: (string) final refspec for pipelines in kaas/core |
| 353 | * ] |
| 354 | */ |
| 355 | def checkCustomCoreRefspec() { |
| 356 | def common = new com.mirantis.mk.Common() |
| 357 | |
| 358 | // Available triggers and its sane defaults |
| 359 | def coreRefspec = env.KAAS_CORE_REFSPEC ?: 'master' |
| 360 | // by default using value of GERRIT_REFSPEC parameter in *kaas/core jobs* |
| 361 | def corePipelinesRefspec = env.KAAS_PIPELINE_REFSPEC ?: '\$GERRIT_REFSPEC' |
| 362 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| 363 | |
| 364 | def coreMatches = (commitMsg =~ /(\[core-ref\s*refs\/changes\/.*?\])/) |
| 365 | def corePipelinesMatches = (commitMsg =~ /(\[core-pipelines-ref\s*refs\/changes\/.*?\])/) |
| 366 | |
| 367 | if (coreMatches.size() > 0) { |
| 368 | coreRefspec = coreMatches[0][0].split('core-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 369 | } |
| 370 | if (corePipelinesMatches.size() > 0) { |
| 371 | corePipelinesRefspec = corePipelinesMatches[0][0].split('core-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 372 | } |
| 373 | |
| 374 | common.infoMsg(""" |
| 375 | kaas/core will be fetched from: ${coreRefspec} |
| 376 | kaas/core pipelines will be fetched from: ${corePipelinesRefspec} |
Владислав Наумов | 5a523ef | 2020-07-29 13:33:38 +0200 | [diff] [blame] | 377 | Keywords: https://docs.google.com/document/d/1SSPD8ZdljbqmNl_FEAvTHUTow9Ki8NIMu82IcAVhzXw/""") |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 378 | return [core: coreRefspec, corePipelines: corePipelinesRefspec] |
| 379 | } |
| 380 | |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 381 | |
| 382 | /** |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 383 | * generate Jenkins Parameter objects from from text parameter with additonal kaas core context |
| 384 | * needed to forward inside kaas core set of jobs |
| 385 | * |
| 386 | * @param context (string) Representation of the string enviroment variables needed for kaas core jobs in yaml format |
| 387 | * @return (list)[ string(name: '', value: ''), |
| 388 | * ] |
| 389 | */ |
| 390 | def generateKaaSVarsFromContext(context) { |
| 391 | def common = new com.mirantis.mk.Common() |
| 392 | def parameters = [] |
| 393 | def config = readYaml text: context |
| 394 | |
| 395 | config.each { k,v -> |
| 396 | common.infoMsg("Custom KaaS Core context parameter: ${k}=${v}") |
| 397 | parameters.add(string(name: k, value: v)) |
| 398 | } |
| 399 | |
| 400 | return parameters |
| 401 | } |
| 402 | |
| 403 | /** |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 404 | * Trigger KaaS demo jobs based on AWS/OS providers with customized test suite, parsed from external sources (gerrit commit/jj vars) |
Владислав Наумов | 5a523ef | 2020-07-29 13:33:38 +0200 | [diff] [blame] | 405 | * Keyword list: https://docs.google.com/document/d/1SSPD8ZdljbqmNl_FEAvTHUTow9Ki8NIMu82IcAVhzXw/ |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 406 | * Used for components team to test component changes w/ customized SI tests/refspecs using kaas/core deployment jobs |
| 407 | * |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 408 | * @param: component (string) component name [iam, lcm, stacklight] |
| 409 | * @param: patchSpec (string) Patch for kaas/cluster releases in json format |
| 410 | * @param: configurationFile (string) Additional file for component repo CI config in yaml format |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 411 | */ |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 412 | def triggerPatchedComponentDemo(component, patchSpec = '', configurationFile = '.ci-parameters.yaml', coreContext = '') { |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 413 | def common = new com.mirantis.mk.Common() |
| 414 | // Determine if custom trigger keywords forwarded from gerrit |
| 415 | def triggers = checkDeploymentTestSuite() |
| 416 | // Determine SI refspecs |
| 417 | def siRefspec = checkCustomSIRefspec() |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 418 | // Determine Core refspecs |
| 419 | def coreRefspec = checkCustomCoreRefspec() |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 420 | |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 421 | // Determine component repo ci configuration |
| 422 | def ciSpec = [:] |
| 423 | def componentFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: '' |
| 424 | if (fileExists(configurationFile)) { |
| 425 | common.infoMsg('Component CI configuration file detected, parsing...') |
| 426 | ciSpec = parseKaaSComponentCIParameters(configurationFile) |
| 427 | componentFeatureFlags = ciSpec['siTestsFeatureFlags'] |
| 428 | } else { |
| 429 | common.warningMsg('''Component CI configuration file is not exists, |
Владислав Наумов | c17dd55 | 2020-07-29 17:07:38 +0200 | [diff] [blame] | 430 | several code-management features may be unavailable, |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 431 | follow https://mirantis.jira.com/wiki/spaces/QA/pages/2310832276/SI-tests+feature+flags#%5BUpdated%5D-Using-a-feature-flag |
| 432 | to create the configuration file''') |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 433 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 434 | def jobs = [:] |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 435 | def parameters = [ |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 436 | string(name: 'GERRIT_REFSPEC', value: coreRefspec.core), |
| 437 | string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 438 | string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests), |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 439 | string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags), |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 440 | string(name: 'SI_TESTS_DOCKER_IMAGE', value: siRefspec.siTestsDockerImage), |
| 441 | string(name: 'SI_TESTS_DOCKER_IMAGE_TAG', value: siRefspec.siTestsDockerImageTag), |
Владислав Наумов | 4a5c324 | 2020-06-08 14:36:11 +0200 | [diff] [blame] | 442 | string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 443 | string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec), |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 444 | booleanParam(name: 'SEED_MACOS', value: triggers.useMacOsSeedNode), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 445 | booleanParam(name: 'UPGRADE_MGMT_CLUSTER', value: triggers.upgradeMgmtEnabled), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 446 | booleanParam(name: 'RUN_UI_E2E', value: triggers.runUie2eEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 447 | booleanParam(name: 'RUN_MGMT_CFM', value: triggers.runMgmtConformanceEnabled), |
| 448 | booleanParam(name: 'DEPLOY_CHILD_CLUSTER', value: triggers.deployChildEnabled), |
| 449 | booleanParam(name: 'UPGRADE_CHILD_CLUSTER', value: triggers.upgradeChildEnabled), |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 450 | booleanParam(name: 'ATTACH_BYO', value: triggers.attachBYOEnabled), |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 451 | booleanParam(name: 'UPGRADE_BYO', value: triggers.upgradeBYOEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 452 | booleanParam(name: 'RUN_CHILD_CFM', value: triggers.runChildConformanceEnabled), |
Ivan Berezovskiy | 07e1de1 | 2020-10-09 13:07:05 +0400 | [diff] [blame] | 453 | booleanParam(name: 'ALLOW_AWS_ON_DEMAND', value: triggers.awsOnDemandDemoEnabled || triggers.awsOnDemandRhelDemoEnabled), |
Stanislav Riazanov | 24b9c5d | 2020-10-12 22:27:12 +0400 | [diff] [blame] | 454 | booleanParam(name: 'ALLOW_VSPHERE_ON_DEMAND', value: triggers.vsphereOnDemandDemoEnabled), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 455 | ] |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 456 | |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 457 | // customize multiregional demo |
| 458 | if (triggers.multiregionalConfiguration.enabled) { |
| 459 | parameters.add(string(name: 'MULTIREGION_SETUP', |
| 460 | value: "${triggers.multiregionalConfiguration.managementLocation},${triggers.multiregionalConfiguration.regionLocation}" |
| 461 | )) |
| 462 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 463 | |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 464 | // Determine component team custom context |
| 465 | if (coreContext != '') { |
| 466 | common.infoMsg('Additional KaaS Core context detected, will be forwarded into kaas core cicd...') |
| 467 | def additionalParameters = generateKaaSVarsFromContext(coreContext) |
Владислав Наумов | bef51a9 | 2020-10-01 17:36:51 +0200 | [diff] [blame] | 468 | parameters.addAll(additionalParameters) |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 469 | } |
| 470 | |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 471 | def jobResults = [] |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 472 | jobs["kaas-core-openstack-patched-${component}"] = { |
Владислав Наумов | f86b111 | 2020-06-09 14:04:48 +0200 | [diff] [blame] | 473 | try { |
| 474 | common.infoMsg('Deploy: patched KaaS demo with Openstack provider') |
Владислав Наумов | 4aa112d | 2020-06-16 18:52:21 +0200 | [diff] [blame] | 475 | os_job_info = build job: "kaas-testing-core-openstack-workflow-${component}", parameters: parameters, wait: true |
| 476 | def build_description = os_job_info.getDescription() |
Владислав Наумов | d044e84 | 2020-06-17 15:33:43 +0200 | [diff] [blame] | 477 | def build_result = os_job_info.getResult() |
| 478 | jobResults.add(build_result) |
| 479 | |
Владислав Наумов | f86b111 | 2020-06-09 14:04:48 +0200 | [diff] [blame] | 480 | if (build_description) { |
| 481 | currentBuild.description += build_description |
| 482 | } |
| 483 | } finally { |
Владислав Наумов | 6d741fa | 2020-06-17 17:35:43 +0200 | [diff] [blame] | 484 | common.infoMsg('Patched KaaS demo with Openstack provider finished') |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 485 | } |
| 486 | } |
| 487 | if (triggers.awsOnDemandDemoEnabled) { |
Владислав Наумов | 5928195 | 2020-07-29 16:43:49 +0200 | [diff] [blame] | 488 | common.infoMsg('AWS demo triggered, need to sync artifacts in the public-ci cdn..') |
| 489 | switch (component) { |
| 490 | case 'iam': |
| 491 | build job: 'cdn-binary-dev-replication-iam', propagate: true, wait: true |
| 492 | break |
| 493 | case 'lcm': |
| 494 | build job: 'cdn-binary-dev-replication-lcm', propagate: true, wait: true |
| 495 | break |
| 496 | } |
| 497 | |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 498 | jobs["kaas-core-aws-patched-${component}"] = { |
Владислав Наумов | f86b111 | 2020-06-09 14:04:48 +0200 | [diff] [blame] | 499 | try { |
| 500 | common.infoMsg('Deploy: patched KaaS demo with AWS provider') |
Владислав Наумов | 4aa112d | 2020-06-16 18:52:21 +0200 | [diff] [blame] | 501 | aws_job_info = build job: "kaas-testing-core-aws-workflow-${component}", parameters: parameters, wait: true |
| 502 | def build_description = aws_job_info.getDescription() |
Владислав Наумов | d044e84 | 2020-06-17 15:33:43 +0200 | [diff] [blame] | 503 | def build_result = aws_job_info.getResult() |
| 504 | jobResults.add(build_result) |
| 505 | |
Владислав Наумов | f86b111 | 2020-06-09 14:04:48 +0200 | [diff] [blame] | 506 | if (build_description) { |
| 507 | currentBuild.description += build_description |
| 508 | } |
| 509 | } finally { |
Владислав Наумов | 6d741fa | 2020-06-17 17:35:43 +0200 | [diff] [blame] | 510 | common.infoMsg('Patched KaaS demo with AWS provider finished') |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 511 | } |
| 512 | } |
| 513 | } |
Stanislav Riazanov | 24b9c5d | 2020-10-12 22:27:12 +0400 | [diff] [blame] | 514 | if (triggers.vsphereOnDemandDemoEnabled) { |
| 515 | jobs["kaas-core-vsphere-patched-${component}"] = { |
| 516 | try { |
| 517 | common.infoMsg('Deploy: patched KaaS demo with VSPHERE provider') |
| 518 | vsphere_job_info = build job: "kaas-testing-core-vsphere-workflow-${component}", parameters: parameters, wait: true |
| 519 | def build_description = vsphere_job_info.getDescription() |
| 520 | def build_result = vsphere_job_info.getResult() |
| 521 | jobResults.add(build_result) |
| 522 | |
| 523 | if (build_description) { |
| 524 | currentBuild.description += build_description |
| 525 | } |
| 526 | } finally { |
| 527 | common.infoMsg('Patched KaaS demo with VSPHERE provider finished') |
| 528 | } |
| 529 | } |
| 530 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 531 | |
| 532 | common.infoMsg('Trigger KaaS demo deployments according to defined provider set') |
| 533 | // Limit build concurency workaround examples: https://issues.jenkins-ci.org/browse/JENKINS-44085 |
| 534 | parallel jobs |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 535 | |
| 536 | if (jobResults.contains('FAILURE')) { |
Владислав Наумов | f86b111 | 2020-06-09 14:04:48 +0200 | [diff] [blame] | 537 | common.infoMsg('One of parallel downstream jobs is failed, mark executor job as failed') |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 538 | currentBuild.result = 'FAILURE' |
| 539 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 540 | } |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 541 | |
| 542 | |