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 |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 35 | * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
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 |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 54 | def mosDeployChild = env.DEPLOY_MOS_CHILD_CLUSTER ? env.DEPLOY_MOS_CHILD_CLUSTER.toBoolean() : false |
| 55 | def mosUpgradeChild = env.UPGRADE_MOS_CHILD_CLUSTER ? env.UPGRADE_MOS_CHILD_CLUSTER.toBoolean() : false |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 56 | def customChildRelease = env.KAAS_CHILD_CLUSTER_RELEASE_NAME ? env.KAAS_CHILD_CLUSTER_RELEASE_NAME : '' |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame^] | 57 | def mosTfDeploy = env.MOS_TF_DEPLOY ? env.MOS_TF_DEPLOY.toBoolean() : false |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 58 | def attachBYO = env.ATTACH_BYO ? env.ATTACH_BYO.toBoolean() : false |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 59 | def upgradeBYO = env.UPGRADE_BYO ? env.UPGRADE_BYO.toBoolean() : false |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 60 | def runBYOMatrix = env.RUN_BYO_MATRIX ? env.RUN_BYO_MATRIX.toBoolean() : false |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 61 | def defaultBYOOs = env.DEFAULT_BYO_OS ? env.DEFAULT_BYO_OS.toString() : 'ubuntu' |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 62 | def upgradeMgmt = env.UPGRADE_MGMT_CLUSTER ? env.UPGRADE_MGMT_CLUSTER.toBoolean() : false |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 63 | def enableLMALogging = env.ENABLE_LMA_LOGGING ? env.ENABLE_LMA_LOGGING.toBoolean(): false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 64 | def runUie2e = env.RUN_UI_E2E ? env.RUN_UI_E2E.toBoolean() : false |
| 65 | def runMgmtConformance = env.RUN_MGMT_CFM ? env.RUN_MGMT_CFM.toBoolean() : false |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 66 | def runLMATest = env.RUN_LMA_TEST ? env.RUN_LMA_TEST.toBoolean() : false |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 67 | def runMgmtUserControllerTest = env.RUN_MGMT_USER_CONTROLLER_TEST ? env.RUN_MGMT_USER_CONTROLLER_TEST.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 68 | def runChildConformance = env.RUN_CHILD_CFM ? env.RUN_CHILD_CFM.toBoolean() : false |
| 69 | def fetchServiceBinaries = env.FETCH_BINARIES_FROM_UPSTREAM ? env.FETCH_BINARIES_FROM_UPSTREAM.toBoolean() : false |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 70 | def equinixMetalV2ChildDiffMetro = env.EQUINIXMETALV2_CHILD_DIFF_METRO ? env.EQUINIXMETALV2_CHILD_DIFF_METRO.toBoolean() : false |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 71 | def runMaintenanceTest = env.RUN_MAINTENANCE_TEST ? env.RUN_MAINTENANCE_TEST.toBoolean() : false |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 72 | // multiregion configuration from env variable: comma-separated string in form $mgmt_provider,$regional_provider |
| 73 | def multiregionalMappings = env.MULTIREGION_SETUP ? multiregionWorkflowParser(env.MULTIREGION_SETUP) : [ |
| 74 | enabled: false, |
| 75 | managementLocation: '', |
| 76 | regionLocation: '', |
| 77 | ] |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 78 | |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 79 | // proxy customization |
| 80 | def proxyConfig = [ |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 81 | mgmtOffline: env.OFFLINE_MGMT_CLUSTER ? env.OFFLINE_MGMT_CLUSTER.toBoolean() : false, |
| 82 | childOffline: env.OFFLINE_CHILD_CLUSTER ? env.OFFLINE_CHILD_CLUSTER.toBoolean() : false, |
Владислав Наумов | 257ea13 | 2021-04-14 14:44:13 +0200 | [diff] [blame] | 83 | childProxy: env.PROXY_CHILD_CLUSTER ? env.PROXY_CHILD_CLUSTER.toBoolean() : false, |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 84 | ] |
| 85 | |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 86 | // optional demo deployment customization |
Владислав Наумов | 905dd36 | 2020-06-08 16:37:01 +0200 | [diff] [blame] | 87 | def awsOnDemandDemo = env.ALLOW_AWS_ON_DEMAND ? env.ALLOW_AWS_ON_DEMAND.toBoolean() : false |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 88 | def equinixOnDemandDemo = env.ALLOW_EQUINIX_ON_DEMAND ? env.ALLOW_EQUINIX_ON_DEMAND.toBoolean() : false |
Владислав Наумов | 82305e9 | 2021-10-14 20:45:20 +0200 | [diff] [blame] | 89 | def equinixMetalV2OnDemandDemo = env.ALLOW_EQUINIXMETALV2_ON_DEMAND ? env.ALLOW_EQUINIXMETALV2_ON_DEMAND.toBoolean() : false |
Владислав Наумов | f371580 | 2021-05-03 18:06:45 +0200 | [diff] [blame] | 90 | def equinixOnAwsDemo = env.EQUINIX_ON_AWS_DEMO ? env.EQUINIX_ON_AWS_DEMO.toBoolean() : false |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 91 | def azureOnAwsDemo = env.AZURE_ON_AWS_DEMO ? env.AZURE_ON_AWS_DEMO.toBoolean() : false |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 92 | def azureOnDemandDemo = env.ALLOW_AZURE_ON_DEMAND ? env.ALLOW_AZURE_ON_DEMAND.toBoolean() : false |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 93 | def enableVsphereDemo = true |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 94 | def enableOSDemo = true |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 95 | def enableBMDemo = true |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 96 | def openstackIMC = env.OPENSTACK_CLOUD_LOCATION ? env.OPENSTACK_CLOUD_LOCATION : 'us' |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 97 | |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 98 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 99 | if (commitMsg ==~ /(?s).*\[mgmt-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-proxy.*/) { |
| 100 | proxyConfig['mgmtOffline'] = true |
Владислав Наумов | 70c0242 | 2021-04-19 14:29:41 +0200 | [diff] [blame] | 101 | common.warningMsg('Forced running offline mgmt deployment, some provider CDN regions for mgmt deployment may be set to *public-ci* to verify proxy configuration') |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 102 | } |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 103 | if (commitMsg ==~ /(?s).*\[seed-macos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*seed-macos.*/) { |
| 104 | seedMacOs = true |
| 105 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 106 | if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ || upgradeChild || runChildConformance) { |
| 107 | deployChild = true |
| 108 | } |
| 109 | if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) { |
| 110 | deployChild = true |
| 111 | upgradeChild = true |
| 112 | } |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 113 | def childDeployMatches = (commitMsg =~ /(\[child-deploy\s*(\w|\-)+?\])/) |
| 114 | if (childDeployMatches.size() > 0) { |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 115 | // override child version when it set explicitly |
| 116 | deployChild = true |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 117 | customChildRelease = childDeployMatches[0][0].split('child-deploy')[1].replaceAll('[\\[\\]]', '').trim() |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 118 | common.warningMsg("Forced child deployment using custom release version ${customChildRelease}") |
| 119 | } |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 120 | if (commitMsg ==~ /(?s).*\[mos-child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-deploy.*/) { |
| 121 | mosDeployChild = true |
| 122 | } |
| 123 | if (commitMsg ==~ /(?s).*\[mos-child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-upgrade.*/) { |
| 124 | mosDeployChild = true |
| 125 | mosUpgradeChild = true |
| 126 | } |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 127 | if (commitMsg ==~ /(?s).*\[byo-attach\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-attach.*/) { |
| 128 | attachBYO = true |
| 129 | } |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 130 | if (commitMsg ==~ /(?s).*\[byo-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-upgrade.*/) { |
| 131 | attachBYO = true |
| 132 | upgradeBYO = true |
| 133 | } |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 134 | |
| 135 | def byoDeployMatches = (commitMsg =~ /(\[run-byo-matrix\s*(ubuntu|centos)\])/) |
| 136 | if (commitMsg ==~ /(?s).*\[run-byo-matrix\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*run-byo-matrix\.*/ || byoDeployMatches.size() > 0) { |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 137 | runBYOMatrix = true |
| 138 | |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 139 | if (byoDeployMatches.size() > 0) { |
| 140 | defaultBYOOs = byoDeployMatches[0][2] |
| 141 | common.warningMsg("Custom BYO OS detected, using ${defaultBYOOs}") |
| 142 | } |
| 143 | |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 144 | common.warningMsg('Forced byo matrix test via run-byo-matrix, all other byo triggers will be skipped') |
| 145 | attachBYO = false |
| 146 | upgradeBYO = false |
| 147 | } |
Владислав Наумов | 7f8c987 | 2021-03-08 17:33:08 +0400 | [diff] [blame] | 148 | if (commitMsg ==~ /(?s).*\[mgmt-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-upgrade.*/) { |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 149 | upgradeMgmt = true |
| 150 | } |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 151 | if (commitMsg ==~ /(?s).*\[lma-logging\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-logging.*/) { |
| 152 | enableLMALogging = true |
| 153 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 154 | if (commitMsg ==~ /(?s).*\[ui-e2e\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e.*/) { |
| 155 | runUie2e = true |
| 156 | } |
| 157 | if (commitMsg ==~ /(?s).*\[mgmt-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm.*/) { |
| 158 | runMgmtConformance = true |
| 159 | } |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 160 | if (commitMsg ==~ /(?s).*\[test-user-controller\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-user-controller.*/) { |
| 161 | runMgmtUserControllerTest = true |
| 162 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 163 | if (commitMsg ==~ /(?s).*\[child-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm.*/) { |
| 164 | runChildConformance = true |
| 165 | deployChild = true |
| 166 | } |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 167 | if (commitMsg ==~ /(?s).*\[lma-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-test.*/) { |
| 168 | runLMATest = true |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 169 | enableLMALogging = true |
| 170 | common.infoMsg('LMA logging will be enabled since LMA test suite will be executed') |
Victor Ryzhenkin | 1520659 | 2021-06-21 17:38:23 +0400 | [diff] [blame] | 171 | } |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 172 | if (commitMsg ==~ /(?s).*\[maintenance-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*maintenance-test.*/) { |
| 173 | runMaintenanceTest = true |
| 174 | } |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 175 | if (commitMsg ==~ /(?s).*\[child-offline\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-offline.*/) { |
| 176 | proxyConfig['childOffline'] = true |
| 177 | deployChild = true |
| 178 | } |
Владислав Наумов | 257ea13 | 2021-04-14 14:44:13 +0200 | [diff] [blame] | 179 | if (commitMsg ==~ /(?s).*\[child-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-proxy.*/) { |
| 180 | proxyConfig['childOffline'] = true |
| 181 | proxyConfig['childProxy'] = true |
| 182 | deployChild = true |
| 183 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 184 | if (commitMsg ==~ /(?s).*\[fetch.*binaries\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*fetch.*binaries.*/) { |
| 185 | fetchServiceBinaries = true |
| 186 | } |
Владислав Наумов | f1665b5 | 2021-05-13 10:51:17 +0200 | [diff] [blame] | 187 | if (commitMsg ==~ /(?s).*\[equinix-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-on-aws.*/) { |
eromanova | df247c3 | 2020-12-25 15:44:13 +0400 | [diff] [blame] | 188 | equinixOnAwsDemo = true |
Владислав Наумов | f1665b5 | 2021-05-13 10:51:17 +0200 | [diff] [blame] | 189 | common.warningMsg('Forced running child cluster deployment on EQUINIX METAL provider based on AWS management cluster, triggered on patchset using custom keyword: \'[equinix-on-aws]\' ') |
eromanova | df247c3 | 2020-12-25 15:44:13 +0400 | [diff] [blame] | 190 | } |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 191 | if (commitMsg ==~ /(?s).*\[azure-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-on-aws.*/) { |
| 192 | azureOnAwsDemo = true |
| 193 | common.warningMsg('Forced running child cluster deployment on Azure provider based on AWS management cluster, triggered on patchset using custom keyword: \'[azure-on-aws]\' ') |
| 194 | } |
| 195 | if (commitMsg ==~ /(?s).*\[aws-demo\].*/ || |
| 196 | env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aws-demo.*/ || |
| 197 | attachBYO || |
| 198 | upgradeBYO || |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 199 | runBYOMatrix || |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 200 | seedMacOs || |
| 201 | equinixOnAwsDemo || |
| 202 | azureOnAwsDemo) { |
| 203 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 204 | awsOnDemandDemo = true |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 205 | common.warningMsg('Running additional kaas deployment with AWS provider, may be forced due applied trigger cross dependencies, follow docs to clarify info') |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 206 | } |
Владислав Наумов | f1665b5 | 2021-05-13 10:51:17 +0200 | [diff] [blame] | 207 | if (commitMsg ==~ /(?s).*\[equinix-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-demo\.*/) { |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 208 | equinixOnDemandDemo = true |
| 209 | } |
Владислав Наумов | 82305e9 | 2021-10-14 20:45:20 +0200 | [diff] [blame] | 210 | if (commitMsg ==~ /(?s).*\[equinixmetalv2-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-demo\.*/) { |
Владислав Наумов | 144956f | 2021-10-14 17:49:19 +0200 | [diff] [blame] | 211 | equinixMetalV2OnDemandDemo = true |
| 212 | } |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 213 | if (commitMsg ==~ /(?s).*\[equinixmetalv2-child-diff-metro\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-child-diff-metro\.*/) { |
| 214 | equinixMetalV2OnDemandDemo = true |
| 215 | equinixMetalV2ChildDiffMetro = true |
| 216 | } |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 217 | if (commitMsg ==~ /(?s).*\[azure-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-demo\.*/) { |
| 218 | azureOnDemandDemo = true |
| 219 | } |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 220 | if (commitMsg ==~ /(?s).*\[disable-os-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-os-demo\.*/) { |
| 221 | enableOSDemo = false |
| 222 | common.errorMsg('Openstack demo deployment will be aborted, VF -1 will be set') |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 223 | } |
| 224 | |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 225 | if (commitMsg ==~ /(?s).*\[disable-bm-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-demo\.*/) { |
| 226 | enableBMDemo = false |
| 227 | common.errorMsg('BM demo deployment will be aborted, VF -1 will be set') |
| 228 | } |
| 229 | |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 230 | if (commitMsg ==~ /(?s).*\[disable-vsphere-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-vsphere-demo\.*/) { |
| 231 | enableVsphereDemo = false |
| 232 | common.errorMsg('vSphere demo deployment will be aborted, VF -1 will be set') |
| 233 | } |
| 234 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 235 | // TODO (vnaumov) remove below condition after moving all releases to UCP |
| 236 | def ucpChildMatches = (commitMsg =~ /(\[child-ucp\s*ucp-.*?\])/) |
| 237 | if (ucpChildMatches.size() > 0) { |
| 238 | deployChild = true |
| 239 | common.warningMsg('Forced UCP based child deployment triggered on patchset using custom keyword: \'[child-ucp ucp-5-1-0-3-3-0-example]\' ') |
| 240 | |
| 241 | // TODO(vnaumov) delete after ucp upgrades support |
| 242 | common.errorMsg('Child upgrade test will be skipped, UCP upgrades temporally disabled') |
| 243 | upgradeChild = false |
| 244 | } |
| 245 | |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 246 | // multiregional tests |
| 247 | def multiRegionalMatches = (commitMsg =~ /(\[multiregion\s*.*?\])/) |
| 248 | if (multiRegionalMatches.size() > 0) { |
| 249 | multiregionalMappings = multiregionWorkflowParser(multiRegionalMatches) |
| 250 | } |
| 251 | switch (multiregionalMappings['managementLocation']) { |
| 252 | case 'aws': |
Владислав Наумов | 53b07e5 | 2021-01-07 15:08:27 +0100 | [diff] [blame] | 253 | common.warningMsg('Forced running additional kaas deployment with AWS provider according multiregional demo request') |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 254 | awsOnDemandDemo = true |
Владислав Наумов | 53b07e5 | 2021-01-07 15:08:27 +0100 | [diff] [blame] | 255 | |
| 256 | if (multiregionalMappings['regionLocation'] != 'aws' && seedMacOs) { // macstadium seed node has access only to *public* providers |
| 257 | error('incompatible triggers: [seed-macos] and multiregional deployment based on *private* regional provider cannot be applied simultaneously') |
| 258 | } |
Владислав Наумов | 3e4b5a3 | 2020-09-11 17:05:34 +0200 | [diff] [blame] | 259 | break |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 260 | case 'os': |
| 261 | if (enableOSDemo == false) { |
| 262 | error('incompatible triggers: [disable-os-demo] and multiregional deployment based on OSt management region cannot be applied simultaneously') |
| 263 | } |
Владислав Наумов | 3e4b5a3 | 2020-09-11 17:05:34 +0200 | [diff] [blame] | 264 | break |
Владислав Наумов | 865ba6c | 2021-05-13 13:05:45 +0200 | [diff] [blame] | 265 | case 'vsphere': |
| 266 | if (enableVsphereDemo == false) { |
| 267 | error('incompatible triggers: [disable-vsphere-demo] and multiregional deployment based on Vsphere management region cannot be applied simultaneously') |
| 268 | } |
| 269 | break |
Владислав Наумов | 5be0294 | 2021-05-13 12:34:37 +0200 | [diff] [blame] | 270 | case 'equinix': |
| 271 | common.warningMsg('Forced running additional kaas deployment with Equinix provider according multiregional demo request') |
| 272 | equinixOnDemandDemo = true |
eromanova | 3535916 | 2021-12-30 14:13:13 +0400 | [diff] [blame] | 273 | break |
eromanova | 8c702ae | 2021-12-24 17:43:12 +0400 | [diff] [blame] | 274 | case 'equinixmetalv2': |
| 275 | common.warningMsg('Forced running additional kaas deployment with Equinix Metal V2 provider according multiregional demo request') |
| 276 | equinixMetalV2OnDemandDemo = true |
eromanova | 3535916 | 2021-12-30 14:13:13 +0400 | [diff] [blame] | 277 | break |
slalov | fd0b7e6 | 2021-07-28 18:05:16 +0400 | [diff] [blame] | 278 | case 'azure': |
| 279 | common.warningMsg('Forced running additional kaas deployment with Azure provider according multiregional demo request') |
| 280 | azureOnDemandDemo = true |
| 281 | break |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 282 | } |
| 283 | |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 284 | // CDN configuration |
| 285 | def cdnConfig = [ |
| 286 | mgmt: [ |
| 287 | openstack: (proxyConfig['mgmtOffline'] == true) ? 'public-ci' : 'internal-ci', |
Владислав Наумов | 70c0242 | 2021-04-19 14:29:41 +0200 | [diff] [blame] | 288 | vsphere: 'internal-ci', |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 289 | aws: 'public-ci', |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 290 | equinix: 'public-ci', |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 291 | azure: 'public-ci', |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 292 | ], |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 293 | ] |
| 294 | |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 295 | if (commitMsg ==~ /(?s).*\[eu-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*eu-demo.*/) { |
| 296 | openstackIMC = 'eu' |
| 297 | // use internal-eu because on internal-ci with eu cloud image pull takes much time |
| 298 | def cdnRegion = (proxyConfig['mgmtOffline'] == true) ? 'public-ci' : 'internal-eu' |
| 299 | common.infoMsg("eu-demo was triggered, force switching CDN region to ${cdnRegion}") |
| 300 | cdnConfig['mgmt']['openstack'] = cdnRegion |
| 301 | } |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame^] | 302 | if (commitMsg ==~ /(?s).*\[mos-tf-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-tf-demo.*/) { |
| 303 | openstackIMC = 'eu2' |
| 304 | MosTfDeploy = true |
| 305 | // use internal-eu because on internal-ci with eu cloud image pull takes much time |
| 306 | def cdnRegion = (proxyConfig['mgmtOffline'] == true) ? 'public-ci' : 'internal-eu' |
| 307 | common.infoMsg("eu2-demo was triggered, force switching CDN region to ${cdnRegion}") |
| 308 | cdnConfig['mgmt']['openstack'] = cdnRegion |
| 309 | } |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 310 | |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 311 | // calculate weight of current demo run to manage lockable resources |
| 312 | def demoWeight = (deployChild) ? 2 : 1 // management = 1, child = 1 |
| 313 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 314 | common.infoMsg(""" |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 315 | OpenStack Cloud location: ${openstackIMC} |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 316 | CDN deployment configuration: ${cdnConfig} |
| 317 | MCC offline deployment configuration: ${proxyConfig} |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 318 | Use MacOS node as seed: ${seedMacOs} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 319 | Child cluster deployment scheduled: ${deployChild} |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 320 | Custom child cluster release: ${customChildRelease} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 321 | Child cluster release upgrade scheduled: ${upgradeChild} |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame^] | 322 | Mos-Tf deploy: ${mosTfDeploy} |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 323 | MOS child deploy scheduled: ${mosDeployChild} |
| 324 | MOS child upgrade scheduled: ${mosUpgradeChild} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 325 | Child conformance testing scheduled: ${runChildConformance} |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 326 | Single BYO cluster attachment scheduled: ${attachBYO} |
| 327 | Single Attached BYO cluster upgrade test scheduled: ${upgradeBYO} |
| 328 | BYO test matrix whole suite scheduled: ${runBYOMatrix} |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 329 | Default BYO OS: ${defaultBYOOs} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 330 | Mgmt cluster release upgrade scheduled: ${upgradeMgmt} |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 331 | Mgmt LMA logging enabled: ${enableLMALogging} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 332 | Mgmt conformance testing scheduled: ${runMgmtConformance} |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 333 | LMA testing scheduled: ${runLMATest} |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 334 | Mgmt user controller testing scheduled: ${runMgmtUserControllerTest} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 335 | Mgmt UI e2e testing scheduled: ${runUie2e} |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 336 | Maintenance test: ${runMaintenanceTest} |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 337 | AWS provider deployment scheduled: ${awsOnDemandDemo} |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 338 | Equinix provider deployment scheduled: ${equinixOnDemandDemo} |
Владислав Наумов | 144956f | 2021-10-14 17:49:19 +0200 | [diff] [blame] | 339 | EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo} |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 340 | EquinixmetalV2 child deploy in a separate metro scheduled: ${equinixMetalV2ChildDiffMetro} |
Владислав Наумов | f1665b5 | 2021-05-13 10:51:17 +0200 | [diff] [blame] | 341 | Equinix@AWS child cluster deployment scheduled: ${equinixOnAwsDemo} |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 342 | Azure provider deployment scheduled: ${azureOnDemandDemo} |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 343 | Azure@AWS child cluster deployment scheduled: ${azureOnAwsDemo} |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 344 | VSPHERE provider deployment scheduled: ${enableVsphereDemo} |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 345 | OS provider deployment scheduled: ${enableOSDemo} |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 346 | BM provider deployment scheduled: ${enableBMDemo} |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 347 | Multiregional configuration: ${multiregionalMappings} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 348 | Service binaries fetching scheduled: ${fetchServiceBinaries} |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 349 | Current weight of the demo run: ${demoWeight} (Used to manage lockable resources) |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 350 | Triggers: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""") |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 351 | return [ |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 352 | osCloudLocation : openstackIMC, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 353 | cdnConfig : cdnConfig, |
| 354 | proxyConfig : proxyConfig, |
| 355 | useMacOsSeedNode : seedMacOs, |
| 356 | deployChildEnabled : deployChild, |
| 357 | childDeployCustomRelease : customChildRelease, |
| 358 | upgradeChildEnabled : upgradeChild, |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame^] | 359 | mosTfDeployEnabled : mosTfDeploy, |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 360 | mosDeployChildEnabled : mosDeployChild, |
| 361 | mosUpgradeChildEnabled : mosUpgradeChild, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 362 | runChildConformanceEnabled : runChildConformance, |
| 363 | attachBYOEnabled : attachBYO, |
| 364 | upgradeBYOEnabled : upgradeBYO, |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 365 | runBYOMatrixEnabled : runBYOMatrix, |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 366 | defaultBYOOs : defaultBYOOs, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 367 | upgradeMgmtEnabled : upgradeMgmt, |
| 368 | enableLMALoggingEnabled : enableLMALogging, |
| 369 | runUie2eEnabled : runUie2e, |
| 370 | runMgmtConformanceEnabled : runMgmtConformance, |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 371 | runMaintenanceTestEnable : runMaintenanceTest, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 372 | runLMATestEnabled : runLMATest, |
| 373 | runMgmtUserControllerTestEnabled : runMgmtUserControllerTest, |
| 374 | fetchServiceBinariesEnabled : fetchServiceBinaries, |
| 375 | awsOnDemandDemoEnabled : awsOnDemandDemo, |
| 376 | equinixOnDemandDemoEnabled : equinixOnDemandDemo, |
| 377 | equinixMetalV2OnDemandDemoEnabled : equinixMetalV2OnDemandDemo, |
| 378 | equinixMetalV2ChildDiffMetroEnabled : equinixMetalV2ChildDiffMetro, |
| 379 | equinixOnAwsDemoEnabled : equinixOnAwsDemo, |
| 380 | azureOnDemandDemoEnabled : azureOnDemandDemo, |
| 381 | azureOnAwsDemoEnabled : azureOnAwsDemo, |
| 382 | vsphereDemoEnabled : enableVsphereDemo, |
| 383 | vsphereOnDemandDemoEnabled : enableVsphereDemo, // TODO: remove after MCC 2.7 is out |
| 384 | bmDemoEnabled : enableBMDemo, |
| 385 | osDemoEnabled : enableOSDemo, |
| 386 | multiregionalConfiguration : multiregionalMappings, |
| 387 | demoWeight : demoWeight] |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | /** |
| 391 | * Determine management and regional setup for demo workflow scenario |
| 392 | * |
| 393 | * |
| 394 | * @param: keyword (string) string , represents keyworkd trigger, specified in gerrit commit body, like `[multiregion aws,os]` |
| 395 | or Jenkins environment string variable in form like 'aws,os' |
| 396 | * @return (map)[ |
| 397 | enabled: (bool), |
| 398 | * managementLocation: (string), //aws,os |
| 399 | * regionLocation: (string), //aws,os |
| 400 | * ] |
| 401 | */ |
| 402 | def multiregionWorkflowParser(keyword) { |
Владислав Наумов | 8c0c39d | 2020-09-11 14:46:48 +0200 | [diff] [blame] | 403 | def common = new com.mirantis.mk.Common() |
eromanova | 8c702ae | 2021-12-24 17:43:12 +0400 | [diff] [blame] | 404 | def supportedManagementProviders = ['os', 'aws', 'vsphere', 'equinix', 'equinixmetalv2', 'azure'] |
| 405 | def supportedRegionalProviders = ['os', 'vsphere', 'equinix', 'equinixmetalv2', 'bm', 'azure', 'aws'] |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 406 | |
| 407 | def clusterTypes = '' |
Владислав Наумов | 38ed7bf | 2020-09-11 14:43:39 +0200 | [diff] [blame] | 408 | if (keyword.toString().contains('multiregion')) { |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 409 | common.infoMsg('Multiregion definition configured via gerrit keyword trigger') |
| 410 | clusterTypes = keyword[0][0].split('multiregion')[1].replaceAll('[\\[\\]]', '').trim().split(',') |
| 411 | } else { |
| 412 | common.infoMsg('Multiregion definition configured via environment variable') |
| 413 | clusterTypes = keyword.trim().split(',') |
| 414 | } |
| 415 | |
| 416 | if (clusterTypes.size() != 2) { |
Владислав Наумов | 482fb50 | 2020-10-30 17:59:27 +0100 | [diff] [blame] | 417 | error("Incorrect regions definiton, valid scheme: [multiregion ${management}, ${region}], got: ${clusterTypes}") |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 418 | } |
| 419 | |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 420 | def desiredManagementProvider = clusterTypes[0].trim() |
| 421 | def desiredRegionalProvider = clusterTypes[1].trim() |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 422 | if (! supportedManagementProviders.contains(desiredManagementProvider) || ! supportedRegionalProviders.contains(desiredRegionalProvider)) { |
| 423 | error("""unsupported management <-> regional bundle, available options: |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 424 | management providers list - ${supportedManagementProviders} |
| 425 | regional providers list - ${supportedRegionalProviders}""") |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 426 | } |
| 427 | |
| 428 | return [ |
| 429 | enabled: true, |
| 430 | managementLocation: desiredManagementProvider, |
| 431 | regionLocation: desiredRegionalProvider, |
| 432 | ] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 433 | } |
| 434 | |
| 435 | /** |
| 436 | * Determine if custom si tests/pipelines refspec forwarded from gerrit change request |
| 437 | |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 438 | * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 439 | * Used for components team to test component changes w/ custom SI refspecs using kaas/core deployment jobs |
| 440 | * Example scheme: |
| 441 | * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| 442 | * manage refspecs through Jenkins Job Parameters |
| 443 | * |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 444 | * @return (map)[* siTests: (string) final refspec for si-tests |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 445 | * siPipelines: (string) final refspec for si-pipelines |
| 446 | * ] |
| 447 | */ |
| 448 | def checkCustomSIRefspec() { |
vnaumov | bdb9022 | 2020-05-04 18:25:50 +0200 | [diff] [blame] | 449 | def common = new com.mirantis.mk.Common() |
| 450 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 451 | // Available triggers and its sane defaults |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 452 | def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master' |
| 453 | def siPipelinesRefspec = env.SI_PIPELINES_REFSPEC ?: 'master' |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 454 | def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test' |
| 455 | def siTestsDockerImageTag = env.SI_TESTS_DOCKER_IMAGE_TAG ?: 'master' |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 456 | 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] | 457 | |
| 458 | def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/) |
| 459 | def siPipelinesMatches = (commitMsg =~ /(\[si-pipelines-ref\s*refs\/changes\/.*?\])/) |
| 460 | |
| 461 | if (siTestMatches.size() > 0) { |
| 462 | siTestsRefspec = siTestMatches[0][0].split('si-tests-ref')[1].replaceAll('[\\[\\]]', '').trim() |
Владислав Наумов | 7f6c088 | 2021-03-23 19:10:57 +0400 | [diff] [blame] | 463 | siTestsDockerImage = "docker-review-local.docker.mirantis.net/review/kaas-si-test-${siTestsRefspec.split('/')[-2]}" |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 464 | siTestsDockerImageTag = siTestsRefspec.split('/')[-1] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 465 | } |
| 466 | if (siPipelinesMatches.size() > 0) { |
| 467 | siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 468 | } |
| 469 | |
| 470 | common.infoMsg(""" |
| 471 | kaas/si-pipelines will be fetched from: ${siPipelinesRefspec} |
| 472 | kaas/si-tests will be fetched from: ${siTestsRefspec} |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 473 | kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}:${siTestsDockerImageTag} |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 474 | Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""") |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 475 | return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage, siTestsDockerImageTag: siTestsDockerImageTag] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 476 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 477 | |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 478 | /** |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 479 | * Parse additional configuration for kaas component CICD repo |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 480 | * @param configurationFile (str) path to configuration file in yaml format |
| 481 | * |
| 482 | * @return (map)[ siTestsFeatureFlags (string) dedicated feature flags that will be used in SI tests, |
| 483 | * ] |
| 484 | */ |
| 485 | def parseKaaSComponentCIParameters(configurationFile){ |
| 486 | def common = new com.mirantis.mk.Common() |
| 487 | def ciConfig = readYaml file: configurationFile |
| 488 | def ciSpec = [ |
| 489 | siTestsFeatureFlags: env.SI_TESTS_FEATURE_FLAGS ?: '', |
| 490 | ] |
| 491 | |
| 492 | if (ciConfig.containsKey('si-tests-feature-flags')) { |
| 493 | common.infoMsg("""SI tests feature flags customization detected, |
| 494 | results will be merged with existing flags: [${ciSpec['siTestsFeatureFlags']}] identification...""") |
| 495 | |
| 496 | def ffMeta = ciSpec['siTestsFeatureFlags'].tokenize(',').collect { it.trim() } |
| 497 | ffMeta.addAll(ciConfig['si-tests-feature-flags']) |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 498 | |
Владислав Наумов | cb5ffca | 2020-07-14 15:28:36 +0200 | [diff] [blame] | 499 | ciSpec['siTestsFeatureFlags'] = ffMeta.unique().join(',') |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 500 | common.infoMsg("SI tests custom feature flags: ${ciSpec['siTestsFeatureFlags']}") |
| 501 | } |
| 502 | |
| 503 | common.infoMsg("""Additional ci configuration parsed successfully: |
| 504 | siTestsFeatureFlags: ${ciSpec['siTestsFeatureFlags']}""") |
| 505 | return ciSpec |
| 506 | } |
| 507 | |
| 508 | /** |
| 509 | * Determine if custom kaas core/pipelines refspec forwarded from gerrit change request |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 510 | |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 511 | * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 512 | * Used for components team to test component changes w/ custom Core refspecs using kaas/core deployment jobs |
| 513 | * Example scheme: |
| 514 | * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| 515 | * manage refspecs through Jenkins Job Parameters |
| 516 | * |
| 517 | * @return (map)[ core: (string) final refspec for kaas/core |
| 518 | * corePipelines: (string) final refspec for pipelines in kaas/core |
| 519 | * ] |
| 520 | */ |
| 521 | def checkCustomCoreRefspec() { |
| 522 | def common = new com.mirantis.mk.Common() |
| 523 | |
| 524 | // Available triggers and its sane defaults |
| 525 | def coreRefspec = env.KAAS_CORE_REFSPEC ?: 'master' |
| 526 | // by default using value of GERRIT_REFSPEC parameter in *kaas/core jobs* |
| 527 | def corePipelinesRefspec = env.KAAS_PIPELINE_REFSPEC ?: '\$GERRIT_REFSPEC' |
| 528 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| 529 | |
| 530 | def coreMatches = (commitMsg =~ /(\[core-ref\s*refs\/changes\/.*?\])/) |
| 531 | def corePipelinesMatches = (commitMsg =~ /(\[core-pipelines-ref\s*refs\/changes\/.*?\])/) |
| 532 | |
| 533 | if (coreMatches.size() > 0) { |
| 534 | coreRefspec = coreMatches[0][0].split('core-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 535 | } |
| 536 | if (corePipelinesMatches.size() > 0) { |
| 537 | corePipelinesRefspec = corePipelinesMatches[0][0].split('core-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 538 | } |
| 539 | |
| 540 | common.infoMsg(""" |
| 541 | kaas/core will be fetched from: ${coreRefspec} |
| 542 | kaas/core pipelines will be fetched from: ${corePipelinesRefspec} |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 543 | Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""") |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 544 | return [core: coreRefspec, corePipelines: corePipelinesRefspec] |
| 545 | } |
| 546 | |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 547 | |
| 548 | /** |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 549 | * generate Jenkins Parameter objects from from text parameter with additonal kaas core context |
| 550 | * needed to forward inside kaas core set of jobs |
| 551 | * |
| 552 | * @param context (string) Representation of the string enviroment variables needed for kaas core jobs in yaml format |
| 553 | * @return (list)[ string(name: '', value: ''), |
| 554 | * ] |
| 555 | */ |
| 556 | def generateKaaSVarsFromContext(context) { |
| 557 | def common = new com.mirantis.mk.Common() |
| 558 | def parameters = [] |
| 559 | def config = readYaml text: context |
| 560 | |
| 561 | config.each { k,v -> |
| 562 | common.infoMsg("Custom KaaS Core context parameter: ${k}=${v}") |
| 563 | parameters.add(string(name: k, value: v)) |
| 564 | } |
| 565 | |
| 566 | return parameters |
| 567 | } |
| 568 | |
| 569 | /** |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 570 | * Trigger KaaS demo jobs based on AWS/OS providers with customized test suite, parsed from external sources (gerrit commit/jj vars) |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 571 | * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 572 | * Used for components team to test component changes w/ customized SI tests/refspecs using kaas/core deployment jobs |
| 573 | * |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 574 | * @param: component (string) component name [iam, lcm, stacklight] |
| 575 | * @param: patchSpec (string) Patch for kaas/cluster releases in json format |
| 576 | * @param: configurationFile (string) Additional file for component repo CI config in yaml format |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 577 | */ |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 578 | def triggerPatchedComponentDemo(component, patchSpec = '', configurationFile = '.ci-parameters.yaml', coreContext = '') { |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 579 | def common = new com.mirantis.mk.Common() |
| 580 | // Determine if custom trigger keywords forwarded from gerrit |
| 581 | def triggers = checkDeploymentTestSuite() |
| 582 | // Determine SI refspecs |
| 583 | def siRefspec = checkCustomSIRefspec() |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 584 | // Determine Core refspecs |
| 585 | def coreRefspec = checkCustomCoreRefspec() |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 586 | |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 587 | // Determine component repo ci configuration |
| 588 | def ciSpec = [:] |
| 589 | def componentFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: '' |
| 590 | if (fileExists(configurationFile)) { |
| 591 | common.infoMsg('Component CI configuration file detected, parsing...') |
| 592 | ciSpec = parseKaaSComponentCIParameters(configurationFile) |
| 593 | componentFeatureFlags = ciSpec['siTestsFeatureFlags'] |
| 594 | } else { |
| 595 | common.warningMsg('''Component CI configuration file is not exists, |
Владислав Наумов | c17dd55 | 2020-07-29 17:07:38 +0200 | [diff] [blame] | 596 | several code-management features may be unavailable, |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 597 | follow https://mirantis.jira.com/wiki/spaces/QA/pages/2310832276/SI-tests+feature+flags#%5BUpdated%5D-Using-a-feature-flag |
| 598 | to create the configuration file''') |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 599 | } |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 600 | |
| 601 | def platforms = [] |
| 602 | if (component == 'ipam' && triggers.vsphereDemoEnabled) { |
| 603 | // Currently only vsphere demo is required for IPAM component |
| 604 | platforms.add('vsphere') |
| 605 | } else { |
| 606 | if (triggers.osDemoEnabled) { |
| 607 | platforms.add('openstack') |
| 608 | } |
| 609 | if (triggers.awsOnDemandDemoEnabled) { |
| 610 | platforms.add('aws') |
| 611 | } |
| 612 | if (triggers.equinixOnDemandDemoEnabled) { |
| 613 | platforms.add('equinix') |
| 614 | } |
Владислав Наумов | 144956f | 2021-10-14 17:49:19 +0200 | [diff] [blame] | 615 | if (triggers.equinixMetalV2OnDemandDemoEnabled) { |
| 616 | platforms.add('equinixmetalv2') |
| 617 | } |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 618 | if (triggers.azureOnDemandDemoEnabled) { |
| 619 | platforms.add('azure') |
| 620 | } |
Ivan Berezovskiy | b0229d0 | 2021-05-17 16:55:18 +0400 | [diff] [blame] | 621 | if (triggers.vsphereDemoEnabled) { |
| 622 | platforms.add('vsphere') |
| 623 | } |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 624 | } |
| 625 | |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 626 | def jobs = [:] |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 627 | def parameters = [ |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 628 | string(name: 'GERRIT_REFSPEC', value: coreRefspec.core), |
| 629 | string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 630 | string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests), |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 631 | string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags), |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 632 | string(name: 'SI_TESTS_DOCKER_IMAGE', value: siRefspec.siTestsDockerImage), |
| 633 | string(name: 'SI_TESTS_DOCKER_IMAGE_TAG', value: siRefspec.siTestsDockerImageTag), |
Владислав Наумов | 4a5c324 | 2020-06-08 14:36:11 +0200 | [diff] [blame] | 634 | string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 635 | string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec), |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 636 | string(name: 'KAAS_CHILD_CLUSTER_RELEASE_NAME', value: triggers.childDeployCustomRelease), |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 637 | string(name: 'OPENSTACK_CLOUD_LOCATION', value: triggers.osCloudLocation), |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 638 | booleanParam(name: 'OFFLINE_MGMT_CLUSTER', value: triggers.proxyConfig['mgmtOffline']), |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 639 | booleanParam(name: 'OFFLINE_CHILD_CLUSTER', value: triggers.proxyConfig['childOffline']), |
Владислав Наумов | 257ea13 | 2021-04-14 14:44:13 +0200 | [diff] [blame] | 640 | booleanParam(name: 'PROXY_CHILD_CLUSTER', value: triggers.proxyConfig['childProxy']), |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 641 | booleanParam(name: 'SEED_MACOS', value: triggers.useMacOsSeedNode), |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame^] | 642 | booleanParam(name: 'MOS_TF_DEPLOY', value: triggers.mosTfDeployEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 643 | booleanParam(name: 'UPGRADE_MGMT_CLUSTER', value: triggers.upgradeMgmtEnabled), |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 644 | booleanParam(name: 'ENABLE_LMA_LOGGING', value: triggers.enableLMALoggingEnabled), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 645 | booleanParam(name: 'RUN_UI_E2E', value: triggers.runUie2eEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 646 | booleanParam(name: 'RUN_MGMT_CFM', value: triggers.runMgmtConformanceEnabled), |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 647 | booleanParam(name: 'RUN_MAINTENANCE_TEST', value: triggers.runMaintenanceTestEnable), |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 648 | booleanParam(name: 'RUN_LMA_TEST', value: triggers.runLMATestEnabled), |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 649 | booleanParam(name: 'RUN_MGMT_USER_CONTROLLER_TEST', value: triggers.runMgmtUserControllerTestEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 650 | booleanParam(name: 'DEPLOY_CHILD_CLUSTER', value: triggers.deployChildEnabled), |
| 651 | booleanParam(name: 'UPGRADE_CHILD_CLUSTER', value: triggers.upgradeChildEnabled), |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 652 | booleanParam(name: 'ATTACH_BYO', value: triggers.attachBYOEnabled), |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 653 | booleanParam(name: 'UPGRADE_BYO', value: triggers.upgradeBYOEnabled), |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 654 | booleanParam(name: 'RUN_BYO_MATRIX', value: triggers.runBYOMatrixEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 655 | booleanParam(name: 'RUN_CHILD_CFM', value: triggers.runChildConformanceEnabled), |
Ivan Berezovskiy | cbf9eeb | 2021-03-22 15:57:32 +0400 | [diff] [blame] | 656 | booleanParam(name: 'ALLOW_AWS_ON_DEMAND', value: triggers.awsOnDemandDemoEnabled), |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 657 | booleanParam(name: 'ALLOW_EQUINIX_ON_DEMAND', value: triggers.equinixOnDemandDemoEnabled), |
Владислав Наумов | 82305e9 | 2021-10-14 20:45:20 +0200 | [diff] [blame] | 658 | booleanParam(name: 'ALLOW_EQUINIXMETALV2_ON_DEMAND', value: triggers.equinixMetalV2OnDemandDemoEnabled), |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 659 | booleanParam(name: 'EQUINIXMETALV2_CHILD_DIFF_METRO', value: triggers.equinixMetalV2ChildDiffMetroEnabled), |
eromanova | d339751 | 2021-04-01 20:19:19 +0400 | [diff] [blame] | 660 | booleanParam(name: 'EQUINIX_ON_AWS_DEMO', value: triggers.equinixOnAwsDemoEnabled), |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 661 | booleanParam(name: 'ALLOW_AZURE_ON_DEMAND', value: triggers.azureOnDemandDemoEnabled), |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 662 | booleanParam(name: 'AZURE_ON_AWS_DEMO', value: triggers.azureOnAwsDemoEnabled), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 663 | ] |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 664 | |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 665 | // customize multiregional demo |
| 666 | if (triggers.multiregionalConfiguration.enabled) { |
| 667 | parameters.add(string(name: 'MULTIREGION_SETUP', |
| 668 | value: "${triggers.multiregionalConfiguration.managementLocation},${triggers.multiregionalConfiguration.regionLocation}" |
| 669 | )) |
| 670 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 671 | |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 672 | // Determine component team custom context |
| 673 | if (coreContext != '') { |
| 674 | common.infoMsg('Additional KaaS Core context detected, will be forwarded into kaas core cicd...') |
| 675 | def additionalParameters = generateKaaSVarsFromContext(coreContext) |
Владислав Наумов | bef51a9 | 2020-10-01 17:36:51 +0200 | [diff] [blame] | 676 | parameters.addAll(additionalParameters) |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 677 | } |
| 678 | |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 679 | def jobResults = [] |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 680 | |
| 681 | platforms.each { platform -> |
| 682 | jobs["kaas-core-${platform}-patched-${component}"] = { |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 683 | try { |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 684 | common.infoMsg("Deploy: patched KaaS demo with ${platform} provider") |
| 685 | def job_info = build job: "kaas-testing-core-${platform}-workflow-${component}", parameters: parameters, wait: true |
| 686 | def build_description = job_info.getDescription() |
| 687 | def build_result = job_info.getResult() |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 688 | jobResults.add(build_result) |
Владислав Наумов | d044e84 | 2020-06-17 15:33:43 +0200 | [diff] [blame] | 689 | |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 690 | if (build_description) { |
| 691 | currentBuild.description += build_description |
| 692 | } |
| 693 | } finally { |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 694 | common.infoMsg("Patched KaaS demo with ${platform} provider finished") |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 695 | } |
| 696 | } |
| 697 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 698 | |
| 699 | common.infoMsg('Trigger KaaS demo deployments according to defined provider set') |
Владислав Наумов | 37f7f84 | 2021-03-09 16:08:39 +0400 | [diff] [blame] | 700 | if (jobs.size() == 0) { |
| 701 | error('No demo jobs matched with keywords, execution will be aborted, at least 1 provider should be enabled') |
| 702 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 703 | // Limit build concurency workaround examples: https://issues.jenkins-ci.org/browse/JENKINS-44085 |
| 704 | parallel jobs |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 705 | |
| 706 | if (jobResults.contains('FAILURE')) { |
Владислав Наумов | f86b111 | 2020-06-09 14:04:48 +0200 | [diff] [blame] | 707 | common.infoMsg('One of parallel downstream jobs is failed, mark executor job as failed') |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 708 | currentBuild.result = 'FAILURE' |
| 709 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 710 | } |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 711 | |
| 712 | |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 713 | /** |
| 714 | * Function currently supported to be called from aws or vsphere demos. It gets particular demo context |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 715 | * and generate proper lockResources data and netMap data for vsphere,equinix related clusters. |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 716 | * |
| 717 | * @param: callBackDemo (string) Demo which requested to generate lockResources [aws or vsphere] |
| 718 | * @param: triggers (map) Custom trigger keywords forwarded from gerrit |
| 719 | * @param: multiregionalConfiguration (map) Multiregional configuration |
| 720 | * @return (map) Return aggregated map with lockResources and netMap |
| 721 | */ |
| 722 | |
| 723 | |
| 724 | def generateLockResources(callBackDemo, triggers) { |
| 725 | def common = new com.mirantis.mk.Common() |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 726 | def netMap = [ |
| 727 | vsphere: [:], |
| 728 | equinix: [:], |
| 729 | ] |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 730 | // Define vsphere locklabels with initial quantity |
| 731 | def lockLabels = [ |
| 732 | vsphere_networking_core_ci: 0, |
| 733 | vsphere_offline_networking_core_ci: 0, |
| 734 | ] |
| 735 | def deployChild = triggers.deployChildEnabled |
| 736 | def multiregionConfig = triggers.multiregionalConfiguration |
| 737 | def runMultiregion = multiregionConfig.enabled |
| 738 | |
| 739 | // Generate vsphere netMap and lockLabels based on demo context |
| 740 | switch (callBackDemo) { |
| 741 | case 'aws': |
| 742 | // Add aws specific lock label with quantity calculated based on single mgmt deploy or mgmt + child |
| 743 | lockLabels['aws_core_ci_queue'] = triggers.demoWeight |
Sergey Kolekonov | f4c1f49 | 2022-02-03 14:44:45 +0400 | [diff] [blame] | 744 | if (triggers.runBYOMatrixEnabled) { lockLabels['aws_core_ci_queue'] += 6 } |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 745 | |
| 746 | // Define netMap for Vsphere region |
Владислав Наумов | f60480d | 2021-10-15 14:04:01 +0200 | [diff] [blame] | 747 | if (runMultiregion && multiregionConfig.managementLocation == 'aws' && |
| 748 | multiregionConfig.regionLocation == 'vsphere') { |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 749 | if (deployChild) { |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 750 | addToProviderNetMap(netMap, 'vsphere', 'regional-child') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 751 | } |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 752 | addToProviderNetMap(netMap, 'vsphere', 'region') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 753 | } |
| 754 | break |
| 755 | case 'vsphere': |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 756 | addToProviderNetMap(netMap, 'vsphere', 'mgmt') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 757 | if (deployChild) { |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 758 | addToProviderNetMap(netMap, 'vsphere', 'child') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 759 | } |
| 760 | if (runMultiregion && multiregionConfig.managementLocation == 'vsphere' && |
| 761 | multiregionConfig.regionLocation == 'vsphere') { |
| 762 | if (deployChild) { |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 763 | addToProviderNetMap(netMap, 'vsphere', 'regional-child') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 764 | } |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 765 | addToProviderNetMap(netMap, 'vsphere', 'region') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 766 | } |
| 767 | break |
| 768 | default: |
| 769 | error('Supposed to be called from aws or vsphere demos only') |
| 770 | } |
| 771 | |
| 772 | // Checking gerrit triggers and manage lock label quantity and network types in case of Offline deployment |
| 773 | // Vsphere labels only |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 774 | netMap['vsphere'].each { clusterType, netConfig -> |
| 775 | if (triggers.proxyConfig["${clusterType}Offline"] == true || |
| 776 | (clusterType == 'regional-child' && triggers.proxyConfig['childOffline'] == true) || |
| 777 | (clusterType == 'region' && triggers.proxyConfig['mgmtOffline'])) { |
| 778 | |
| 779 | netMap['vsphere'][clusterType]['netName'] = 'offline' |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 780 | lockLabels['vsphere_offline_networking_core_ci']++ |
| 781 | } else { |
| 782 | lockLabels['vsphere_networking_core_ci']++ |
| 783 | } |
| 784 | } |
| 785 | |
| 786 | // generate lock metadata |
| 787 | def lockResources = [] |
| 788 | lockLabels.each { label, quantity -> |
| 789 | if (quantity > 0) { |
| 790 | def res = [ |
| 791 | label: label, |
| 792 | quantity: quantity, |
| 793 | ] |
| 794 | lockResources.add(res) |
| 795 | } |
| 796 | } |
| 797 | |
| 798 | common.infoMsg("""Generated vsphere netMap: ${netMap} |
| 799 | Generated lockResources: ${lockResources}""") |
| 800 | |
| 801 | return [ |
| 802 | netMap: netMap, |
| 803 | lockResources: lockResources, |
| 804 | ] |
| 805 | } |
| 806 | |
| 807 | /** |
| 808 | * Function gets vsphere netMap or empty map and adds new vsphere clusterType with default netName |
| 809 | * and empty rangeConfig to the this map. |
| 810 | * |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 811 | * @param: netMap (string) vsphere, equinix netMap or empty map |
| 812 | * @param: provider (string) provider type |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 813 | * @param: clusterType (string) Vsphere cluster type |
| 814 | */ |
| 815 | |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 816 | def addToProviderNetMap (netMap, provider, clusterType) { |
| 817 | switch (provider) { |
| 818 | case 'equinix': |
| 819 | netMap[provider][clusterType] = [ |
| 820 | vlanConfig: '', |
| 821 | ] |
| 822 | break |
| 823 | case 'vsphere': |
| 824 | netMap[provider][clusterType] = [ |
| 825 | netName: 'default', |
| 826 | rangeConfig: '', |
| 827 | ] |
| 828 | break |
| 829 | default: |
| 830 | error('Net map locks supported for Equinix/Vsphere providers only') |
| 831 | } |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 832 | } |