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 | |
azvyagintsev | c17d14b | 2022-06-06 19:06:33 +0300 | [diff] [blame] | 3 | import static groovy.json.JsonOutput.toJson |
| 4 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 5 | /** |
| 6 | * |
| 7 | * KaaS Component Testing Utilities |
| 8 | * |
| 9 | */ |
| 10 | |
Владислав Наумов | e534581 | 2020-08-12 16:30:20 +0200 | [diff] [blame] | 11 | /** |
| 12 | * Check KaaS Core CICD feature flags |
| 13 | * such triggers can be used in case of switching between pipelines, |
| 14 | * conditions inside pipelines to reduce dependency on jenkins job builder and jenkins job templates itself |
| 15 | * |
| 16 | * @return (map)[ |
| 17 | * ffNameEnabled: (bool) True/False |
| 18 | * ] |
| 19 | */ |
| 20 | def checkCoreCIFeatureFlags() { |
| 21 | def common = new com.mirantis.mk.Common() |
| 22 | def ff = [ |
| 23 | build_artifacts_upgrade: false, |
| 24 | ] |
| 25 | |
| 26 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| 27 | if (commitMsg ==~ /(?s).*\[ci-build-artifacts-upgrade\].*/) { |
| 28 | ff['build_artifacts_upgrade'] = true |
| 29 | } |
| 30 | |
| 31 | common.infoMsg("Core ci feature flags status: ${ff}") |
| 32 | return ff |
| 33 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 34 | |
| 35 | /** |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 36 | * Determine scope of test suite against per-commit KaaS deployment based on keywords |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 37 | * 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] | 38 | * |
| 39 | * Used for components team to combine test-suites and forward desired parameters to kaas/core deployment jobs |
| 40 | * Example scheme: |
Владислав Наумов | e534581 | 2020-08-12 16:30:20 +0200 | [diff] [blame] | 41 | * 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] | 42 | * manage test-suite through Jenkins Job Parameters |
| 43 | * |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 44 | * @return (map)[ |
| 45 | * deployChildEnabled: (bool) True if need to deploy child cluster during demo-run |
| 46 | * runUie2eEnabled: (bool) True if need to run ui-e2e cluster during demo-run |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 47 | * ] |
| 48 | */ |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 49 | def checkDeploymentTestSuite() { |
vnaumov | bdb9022 | 2020-05-04 18:25:50 +0200 | [diff] [blame] | 50 | def common = new com.mirantis.mk.Common() |
| 51 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 52 | // Available triggers and its sane defaults |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 53 | def seedMacOs = env.SEED_MACOS ? env.SEED_MACOS.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 54 | def deployChild = env.DEPLOY_CHILD_CLUSTER ? env.DEPLOY_CHILD_CLUSTER.toBoolean() : false |
| 55 | def upgradeChild = env.UPGRADE_CHILD_CLUSTER ? env.UPGRADE_CHILD_CLUSTER.toBoolean() : false |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 56 | def mosDeployChild = env.DEPLOY_MOS_CHILD_CLUSTER ? env.DEPLOY_MOS_CHILD_CLUSTER.toBoolean() : false |
| 57 | 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] | 58 | 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] | 59 | def mosTfDeploy = env.MOS_TF_DEPLOY ? env.MOS_TF_DEPLOY.toBoolean() : false |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 60 | def attachBYO = env.ATTACH_BYO ? env.ATTACH_BYO.toBoolean() : false |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 61 | def upgradeBYO = env.UPGRADE_BYO ? env.UPGRADE_BYO.toBoolean() : false |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 62 | def runBYOMatrix = env.RUN_BYO_MATRIX ? env.RUN_BYO_MATRIX.toBoolean() : false |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 63 | def defaultBYOOs = env.DEFAULT_BYO_OS ? env.DEFAULT_BYO_OS.toString() : 'ubuntu' |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 64 | def upgradeMgmt = env.UPGRADE_MGMT_CLUSTER ? env.UPGRADE_MGMT_CLUSTER.toBoolean() : false |
slalov | 1202bba | 2022-04-20 22:31:07 +0400 | [diff] [blame] | 65 | def autoUpgradeMgmt = env.AUTO_UPGRADE_MCC ? env.AUTO_UPGRADE_MCC.toBoolean() : false |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 66 | def enableLMALogging = env.ENABLE_LMA_LOGGING ? env.ENABLE_LMA_LOGGING.toBoolean(): false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 67 | def runUie2e = env.RUN_UI_E2E ? env.RUN_UI_E2E.toBoolean() : false |
Mikhail Ivanov | f5e20af | 2022-03-24 15:38:06 +0400 | [diff] [blame] | 68 | def runUie2eNew = env.RUN_UI_E2E_NEW ? env.RUN_UI_E2E_NEW.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 69 | def runMgmtConformance = env.RUN_MGMT_CFM ? env.RUN_MGMT_CFM.toBoolean() : false |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 70 | def runLMATest = env.RUN_LMA_TEST ? env.RUN_LMA_TEST.toBoolean() : false |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 71 | def runMgmtUserControllerTest = env.RUN_MGMT_USER_CONTROLLER_TEST ? env.RUN_MGMT_USER_CONTROLLER_TEST.toBoolean() : false |
Mikhail Ivanov | 2907e4d | 2022-04-25 16:41:21 +0400 | [diff] [blame] | 72 | def runProxyChildTest = env.RUN_PROXY_CHILD_TEST ? env.RUN_PROXY_CHILD_TEST.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 73 | def runChildConformance = env.RUN_CHILD_CFM ? env.RUN_CHILD_CFM.toBoolean() : false |
| 74 | 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] | 75 | 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] | 76 | def runMaintenanceTest = env.RUN_MAINTENANCE_TEST ? env.RUN_MAINTENANCE_TEST.toBoolean() : false |
slalov | 0a4947a | 2022-06-09 15:44:35 +0400 | [diff] [blame] | 77 | def runContainerregistryTest = env.RUN_CONTAINER_REGISTRY_TEST ? env.RUN_CONTAINER_REGISTRY_TEST.toBoolean() : false |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 78 | def runMgmtDeleteMasterTest = env.RUN_MGMT_DELETE_MASTER_TEST ? env.RUN_MGMT_DELETE_MASTER_TEST.toBoolean() : false |
| 79 | def runRgnlDeleteMasterTest = env.RUN_RGNL_DELETE_MASTER_TEST ? env.RUN_RGNL_DELETE_MASTER_TEST.toBoolean() : false |
| 80 | def runChildDeleteMasterTest = env.RUN_CHILD_DELETE_MASTER_TEST ? env.RUN_CHILD_DELETE_MASTER_TEST.toBoolean() : false |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 81 | // multiregion configuration from env variable: comma-separated string in form $mgmt_provider,$regional_provider |
| 82 | def multiregionalMappings = env.MULTIREGION_SETUP ? multiregionWorkflowParser(env.MULTIREGION_SETUP) : [ |
| 83 | enabled: false, |
| 84 | managementLocation: '', |
| 85 | regionLocation: '', |
| 86 | ] |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 87 | |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 88 | // proxy customization |
| 89 | def proxyConfig = [ |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 90 | mgmtOffline: env.OFFLINE_MGMT_CLUSTER ? env.OFFLINE_MGMT_CLUSTER.toBoolean() : false, |
| 91 | childOffline: env.OFFLINE_CHILD_CLUSTER ? env.OFFLINE_CHILD_CLUSTER.toBoolean() : false, |
Владислав Наумов | 257ea13 | 2021-04-14 14:44:13 +0200 | [diff] [blame] | 92 | childProxy: env.PROXY_CHILD_CLUSTER ? env.PROXY_CHILD_CLUSTER.toBoolean() : false, |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 93 | ] |
| 94 | |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 95 | // optional demo deployment customization |
Владислав Наумов | 905dd36 | 2020-06-08 16:37:01 +0200 | [diff] [blame] | 96 | def awsOnDemandDemo = env.ALLOW_AWS_ON_DEMAND ? env.ALLOW_AWS_ON_DEMAND.toBoolean() : false |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 97 | def equinixOnDemandDemo = env.ALLOW_EQUINIX_ON_DEMAND ? env.ALLOW_EQUINIX_ON_DEMAND.toBoolean() : false |
Владислав Наумов | 82305e9 | 2021-10-14 20:45:20 +0200 | [diff] [blame] | 98 | def equinixMetalV2OnDemandDemo = env.ALLOW_EQUINIXMETALV2_ON_DEMAND ? env.ALLOW_EQUINIXMETALV2_ON_DEMAND.toBoolean() : false |
Владислав Наумов | f371580 | 2021-05-03 18:06:45 +0200 | [diff] [blame] | 99 | def equinixOnAwsDemo = env.EQUINIX_ON_AWS_DEMO ? env.EQUINIX_ON_AWS_DEMO.toBoolean() : false |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 100 | def azureOnAwsDemo = env.AZURE_ON_AWS_DEMO ? env.AZURE_ON_AWS_DEMO.toBoolean() : false |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 101 | 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] | 102 | def enableVsphereDemo = true |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 103 | def enableOSDemo = true |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 104 | def enableBMDemo = true |
Mikhail Ivanov | bd1a9fd | 2022-03-29 21:36:21 +0400 | [diff] [blame] | 105 | def enableArtifactsBuild = true |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 106 | def openstackIMC = env.OPENSTACK_CLOUD_LOCATION ? env.OPENSTACK_CLOUD_LOCATION : 'us' |
Alexandr Lovtsov | 36473f3 | 2022-04-28 15:46:09 +0300 | [diff] [blame] | 107 | def enableVsphereUbuntu = env.VSPHERE_DEPLOY_UBUNTU ? env.VSPHERE_DEPLOY_UBUNTU.toBoolean() : false |
Sergey Zhemerdeev | e67fb26 | 2022-06-21 00:49:34 +0300 | [diff] [blame] | 108 | def childOsBootFromVolume = env.OPENSTACK_BOOT_FROM_VOLUME ? env.OPENSTACK_BOOT_FROM_VOLUME.toBoolean() : false |
Ivan Berezovskiy | 29e72b7 | 2022-07-12 21:03:24 +0400 | [diff] [blame] | 109 | def bootstrapV2Scenario = env.BOOTSTRAP_V2_ENABLED ? env.BOOTSTRAP_V2_ENABLED.toBoolean() : false |
Sergey Lalov | acec3c1 | 2022-07-20 16:00:14 +0400 | [diff] [blame] | 110 | def equinixMetalV2Metro = env.EQUINIX_MGMT_METRO ? env.EQUINIX_MGMT_METRO : '' |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 111 | |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 112 | 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] | 113 | if (commitMsg ==~ /(?s).*\[mgmt-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-proxy.*/) { |
| 114 | proxyConfig['mgmtOffline'] = true |
Владислав Наумов | 70c0242 | 2021-04-19 14:29:41 +0200 | [diff] [blame] | 115 | 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] | 116 | } |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 117 | if (commitMsg ==~ /(?s).*\[seed-macos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*seed-macos.*/) { |
| 118 | seedMacOs = true |
| 119 | } |
slalov | 574123e | 2022-04-06 17:24:19 +0400 | [diff] [blame] | 120 | if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ || upgradeChild || runChildConformance || runProxyChildTest) { |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 121 | deployChild = true |
| 122 | } |
| 123 | if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) { |
| 124 | deployChild = true |
| 125 | upgradeChild = true |
| 126 | } |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 127 | def childDeployMatches = (commitMsg =~ /(\[child-deploy\s*(\w|\-)+?\])/) |
| 128 | if (childDeployMatches.size() > 0) { |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 129 | // override child version when it set explicitly |
| 130 | deployChild = true |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 131 | customChildRelease = childDeployMatches[0][0].split('child-deploy')[1].replaceAll('[\\[\\]]', '').trim() |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 132 | common.warningMsg("Forced child deployment using custom release version ${customChildRelease}") |
| 133 | } |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 134 | if (commitMsg ==~ /(?s).*\[mos-child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-deploy.*/) { |
| 135 | mosDeployChild = true |
| 136 | } |
| 137 | if (commitMsg ==~ /(?s).*\[mos-child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-upgrade.*/) { |
| 138 | mosDeployChild = true |
| 139 | mosUpgradeChild = true |
| 140 | } |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 141 | if (commitMsg ==~ /(?s).*\[byo-attach\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-attach.*/) { |
| 142 | attachBYO = true |
| 143 | } |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 144 | if (commitMsg ==~ /(?s).*\[byo-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-upgrade.*/) { |
| 145 | attachBYO = true |
| 146 | upgradeBYO = true |
| 147 | } |
Sergey Lalov | acec3c1 | 2022-07-20 16:00:14 +0400 | [diff] [blame] | 148 | if (commitMsg ==~ /(?s).*\[ui-test-on-all-providers\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-test-on-all-providers.*/) { |
| 149 | enableVsphereDemo = true |
| 150 | enableOSDemo = true |
| 151 | awsOnDemandDemo = true |
| 152 | azureOnDemandDemo = true |
| 153 | equinixOnDemandDemo = true |
| 154 | equinixMetalV2OnDemandDemo = true |
| 155 | runUie2e = true |
| 156 | equinixMetalV2Metro = 'sv' |
| 157 | // Edit after fix PRODX-3961 |
| 158 | enableBMDemo = false |
| 159 | } |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 160 | def byoDeployMatches = (commitMsg =~ /(\[run-byo-matrix\s*(ubuntu|centos)\])/) |
| 161 | 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] | 162 | runBYOMatrix = true |
| 163 | |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 164 | if (byoDeployMatches.size() > 0) { |
| 165 | defaultBYOOs = byoDeployMatches[0][2] |
| 166 | common.warningMsg("Custom BYO OS detected, using ${defaultBYOOs}") |
| 167 | } |
| 168 | |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 169 | common.warningMsg('Forced byo matrix test via run-byo-matrix, all other byo triggers will be skipped') |
| 170 | attachBYO = false |
| 171 | upgradeBYO = false |
| 172 | } |
Владислав Наумов | 7f8c987 | 2021-03-08 17:33:08 +0400 | [diff] [blame] | 173 | if (commitMsg ==~ /(?s).*\[mgmt-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-upgrade.*/) { |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 174 | upgradeMgmt = true |
| 175 | } |
slalov | 1202bba | 2022-04-20 22:31:07 +0400 | [diff] [blame] | 176 | if (commitMsg ==~ /(?s).*\[auto-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*auto-upgrade.*/) { |
| 177 | autoUpgradeMgmt = true |
| 178 | } |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 179 | if (commitMsg ==~ /(?s).*\[lma-logging\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-logging.*/) { |
| 180 | enableLMALogging = true |
| 181 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 182 | if (commitMsg ==~ /(?s).*\[ui-e2e\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e.*/) { |
| 183 | runUie2e = true |
| 184 | } |
Mikhail Ivanov | f5e20af | 2022-03-24 15:38:06 +0400 | [diff] [blame] | 185 | if (commitMsg ==~ /(?s).*\[ui-e2e-new\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-new.*/) { |
| 186 | runUie2eNew = true |
| 187 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 188 | if (commitMsg ==~ /(?s).*\[mgmt-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm.*/) { |
| 189 | runMgmtConformance = true |
| 190 | } |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 191 | if (commitMsg ==~ /(?s).*\[test-user-controller\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-user-controller.*/) { |
| 192 | runMgmtUserControllerTest = true |
| 193 | } |
slalov | 574123e | 2022-04-06 17:24:19 +0400 | [diff] [blame] | 194 | if (commitMsg ==~ /(?s).*\[test-proxy-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-proxy-child.*/) { |
| 195 | runProxyChildTest = true |
| 196 | deployChild = true |
| 197 | common.infoMsg('Child cluster deployment will be enabled since proxy child test suite will be executed') |
| 198 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 199 | if (commitMsg ==~ /(?s).*\[child-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm.*/) { |
| 200 | runChildConformance = true |
| 201 | deployChild = true |
| 202 | } |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 203 | if (commitMsg ==~ /(?s).*\[lma-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-test.*/) { |
| 204 | runLMATest = true |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 205 | enableLMALogging = true |
| 206 | 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] | 207 | } |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 208 | if (commitMsg ==~ /(?s).*\[maintenance-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*maintenance-test.*/) { |
| 209 | runMaintenanceTest = true |
| 210 | } |
slalov | 0a4947a | 2022-06-09 15:44:35 +0400 | [diff] [blame] | 211 | if (commitMsg ==~ /(?s).*\[container-registry-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*container-registry-test.*/) { |
| 212 | runContainerregistryTest = true |
| 213 | } |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 214 | if (commitMsg ==~ /(?s).*\[mgmt-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-delete-master-test.*/) { |
| 215 | runMgmtDeleteMasterTest = true |
| 216 | } |
| 217 | if (commitMsg ==~ /(?s).*\[rgnl-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*rgnl-delete-master-test.*/) { |
| 218 | runRgnlDeleteMasterTest = true |
| 219 | } |
| 220 | if (commitMsg ==~ /(?s).*\[child-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-delete-master-test.*/) { |
| 221 | runChildDeleteMasterTest = true |
| 222 | } |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 223 | if (commitMsg ==~ /(?s).*\[child-offline\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-offline.*/) { |
| 224 | proxyConfig['childOffline'] = true |
| 225 | deployChild = true |
| 226 | } |
Владислав Наумов | 257ea13 | 2021-04-14 14:44:13 +0200 | [diff] [blame] | 227 | if (commitMsg ==~ /(?s).*\[child-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-proxy.*/) { |
| 228 | proxyConfig['childOffline'] = true |
| 229 | proxyConfig['childProxy'] = true |
| 230 | deployChild = true |
| 231 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 232 | if (commitMsg ==~ /(?s).*\[fetch.*binaries\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*fetch.*binaries.*/) { |
| 233 | fetchServiceBinaries = true |
| 234 | } |
Владислав Наумов | f1665b5 | 2021-05-13 10:51:17 +0200 | [diff] [blame] | 235 | 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] | 236 | equinixOnAwsDemo = true |
Владислав Наумов | f1665b5 | 2021-05-13 10:51:17 +0200 | [diff] [blame] | 237 | 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] | 238 | } |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 239 | if (commitMsg ==~ /(?s).*\[azure-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-on-aws.*/) { |
| 240 | azureOnAwsDemo = true |
| 241 | common.warningMsg('Forced running child cluster deployment on Azure provider based on AWS management cluster, triggered on patchset using custom keyword: \'[azure-on-aws]\' ') |
| 242 | } |
| 243 | if (commitMsg ==~ /(?s).*\[aws-demo\].*/ || |
| 244 | env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aws-demo.*/ || |
| 245 | attachBYO || |
| 246 | upgradeBYO || |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 247 | runBYOMatrix || |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 248 | seedMacOs || |
| 249 | equinixOnAwsDemo || |
| 250 | azureOnAwsDemo) { |
| 251 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 252 | awsOnDemandDemo = true |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 253 | 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] | 254 | } |
Владислав Наумов | f1665b5 | 2021-05-13 10:51:17 +0200 | [diff] [blame] | 255 | if (commitMsg ==~ /(?s).*\[equinix-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-demo\.*/) { |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 256 | equinixOnDemandDemo = true |
| 257 | } |
Владислав Наумов | 82305e9 | 2021-10-14 20:45:20 +0200 | [diff] [blame] | 258 | if (commitMsg ==~ /(?s).*\[equinixmetalv2-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-demo\.*/) { |
Владислав Наумов | 144956f | 2021-10-14 17:49:19 +0200 | [diff] [blame] | 259 | equinixMetalV2OnDemandDemo = true |
| 260 | } |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 261 | if (commitMsg ==~ /(?s).*\[equinixmetalv2-child-diff-metro\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-child-diff-metro\.*/) { |
| 262 | equinixMetalV2OnDemandDemo = true |
| 263 | equinixMetalV2ChildDiffMetro = true |
| 264 | } |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 265 | if (commitMsg ==~ /(?s).*\[azure-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-demo\.*/) { |
| 266 | azureOnDemandDemo = true |
| 267 | } |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 268 | if (commitMsg ==~ /(?s).*\[disable-os-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-os-demo\.*/) { |
| 269 | enableOSDemo = false |
| 270 | common.errorMsg('Openstack demo deployment will be aborted, VF -1 will be set') |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 271 | } |
| 272 | |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 273 | if (commitMsg ==~ /(?s).*\[disable-bm-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-demo\.*/) { |
| 274 | enableBMDemo = false |
| 275 | common.errorMsg('BM demo deployment will be aborted, VF -1 will be set') |
| 276 | } |
| 277 | |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 278 | if (commitMsg ==~ /(?s).*\[disable-vsphere-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-vsphere-demo\.*/) { |
| 279 | enableVsphereDemo = false |
| 280 | common.errorMsg('vSphere demo deployment will be aborted, VF -1 will be set') |
| 281 | } |
Alexandr Lovtsov | 36473f3 | 2022-04-28 15:46:09 +0300 | [diff] [blame] | 282 | if (commitMsg ==~ /(?s).*\[vsphere-ubuntu\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-ubuntu\.*/) { |
| 283 | enableVsphereUbuntu = true |
| 284 | common.warningMsg('Ubuntu will be used to deploy vsphere machines') |
| 285 | } |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 286 | |
Mikhail Ivanov | bd1a9fd | 2022-03-29 21:36:21 +0400 | [diff] [blame] | 287 | if (commitMsg ==~ /(?s).*\[disable-artifacts-build\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-artifacts-build\.*/) { |
| 288 | enableArtifactsBuild = false |
| 289 | common.errorMsg('artifacts build will be aborted, VF -1 will be set') |
| 290 | } |
| 291 | |
Sergey Zhemerdeev | e67fb26 | 2022-06-21 00:49:34 +0300 | [diff] [blame] | 292 | if (commitMsg ==~ /(?s).*\[child-os-boot-from-volume\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-os-boot-from-volume\.*/) { |
| 293 | childOsBootFromVolume = true |
| 294 | common.warningMsg('OS will be booted from Ceph volumes') |
| 295 | } |
| 296 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 297 | // TODO (vnaumov) remove below condition after moving all releases to UCP |
| 298 | def ucpChildMatches = (commitMsg =~ /(\[child-ucp\s*ucp-.*?\])/) |
| 299 | if (ucpChildMatches.size() > 0) { |
| 300 | deployChild = true |
| 301 | common.warningMsg('Forced UCP based child deployment triggered on patchset using custom keyword: \'[child-ucp ucp-5-1-0-3-3-0-example]\' ') |
| 302 | |
| 303 | // TODO(vnaumov) delete after ucp upgrades support |
| 304 | common.errorMsg('Child upgrade test will be skipped, UCP upgrades temporally disabled') |
| 305 | upgradeChild = false |
| 306 | } |
| 307 | |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 308 | // multiregional tests |
| 309 | def multiRegionalMatches = (commitMsg =~ /(\[multiregion\s*.*?\])/) |
| 310 | if (multiRegionalMatches.size() > 0) { |
| 311 | multiregionalMappings = multiregionWorkflowParser(multiRegionalMatches) |
| 312 | } |
| 313 | switch (multiregionalMappings['managementLocation']) { |
| 314 | case 'aws': |
Владислав Наумов | 53b07e5 | 2021-01-07 15:08:27 +0100 | [diff] [blame] | 315 | common.warningMsg('Forced running additional kaas deployment with AWS provider according multiregional demo request') |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 316 | awsOnDemandDemo = true |
Владислав Наумов | 53b07e5 | 2021-01-07 15:08:27 +0100 | [diff] [blame] | 317 | |
| 318 | if (multiregionalMappings['regionLocation'] != 'aws' && seedMacOs) { // macstadium seed node has access only to *public* providers |
| 319 | error('incompatible triggers: [seed-macos] and multiregional deployment based on *private* regional provider cannot be applied simultaneously') |
| 320 | } |
Владислав Наумов | 3e4b5a3 | 2020-09-11 17:05:34 +0200 | [diff] [blame] | 321 | break |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 322 | case 'os': |
| 323 | if (enableOSDemo == false) { |
| 324 | error('incompatible triggers: [disable-os-demo] and multiregional deployment based on OSt management region cannot be applied simultaneously') |
| 325 | } |
Владислав Наумов | 3e4b5a3 | 2020-09-11 17:05:34 +0200 | [diff] [blame] | 326 | break |
Владислав Наумов | 865ba6c | 2021-05-13 13:05:45 +0200 | [diff] [blame] | 327 | case 'vsphere': |
| 328 | if (enableVsphereDemo == false) { |
| 329 | error('incompatible triggers: [disable-vsphere-demo] and multiregional deployment based on Vsphere management region cannot be applied simultaneously') |
| 330 | } |
| 331 | break |
Владислав Наумов | 5be0294 | 2021-05-13 12:34:37 +0200 | [diff] [blame] | 332 | case 'equinix': |
| 333 | common.warningMsg('Forced running additional kaas deployment with Equinix provider according multiregional demo request') |
| 334 | equinixOnDemandDemo = true |
eromanova | 3535916 | 2021-12-30 14:13:13 +0400 | [diff] [blame] | 335 | break |
eromanova | 8c702ae | 2021-12-24 17:43:12 +0400 | [diff] [blame] | 336 | case 'equinixmetalv2': |
| 337 | common.warningMsg('Forced running additional kaas deployment with Equinix Metal V2 provider according multiregional demo request') |
| 338 | equinixMetalV2OnDemandDemo = true |
eromanova | 3535916 | 2021-12-30 14:13:13 +0400 | [diff] [blame] | 339 | break |
slalov | fd0b7e6 | 2021-07-28 18:05:16 +0400 | [diff] [blame] | 340 | case 'azure': |
| 341 | common.warningMsg('Forced running additional kaas deployment with Azure provider according multiregional demo request') |
| 342 | azureOnDemandDemo = true |
| 343 | break |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 344 | } |
| 345 | |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 346 | // CDN configuration |
| 347 | def cdnConfig = [ |
| 348 | mgmt: [ |
| 349 | openstack: (proxyConfig['mgmtOffline'] == true) ? 'public-ci' : 'internal-ci', |
Владислав Наумов | 70c0242 | 2021-04-19 14:29:41 +0200 | [diff] [blame] | 350 | vsphere: 'internal-ci', |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 351 | aws: 'public-ci', |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 352 | equinix: 'public-ci', |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 353 | azure: 'public-ci', |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 354 | ], |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 355 | ] |
| 356 | |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 357 | if (commitMsg ==~ /(?s).*\[eu-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*eu-demo.*/) { |
| 358 | openstackIMC = 'eu' |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 359 | } |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame] | 360 | if (commitMsg ==~ /(?s).*\[mos-tf-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-tf-demo.*/) { |
| 361 | openstackIMC = 'eu2' |
Mikhail Ivanov | f05b825 | 2022-04-27 18:14:03 +0400 | [diff] [blame] | 362 | } |
| 363 | if (openstackIMC == 'eu' || openstackIMC == 'eu2') { |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame] | 364 | // use internal-eu because on internal-ci with eu cloud image pull takes much time |
| 365 | def cdnRegion = (proxyConfig['mgmtOffline'] == true) ? 'public-ci' : 'internal-eu' |
| 366 | common.infoMsg("eu2-demo was triggered, force switching CDN region to ${cdnRegion}") |
| 367 | cdnConfig['mgmt']['openstack'] = cdnRegion |
| 368 | } |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 369 | |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 370 | // calculate weight of current demo run to manage lockable resources |
Sergey Lalov | 86dce29 | 2022-07-20 11:41:19 +0400 | [diff] [blame] | 371 | def demoWeight = (deployChild || runUie2e) ? 2 : 1 // management = 1, child = 1 |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 372 | |
Ivan Berezovskiy | 29e72b7 | 2022-07-12 21:03:24 +0400 | [diff] [blame] | 373 | if (commitMsg ==~ /(?s).*\[bootstrapv2-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv2-scenario\.*/) { |
| 374 | bootstrapV2Scenario = true |
| 375 | } |
| 376 | |
Sergey Zhemerdeev | dd31ce9 | 2022-07-19 14:15:22 +0300 | [diff] [blame] | 377 | // parse equinixmetalv2-metro trigger |
Sergey Zhemerdeev | dd31ce9 | 2022-07-19 14:15:22 +0300 | [diff] [blame] | 378 | def equinixMetalV2MetroMatcher = (commitMsg =~ /\[equinixmetalv2-metro(\s+.*)?\]/) |
| 379 | if (equinixMetalV2OnDemandDemo && equinixMetalV2MetroMatcher.size() > 0) { |
Sergey Zhemerdeev | cc785e4 | 2022-07-22 17:15:47 +0300 | [diff] [blame] | 380 | equinixMetalV2Metro = equinixMetalV2MetroMatcher[0][1].trim().toLowerCase() |
Sergey Zhemerdeev | dd31ce9 | 2022-07-19 14:15:22 +0300 | [diff] [blame] | 381 | common.infoMsg("Forced Equnix mgmt deployment using custom metro ${equinixMetalV2Metro}") |
| 382 | } |
| 383 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 384 | common.infoMsg(""" |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 385 | OpenStack Cloud location: ${openstackIMC} |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 386 | CDN deployment configuration: ${cdnConfig} |
| 387 | MCC offline deployment configuration: ${proxyConfig} |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 388 | Use MacOS node as seed: ${seedMacOs} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 389 | Child cluster deployment scheduled: ${deployChild} |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 390 | Custom child cluster release: ${customChildRelease} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 391 | Child cluster release upgrade scheduled: ${upgradeChild} |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 392 | MOS child deploy scheduled: ${mosDeployChild} |
| 393 | MOS child upgrade scheduled: ${mosUpgradeChild} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 394 | Child conformance testing scheduled: ${runChildConformance} |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 395 | Single BYO cluster attachment scheduled: ${attachBYO} |
| 396 | Single Attached BYO cluster upgrade test scheduled: ${upgradeBYO} |
| 397 | BYO test matrix whole suite scheduled: ${runBYOMatrix} |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 398 | Default BYO OS: ${defaultBYOOs} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 399 | Mgmt cluster release upgrade scheduled: ${upgradeMgmt} |
slalov | 1202bba | 2022-04-20 22:31:07 +0400 | [diff] [blame] | 400 | Mgmt cluster release auto upgrade scheduled: ${autoUpgradeMgmt} |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 401 | Mgmt LMA logging enabled: ${enableLMALogging} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 402 | Mgmt conformance testing scheduled: ${runMgmtConformance} |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 403 | LMA testing scheduled: ${runLMATest} |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 404 | Mgmt user controller testing scheduled: ${runMgmtUserControllerTest} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 405 | Mgmt UI e2e testing scheduled: ${runUie2e} |
Mikhail Ivanov | f5e20af | 2022-03-24 15:38:06 +0400 | [diff] [blame] | 406 | Mgmt UI e2e playwrite testing scheduled: ${runUie2eNew} |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 407 | Maintenance test: ${runMaintenanceTest} |
slalov | 0a4947a | 2022-06-09 15:44:35 +0400 | [diff] [blame] | 408 | Container Registry test: ${runContainerregistryTest} |
slalov | 574123e | 2022-04-06 17:24:19 +0400 | [diff] [blame] | 409 | Child proxy test: ${runProxyChildTest} |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 410 | Delete mgmt master node test: ${runMgmtDeleteMasterTest} |
| 411 | Delete rgnl master node test: ${runRgnlDeleteMasterTest} |
| 412 | Delete child master node test: ${runChildDeleteMasterTest} |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 413 | AWS provider deployment scheduled: ${awsOnDemandDemo} |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 414 | Equinix provider deployment scheduled: ${equinixOnDemandDemo} |
Владислав Наумов | 144956f | 2021-10-14 17:49:19 +0200 | [diff] [blame] | 415 | EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo} |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 416 | EquinixmetalV2 child deploy in a separate metro scheduled: ${equinixMetalV2ChildDiffMetro} |
Sergey Zhemerdeev | 019c45a | 2022-08-13 00:09:07 +0300 | [diff] [blame^] | 417 | EquinixmetalV2 mgmt will be deployed on the metro: ${equinixMetalV2Metro?:'auto'} |
Владислав Наумов | f1665b5 | 2021-05-13 10:51:17 +0200 | [diff] [blame] | 418 | Equinix@AWS child cluster deployment scheduled: ${equinixOnAwsDemo} |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 419 | Azure provider deployment scheduled: ${azureOnDemandDemo} |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 420 | Azure@AWS child cluster deployment scheduled: ${azureOnAwsDemo} |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 421 | VSPHERE provider deployment scheduled: ${enableVsphereDemo} |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 422 | OS provider deployment scheduled: ${enableOSDemo} |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 423 | BM provider deployment scheduled: ${enableBMDemo} |
Alexandr Lovtsov | 36473f3 | 2022-04-28 15:46:09 +0300 | [diff] [blame] | 424 | Ubuntu on vSphere scheduled: ${enableVsphereUbuntu} |
Mikhail Ivanov | bd1a9fd | 2022-03-29 21:36:21 +0400 | [diff] [blame] | 425 | Artifacts build scheduled: ${enableArtifactsBuild} |
Sergey Zhemerdeev | e67fb26 | 2022-06-21 00:49:34 +0300 | [diff] [blame] | 426 | Boot OS child from Ceph volumes: ${childOsBootFromVolume} |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 427 | Multiregional configuration: ${multiregionalMappings} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 428 | Service binaries fetching scheduled: ${fetchServiceBinaries} |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 429 | Current weight of the demo run: ${demoWeight} (Used to manage lockable resources) |
Ivan Berezovskiy | 29e72b7 | 2022-07-12 21:03:24 +0400 | [diff] [blame] | 430 | Bootstrap v2 scenario enabled: ${bootstrapV2Scenario} |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 431 | 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] | 432 | return [ |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 433 | osCloudLocation : openstackIMC, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 434 | cdnConfig : cdnConfig, |
| 435 | proxyConfig : proxyConfig, |
| 436 | useMacOsSeedNode : seedMacOs, |
| 437 | deployChildEnabled : deployChild, |
| 438 | childDeployCustomRelease : customChildRelease, |
| 439 | upgradeChildEnabled : upgradeChild, |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 440 | mosDeployChildEnabled : mosDeployChild, |
| 441 | mosUpgradeChildEnabled : mosUpgradeChild, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 442 | runChildConformanceEnabled : runChildConformance, |
| 443 | attachBYOEnabled : attachBYO, |
| 444 | upgradeBYOEnabled : upgradeBYO, |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 445 | runBYOMatrixEnabled : runBYOMatrix, |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 446 | defaultBYOOs : defaultBYOOs, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 447 | upgradeMgmtEnabled : upgradeMgmt, |
slalov | 1202bba | 2022-04-20 22:31:07 +0400 | [diff] [blame] | 448 | autoUpgradeMgmtEnabled : autoUpgradeMgmt, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 449 | enableLMALoggingEnabled : enableLMALogging, |
| 450 | runUie2eEnabled : runUie2e, |
Mikhail Ivanov | f5e20af | 2022-03-24 15:38:06 +0400 | [diff] [blame] | 451 | runUie2eNewEnabled : runUie2eNew, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 452 | runMgmtConformanceEnabled : runMgmtConformance, |
slalov | 0a4947a | 2022-06-09 15:44:35 +0400 | [diff] [blame] | 453 | runMaintenanceTestEnabled : runMaintenanceTest, |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 454 | runContainerregistryTestEnabled : runContainerregistryTest, |
| 455 | runMgmtDeleteMasterTestEnabled : runMgmtDeleteMasterTest, |
| 456 | runRgnlDeleteMasterTestEnabled : runRgnlDeleteMasterTest, |
| 457 | runChildDeleteMasterTestEnabled : runChildDeleteMasterTest, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 458 | runLMATestEnabled : runLMATest, |
| 459 | runMgmtUserControllerTestEnabled : runMgmtUserControllerTest, |
slalov | 574123e | 2022-04-06 17:24:19 +0400 | [diff] [blame] | 460 | runProxyChildTestEnabled : runProxyChildTest, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 461 | fetchServiceBinariesEnabled : fetchServiceBinaries, |
| 462 | awsOnDemandDemoEnabled : awsOnDemandDemo, |
| 463 | equinixOnDemandDemoEnabled : equinixOnDemandDemo, |
| 464 | equinixMetalV2OnDemandDemoEnabled : equinixMetalV2OnDemandDemo, |
| 465 | equinixMetalV2ChildDiffMetroEnabled : equinixMetalV2ChildDiffMetro, |
| 466 | equinixOnAwsDemoEnabled : equinixOnAwsDemo, |
| 467 | azureOnDemandDemoEnabled : azureOnDemandDemo, |
| 468 | azureOnAwsDemoEnabled : azureOnAwsDemo, |
| 469 | vsphereDemoEnabled : enableVsphereDemo, |
| 470 | vsphereOnDemandDemoEnabled : enableVsphereDemo, // TODO: remove after MCC 2.7 is out |
| 471 | bmDemoEnabled : enableBMDemo, |
| 472 | osDemoEnabled : enableOSDemo, |
Alexandr Lovtsov | 36473f3 | 2022-04-28 15:46:09 +0300 | [diff] [blame] | 473 | vsphereUbuntuEnabled : enableVsphereUbuntu, |
Mikhail Ivanov | bd1a9fd | 2022-03-29 21:36:21 +0400 | [diff] [blame] | 474 | artifactsBuildEnabled : enableArtifactsBuild, |
Sergey Zhemerdeev | e67fb26 | 2022-06-21 00:49:34 +0300 | [diff] [blame] | 475 | childOsBootFromVolume : childOsBootFromVolume, |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 476 | multiregionalConfiguration : multiregionalMappings, |
Ivan Berezovskiy | 29e72b7 | 2022-07-12 21:03:24 +0400 | [diff] [blame] | 477 | demoWeight : demoWeight, |
Sergey Zhemerdeev | dd31ce9 | 2022-07-19 14:15:22 +0300 | [diff] [blame] | 478 | bootstrapV2Scenario : bootstrapV2Scenario, |
| 479 | equinixMetalV2Metro : equinixMetalV2Metro] |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | /** |
| 483 | * Determine management and regional setup for demo workflow scenario |
| 484 | * |
| 485 | * |
Sergey Zhemerdeev | dd31ce9 | 2022-07-19 14:15:22 +0300 | [diff] [blame] | 486 | * @param: keyword (string) string , represents keyword trigger, specified in gerrit commit body, like `[multiregion aws,os]` |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 487 | or Jenkins environment string variable in form like 'aws,os' |
| 488 | * @return (map)[ |
| 489 | enabled: (bool), |
| 490 | * managementLocation: (string), //aws,os |
| 491 | * regionLocation: (string), //aws,os |
| 492 | * ] |
| 493 | */ |
| 494 | def multiregionWorkflowParser(keyword) { |
Владислав Наумов | 8c0c39d | 2020-09-11 14:46:48 +0200 | [diff] [blame] | 495 | def common = new com.mirantis.mk.Common() |
eromanova | 8c702ae | 2021-12-24 17:43:12 +0400 | [diff] [blame] | 496 | def supportedManagementProviders = ['os', 'aws', 'vsphere', 'equinix', 'equinixmetalv2', 'azure'] |
| 497 | def supportedRegionalProviders = ['os', 'vsphere', 'equinix', 'equinixmetalv2', 'bm', 'azure', 'aws'] |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 498 | |
| 499 | def clusterTypes = '' |
Владислав Наумов | 38ed7bf | 2020-09-11 14:43:39 +0200 | [diff] [blame] | 500 | if (keyword.toString().contains('multiregion')) { |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 501 | common.infoMsg('Multiregion definition configured via gerrit keyword trigger') |
| 502 | clusterTypes = keyword[0][0].split('multiregion')[1].replaceAll('[\\[\\]]', '').trim().split(',') |
| 503 | } else { |
| 504 | common.infoMsg('Multiregion definition configured via environment variable') |
| 505 | clusterTypes = keyword.trim().split(',') |
| 506 | } |
| 507 | |
| 508 | if (clusterTypes.size() != 2) { |
Владислав Наумов | 482fb50 | 2020-10-30 17:59:27 +0100 | [diff] [blame] | 509 | error("Incorrect regions definiton, valid scheme: [multiregion ${management}, ${region}], got: ${clusterTypes}") |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 510 | } |
| 511 | |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 512 | def desiredManagementProvider = clusterTypes[0].trim() |
| 513 | def desiredRegionalProvider = clusterTypes[1].trim() |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 514 | if (! supportedManagementProviders.contains(desiredManagementProvider) || ! supportedRegionalProviders.contains(desiredRegionalProvider)) { |
| 515 | error("""unsupported management <-> regional bundle, available options: |
Владислав Наумов | f793fe3 | 2020-09-11 15:19:19 +0200 | [diff] [blame] | 516 | management providers list - ${supportedManagementProviders} |
| 517 | regional providers list - ${supportedRegionalProviders}""") |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 518 | } |
| 519 | |
| 520 | return [ |
| 521 | enabled: true, |
| 522 | managementLocation: desiredManagementProvider, |
| 523 | regionLocation: desiredRegionalProvider, |
| 524 | ] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 525 | } |
| 526 | |
| 527 | /** |
| 528 | * Determine if custom si tests/pipelines refspec forwarded from gerrit change request |
| 529 | |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 530 | * 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] | 531 | * Used for components team to test component changes w/ custom SI refspecs using kaas/core deployment jobs |
| 532 | * Example scheme: |
| 533 | * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| 534 | * manage refspecs through Jenkins Job Parameters |
| 535 | * |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 536 | * @return (map)[* siTests: (string) final refspec for si-tests |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 537 | * siPipelines: (string) final refspec for si-pipelines |
| 538 | * ] |
| 539 | */ |
| 540 | def checkCustomSIRefspec() { |
vnaumov | bdb9022 | 2020-05-04 18:25:50 +0200 | [diff] [blame] | 541 | def common = new com.mirantis.mk.Common() |
| 542 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 543 | // Available triggers and its sane defaults |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 544 | def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master' |
| 545 | def siPipelinesRefspec = env.SI_PIPELINES_REFSPEC ?: 'master' |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 546 | def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test' |
| 547 | def siTestsDockerImageTag = env.SI_TESTS_DOCKER_IMAGE_TAG ?: 'master' |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 548 | 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] | 549 | |
| 550 | def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/) |
| 551 | def siPipelinesMatches = (commitMsg =~ /(\[si-pipelines-ref\s*refs\/changes\/.*?\])/) |
| 552 | |
| 553 | if (siTestMatches.size() > 0) { |
| 554 | siTestsRefspec = siTestMatches[0][0].split('si-tests-ref')[1].replaceAll('[\\[\\]]', '').trim() |
Владислав Наумов | 7f6c088 | 2021-03-23 19:10:57 +0400 | [diff] [blame] | 555 | siTestsDockerImage = "docker-review-local.docker.mirantis.net/review/kaas-si-test-${siTestsRefspec.split('/')[-2]}" |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 556 | siTestsDockerImageTag = siTestsRefspec.split('/')[-1] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 557 | } |
| 558 | if (siPipelinesMatches.size() > 0) { |
| 559 | siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 560 | } |
| 561 | |
| 562 | common.infoMsg(""" |
| 563 | kaas/si-pipelines will be fetched from: ${siPipelinesRefspec} |
| 564 | kaas/si-tests will be fetched from: ${siTestsRefspec} |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 565 | kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}:${siTestsDockerImageTag} |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 566 | 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] | 567 | return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage, siTestsDockerImageTag: siTestsDockerImageTag] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 568 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 569 | |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 570 | /** |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 571 | * Parse additional configuration for kaas component CICD repo |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 572 | * @param configurationFile (str) path to configuration file in yaml format |
| 573 | * |
| 574 | * @return (map)[ siTestsFeatureFlags (string) dedicated feature flags that will be used in SI tests, |
| 575 | * ] |
| 576 | */ |
| 577 | def parseKaaSComponentCIParameters(configurationFile){ |
| 578 | def common = new com.mirantis.mk.Common() |
| 579 | def ciConfig = readYaml file: configurationFile |
| 580 | def ciSpec = [ |
| 581 | siTestsFeatureFlags: env.SI_TESTS_FEATURE_FLAGS ?: '', |
| 582 | ] |
| 583 | |
| 584 | if (ciConfig.containsKey('si-tests-feature-flags')) { |
| 585 | common.infoMsg("""SI tests feature flags customization detected, |
| 586 | results will be merged with existing flags: [${ciSpec['siTestsFeatureFlags']}] identification...""") |
| 587 | |
| 588 | def ffMeta = ciSpec['siTestsFeatureFlags'].tokenize(',').collect { it.trim() } |
| 589 | ffMeta.addAll(ciConfig['si-tests-feature-flags']) |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 590 | |
Владислав Наумов | cb5ffca | 2020-07-14 15:28:36 +0200 | [diff] [blame] | 591 | ciSpec['siTestsFeatureFlags'] = ffMeta.unique().join(',') |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 592 | common.infoMsg("SI tests custom feature flags: ${ciSpec['siTestsFeatureFlags']}") |
| 593 | } |
| 594 | |
| 595 | common.infoMsg("""Additional ci configuration parsed successfully: |
| 596 | siTestsFeatureFlags: ${ciSpec['siTestsFeatureFlags']}""") |
| 597 | return ciSpec |
| 598 | } |
| 599 | |
| 600 | /** |
| 601 | * Determine if custom kaas core/pipelines refspec forwarded from gerrit change request |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 602 | |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 603 | * 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] | 604 | * Used for components team to test component changes w/ custom Core refspecs using kaas/core deployment jobs |
| 605 | * Example scheme: |
| 606 | * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| 607 | * manage refspecs through Jenkins Job Parameters |
| 608 | * |
| 609 | * @return (map)[ core: (string) final refspec for kaas/core |
| 610 | * corePipelines: (string) final refspec for pipelines in kaas/core |
| 611 | * ] |
| 612 | */ |
| 613 | def checkCustomCoreRefspec() { |
| 614 | def common = new com.mirantis.mk.Common() |
| 615 | |
| 616 | // Available triggers and its sane defaults |
| 617 | def coreRefspec = env.KAAS_CORE_REFSPEC ?: 'master' |
| 618 | // by default using value of GERRIT_REFSPEC parameter in *kaas/core jobs* |
| 619 | def corePipelinesRefspec = env.KAAS_PIPELINE_REFSPEC ?: '\$GERRIT_REFSPEC' |
| 620 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| 621 | |
| 622 | def coreMatches = (commitMsg =~ /(\[core-ref\s*refs\/changes\/.*?\])/) |
| 623 | def corePipelinesMatches = (commitMsg =~ /(\[core-pipelines-ref\s*refs\/changes\/.*?\])/) |
| 624 | |
| 625 | if (coreMatches.size() > 0) { |
| 626 | coreRefspec = coreMatches[0][0].split('core-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 627 | } |
| 628 | if (corePipelinesMatches.size() > 0) { |
| 629 | corePipelinesRefspec = corePipelinesMatches[0][0].split('core-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 630 | } |
| 631 | |
| 632 | common.infoMsg(""" |
| 633 | kaas/core will be fetched from: ${coreRefspec} |
| 634 | kaas/core pipelines will be fetched from: ${corePipelinesRefspec} |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 635 | 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] | 636 | return [core: coreRefspec, corePipelines: corePipelinesRefspec] |
| 637 | } |
| 638 | |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 639 | |
| 640 | /** |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 641 | * generate Jenkins Parameter objects from from text parameter with additonal kaas core context |
| 642 | * needed to forward inside kaas core set of jobs |
| 643 | * |
| 644 | * @param context (string) Representation of the string enviroment variables needed for kaas core jobs in yaml format |
| 645 | * @return (list)[ string(name: '', value: ''), |
| 646 | * ] |
| 647 | */ |
| 648 | def generateKaaSVarsFromContext(context) { |
| 649 | def common = new com.mirantis.mk.Common() |
| 650 | def parameters = [] |
| 651 | def config = readYaml text: context |
| 652 | |
| 653 | config.each { k,v -> |
| 654 | common.infoMsg("Custom KaaS Core context parameter: ${k}=${v}") |
| 655 | parameters.add(string(name: k, value: v)) |
| 656 | } |
| 657 | |
| 658 | return parameters |
| 659 | } |
| 660 | |
| 661 | /** |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 662 | * 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] | 663 | * 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] | 664 | * Used for components team to test component changes w/ customized SI tests/refspecs using kaas/core deployment jobs |
| 665 | * |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 666 | * @param: component (string) component name [iam, lcm, stacklight] |
| 667 | * @param: patchSpec (string) Patch for kaas/cluster releases in json format |
| 668 | * @param: configurationFile (string) Additional file for component repo CI config in yaml format |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 669 | */ |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 670 | def triggerPatchedComponentDemo(component, patchSpec = '', configurationFile = '.ci-parameters.yaml', coreContext = '') { |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 671 | def common = new com.mirantis.mk.Common() |
| 672 | // Determine if custom trigger keywords forwarded from gerrit |
| 673 | def triggers = checkDeploymentTestSuite() |
| 674 | // Determine SI refspecs |
| 675 | def siRefspec = checkCustomSIRefspec() |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 676 | // Determine Core refspecs |
| 677 | def coreRefspec = checkCustomCoreRefspec() |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 678 | |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 679 | // Determine component repo ci configuration |
| 680 | def ciSpec = [:] |
| 681 | def componentFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: '' |
| 682 | if (fileExists(configurationFile)) { |
| 683 | common.infoMsg('Component CI configuration file detected, parsing...') |
| 684 | ciSpec = parseKaaSComponentCIParameters(configurationFile) |
| 685 | componentFeatureFlags = ciSpec['siTestsFeatureFlags'] |
| 686 | } else { |
| 687 | common.warningMsg('''Component CI configuration file is not exists, |
Владислав Наумов | c17dd55 | 2020-07-29 17:07:38 +0200 | [diff] [blame] | 688 | several code-management features may be unavailable, |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 689 | follow https://mirantis.jira.com/wiki/spaces/QA/pages/2310832276/SI-tests+feature+flags#%5BUpdated%5D-Using-a-feature-flag |
| 690 | to create the configuration file''') |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 691 | } |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 692 | |
| 693 | def platforms = [] |
| 694 | if (component == 'ipam' && triggers.vsphereDemoEnabled) { |
| 695 | // Currently only vsphere demo is required for IPAM component |
| 696 | platforms.add('vsphere') |
| 697 | } else { |
| 698 | if (triggers.osDemoEnabled) { |
| 699 | platforms.add('openstack') |
| 700 | } |
| 701 | if (triggers.awsOnDemandDemoEnabled) { |
| 702 | platforms.add('aws') |
| 703 | } |
| 704 | if (triggers.equinixOnDemandDemoEnabled) { |
| 705 | platforms.add('equinix') |
| 706 | } |
Владислав Наумов | 144956f | 2021-10-14 17:49:19 +0200 | [diff] [blame] | 707 | if (triggers.equinixMetalV2OnDemandDemoEnabled) { |
| 708 | platforms.add('equinixmetalv2') |
| 709 | } |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 710 | if (triggers.azureOnDemandDemoEnabled) { |
| 711 | platforms.add('azure') |
| 712 | } |
Ivan Berezovskiy | b0229d0 | 2021-05-17 16:55:18 +0400 | [diff] [blame] | 713 | if (triggers.vsphereDemoEnabled) { |
| 714 | platforms.add('vsphere') |
| 715 | } |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 716 | } |
| 717 | |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 718 | def jobs = [:] |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 719 | def parameters = [ |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 720 | string(name: 'GERRIT_REFSPEC', value: coreRefspec.core), |
| 721 | string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 722 | string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests), |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 723 | string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags), |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 724 | string(name: 'SI_TESTS_DOCKER_IMAGE', value: siRefspec.siTestsDockerImage), |
| 725 | string(name: 'SI_TESTS_DOCKER_IMAGE_TAG', value: siRefspec.siTestsDockerImageTag), |
Владислав Наумов | 4a5c324 | 2020-06-08 14:36:11 +0200 | [diff] [blame] | 726 | string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 727 | string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec), |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 728 | string(name: 'KAAS_CHILD_CLUSTER_RELEASE_NAME', value: triggers.childDeployCustomRelease), |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 729 | string(name: 'OPENSTACK_CLOUD_LOCATION', value: triggers.osCloudLocation), |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 730 | booleanParam(name: 'OFFLINE_MGMT_CLUSTER', value: triggers.proxyConfig['mgmtOffline']), |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 731 | booleanParam(name: 'OFFLINE_CHILD_CLUSTER', value: triggers.proxyConfig['childOffline']), |
Владислав Наумов | 257ea13 | 2021-04-14 14:44:13 +0200 | [diff] [blame] | 732 | booleanParam(name: 'PROXY_CHILD_CLUSTER', value: triggers.proxyConfig['childProxy']), |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 733 | booleanParam(name: 'SEED_MACOS', value: triggers.useMacOsSeedNode), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 734 | booleanParam(name: 'UPGRADE_MGMT_CLUSTER', value: triggers.upgradeMgmtEnabled), |
slalov | 1202bba | 2022-04-20 22:31:07 +0400 | [diff] [blame] | 735 | booleanParam(name: 'AUTO_UPGRADE_MCC', value: triggers.autoUpgradeMgmtEnabled), |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 736 | booleanParam(name: 'ENABLE_LMA_LOGGING', value: triggers.enableLMALoggingEnabled), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 737 | booleanParam(name: 'RUN_UI_E2E', value: triggers.runUie2eEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 738 | booleanParam(name: 'RUN_MGMT_CFM', value: triggers.runMgmtConformanceEnabled), |
slalov | 0a4947a | 2022-06-09 15:44:35 +0400 | [diff] [blame] | 739 | booleanParam(name: 'RUN_MAINTENANCE_TEST', value: triggers.runMaintenanceTestEnabled), |
| 740 | booleanParam(name: 'RUN_CONTAINER_REGISTRY_TEST', value: triggers.runContainerregistryTestEnabled), |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 741 | booleanParam(name: 'RUN_MGMT_DELETE_MASTER_TEST', value: triggers.runMgmtDeleteMasterTestEnabled), |
| 742 | booleanParam(name: 'RUN_RGNL_DELETE_MASTER_TEST', value: triggers.runRgnlDeleteMasterTestEnabled), |
| 743 | booleanParam(name: 'RUN_CHILD_DELETE_MASTER_TEST', value: triggers.runChildDeleteMasterTestEnabled), |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 744 | booleanParam(name: 'RUN_LMA_TEST', value: triggers.runLMATestEnabled), |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 745 | booleanParam(name: 'RUN_MGMT_USER_CONTROLLER_TEST', value: triggers.runMgmtUserControllerTestEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 746 | booleanParam(name: 'DEPLOY_CHILD_CLUSTER', value: triggers.deployChildEnabled), |
| 747 | booleanParam(name: 'UPGRADE_CHILD_CLUSTER', value: triggers.upgradeChildEnabled), |
slalov | 574123e | 2022-04-06 17:24:19 +0400 | [diff] [blame] | 748 | booleanParam(name: 'RUN_PROXY_CHILD_TEST', value: triggers.runProxyChildTestEnabled), |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 749 | booleanParam(name: 'ATTACH_BYO', value: triggers.attachBYOEnabled), |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 750 | booleanParam(name: 'UPGRADE_BYO', value: triggers.upgradeBYOEnabled), |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 751 | booleanParam(name: 'RUN_BYO_MATRIX', value: triggers.runBYOMatrixEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 752 | booleanParam(name: 'RUN_CHILD_CFM', value: triggers.runChildConformanceEnabled), |
Ivan Berezovskiy | cbf9eeb | 2021-03-22 15:57:32 +0400 | [diff] [blame] | 753 | booleanParam(name: 'ALLOW_AWS_ON_DEMAND', value: triggers.awsOnDemandDemoEnabled), |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 754 | booleanParam(name: 'ALLOW_EQUINIX_ON_DEMAND', value: triggers.equinixOnDemandDemoEnabled), |
Владислав Наумов | 82305e9 | 2021-10-14 20:45:20 +0200 | [diff] [blame] | 755 | booleanParam(name: 'ALLOW_EQUINIXMETALV2_ON_DEMAND', value: triggers.equinixMetalV2OnDemandDemoEnabled), |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 756 | booleanParam(name: 'EQUINIXMETALV2_CHILD_DIFF_METRO', value: triggers.equinixMetalV2ChildDiffMetroEnabled), |
eromanova | d339751 | 2021-04-01 20:19:19 +0400 | [diff] [blame] | 757 | booleanParam(name: 'EQUINIX_ON_AWS_DEMO', value: triggers.equinixOnAwsDemoEnabled), |
Владислав Наумов | c52dd9d | 2021-06-28 16:27:29 +0200 | [diff] [blame] | 758 | booleanParam(name: 'ALLOW_AZURE_ON_DEMAND', value: triggers.azureOnDemandDemoEnabled), |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 759 | booleanParam(name: 'AZURE_ON_AWS_DEMO', value: triggers.azureOnAwsDemoEnabled), |
Sergey Zhemerdeev | 9074f6e | 2022-06-07 12:03:16 +0300 | [diff] [blame] | 760 | booleanParam(name: 'VSPHERE_DEPLOY_UBUNTU', value: triggers.vsphereUbuntuEnabled), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 761 | ] |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 762 | |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 763 | // customize multiregional demo |
| 764 | if (triggers.multiregionalConfiguration.enabled) { |
| 765 | parameters.add(string(name: 'MULTIREGION_SETUP', |
| 766 | value: "${triggers.multiregionalConfiguration.managementLocation},${triggers.multiregionalConfiguration.regionLocation}" |
| 767 | )) |
| 768 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 769 | |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 770 | // Determine component team custom context |
| 771 | if (coreContext != '') { |
| 772 | common.infoMsg('Additional KaaS Core context detected, will be forwarded into kaas core cicd...') |
| 773 | def additionalParameters = generateKaaSVarsFromContext(coreContext) |
Владислав Наумов | bef51a9 | 2020-10-01 17:36:51 +0200 | [diff] [blame] | 774 | parameters.addAll(additionalParameters) |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 775 | } |
| 776 | |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 777 | def jobResults = [] |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 778 | |
| 779 | platforms.each { platform -> |
| 780 | jobs["kaas-core-${platform}-patched-${component}"] = { |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 781 | try { |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 782 | common.infoMsg("Deploy: patched KaaS demo with ${platform} provider") |
| 783 | def job_info = build job: "kaas-testing-core-${platform}-workflow-${component}", parameters: parameters, wait: true |
| 784 | def build_description = job_info.getDescription() |
| 785 | def build_result = job_info.getResult() |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 786 | jobResults.add(build_result) |
Владислав Наумов | d044e84 | 2020-06-17 15:33:43 +0200 | [diff] [blame] | 787 | |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 788 | if (build_description) { |
| 789 | currentBuild.description += build_description |
| 790 | } |
| 791 | } finally { |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 792 | common.infoMsg("Patched KaaS demo with ${platform} provider finished") |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 793 | } |
| 794 | } |
| 795 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 796 | |
| 797 | common.infoMsg('Trigger KaaS demo deployments according to defined provider set') |
Владислав Наумов | 37f7f84 | 2021-03-09 16:08:39 +0400 | [diff] [blame] | 798 | if (jobs.size() == 0) { |
| 799 | error('No demo jobs matched with keywords, execution will be aborted, at least 1 provider should be enabled') |
| 800 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 801 | // Limit build concurency workaround examples: https://issues.jenkins-ci.org/browse/JENKINS-44085 |
| 802 | parallel jobs |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 803 | |
| 804 | if (jobResults.contains('FAILURE')) { |
Владислав Наумов | f86b111 | 2020-06-09 14:04:48 +0200 | [diff] [blame] | 805 | common.infoMsg('One of parallel downstream jobs is failed, mark executor job as failed') |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 806 | currentBuild.result = 'FAILURE' |
| 807 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 808 | } |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 809 | |
| 810 | |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 811 | /** |
| 812 | * 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] | 813 | * 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] | 814 | * |
| 815 | * @param: callBackDemo (string) Demo which requested to generate lockResources [aws or vsphere] |
| 816 | * @param: triggers (map) Custom trigger keywords forwarded from gerrit |
| 817 | * @param: multiregionalConfiguration (map) Multiregional configuration |
| 818 | * @return (map) Return aggregated map with lockResources and netMap |
| 819 | */ |
| 820 | |
| 821 | |
| 822 | def generateLockResources(callBackDemo, triggers) { |
| 823 | def common = new com.mirantis.mk.Common() |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 824 | def netMap = [ |
| 825 | vsphere: [:], |
| 826 | equinix: [:], |
| 827 | ] |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 828 | // Define vsphere locklabels with initial quantity |
| 829 | def lockLabels = [ |
| 830 | vsphere_networking_core_ci: 0, |
| 831 | vsphere_offline_networking_core_ci: 0, |
| 832 | ] |
| 833 | def deployChild = triggers.deployChildEnabled |
slalov | 2783327 | 2022-06-30 02:13:50 +0400 | [diff] [blame] | 834 | def testUiVsphere = triggers.runUie2eEnabled |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 835 | def multiregionConfig = triggers.multiregionalConfiguration |
| 836 | def runMultiregion = multiregionConfig.enabled |
| 837 | |
| 838 | // Generate vsphere netMap and lockLabels based on demo context |
| 839 | switch (callBackDemo) { |
| 840 | case 'aws': |
| 841 | // Add aws specific lock label with quantity calculated based on single mgmt deploy or mgmt + child |
| 842 | lockLabels['aws_core_ci_queue'] = triggers.demoWeight |
Sergey Kolekonov | f4c1f49 | 2022-02-03 14:44:45 +0400 | [diff] [blame] | 843 | if (triggers.runBYOMatrixEnabled) { lockLabels['aws_core_ci_queue'] += 6 } |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 844 | |
| 845 | // Define netMap for Vsphere region |
Mikhail Ivanov | 90a27fa | 2022-05-30 15:18:24 +0400 | [diff] [blame] | 846 | if (runMultiregion && multiregionConfig.managementLocation == 'aws') { |
| 847 | if (multiregionConfig.regionLocation == 'vsphere') { |
| 848 | if (deployChild) { |
| 849 | addToProviderNetMap(netMap, 'vsphere', 'regional-child') |
| 850 | } |
| 851 | addToProviderNetMap(netMap, 'vsphere', 'region') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 852 | } |
Mikhail Ivanov | 90a27fa | 2022-05-30 15:18:24 +0400 | [diff] [blame] | 853 | |
| 854 | if (multiregionConfig.regionLocation == 'azure') { |
| 855 | lockLabels['azure_core_ci_queue'] = 1 |
| 856 | if (deployChild) { |
| 857 | lockLabels['azure_core_ci_queue'] += 1 |
| 858 | } |
| 859 | } |
| 860 | } |
| 861 | if (triggers.azureOnAwsDemoEnabled) { |
| 862 | lockLabels['azure_core_ci_queue'] = 1 |
| 863 | } |
| 864 | |
| 865 | if (triggers.equinixOnAwsDemoEnabled) { |
| 866 | lockLabels['equinix_core_ci_queue'] = 1 |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 867 | } |
| 868 | break |
| 869 | case 'vsphere': |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 870 | addToProviderNetMap(netMap, 'vsphere', 'mgmt') |
slalov | 2783327 | 2022-06-30 02:13:50 +0400 | [diff] [blame] | 871 | if (deployChild || testUiVsphere) { |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 872 | addToProviderNetMap(netMap, 'vsphere', 'child') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 873 | } |
| 874 | if (runMultiregion && multiregionConfig.managementLocation == 'vsphere' && |
| 875 | multiregionConfig.regionLocation == 'vsphere') { |
| 876 | if (deployChild) { |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 877 | addToProviderNetMap(netMap, 'vsphere', 'regional-child') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 878 | } |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 879 | addToProviderNetMap(netMap, 'vsphere', 'region') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 880 | } |
| 881 | break |
Mikhail Ivanov | 90a27fa | 2022-05-30 15:18:24 +0400 | [diff] [blame] | 882 | case 'azure': |
| 883 | lockLabels['azure_core_ci_queue'] = triggers.demoWeight |
| 884 | if (runMultiregion && multiregionConfig.managementLocation == 'azure') { |
| 885 | if (multiregionConfig.regionLocation == 'aws') { |
| 886 | lockLabels['aws_core_ci_queue'] = 1 |
| 887 | if (deployChild) { |
| 888 | lockLabels['aws_core_ci_queue'] += 1 |
| 889 | } |
| 890 | } |
| 891 | |
| 892 | if (multiregionConfig.regionLocation == 'equinix') { |
| 893 | lockLabels['equinix_core_ci_queue'] = 1 |
| 894 | if (deployChild) { |
| 895 | lockLabels['equinix_core_ci_queue'] +=1 |
| 896 | } |
| 897 | } |
| 898 | } |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 899 | default: |
Mikhail Ivanov | 90a27fa | 2022-05-30 15:18:24 +0400 | [diff] [blame] | 900 | error('Supposed to be called from aws, azure or vsphere demos only') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 901 | } |
| 902 | |
| 903 | // Checking gerrit triggers and manage lock label quantity and network types in case of Offline deployment |
| 904 | // Vsphere labels only |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 905 | netMap['vsphere'].each { clusterType, netConfig -> |
| 906 | if (triggers.proxyConfig["${clusterType}Offline"] == true || |
| 907 | (clusterType == 'regional-child' && triggers.proxyConfig['childOffline'] == true) || |
| 908 | (clusterType == 'region' && triggers.proxyConfig['mgmtOffline'])) { |
| 909 | |
| 910 | netMap['vsphere'][clusterType]['netName'] = 'offline' |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 911 | lockLabels['vsphere_offline_networking_core_ci']++ |
| 912 | } else { |
| 913 | lockLabels['vsphere_networking_core_ci']++ |
| 914 | } |
| 915 | } |
| 916 | |
| 917 | // generate lock metadata |
| 918 | def lockResources = [] |
| 919 | lockLabels.each { label, quantity -> |
| 920 | if (quantity > 0) { |
| 921 | def res = [ |
| 922 | label: label, |
| 923 | quantity: quantity, |
| 924 | ] |
| 925 | lockResources.add(res) |
| 926 | } |
| 927 | } |
| 928 | |
| 929 | common.infoMsg("""Generated vsphere netMap: ${netMap} |
| 930 | Generated lockResources: ${lockResources}""") |
| 931 | |
| 932 | return [ |
| 933 | netMap: netMap, |
| 934 | lockResources: lockResources, |
| 935 | ] |
| 936 | } |
| 937 | |
| 938 | /** |
| 939 | * Function gets vsphere netMap or empty map and adds new vsphere clusterType with default netName |
| 940 | * and empty rangeConfig to the this map. |
| 941 | * |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 942 | * @param: netMap (string) vsphere, equinix netMap or empty map |
| 943 | * @param: provider (string) provider type |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 944 | * @param: clusterType (string) Vsphere cluster type |
| 945 | */ |
| 946 | |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 947 | def addToProviderNetMap (netMap, provider, clusterType) { |
| 948 | switch (provider) { |
| 949 | case 'equinix': |
| 950 | netMap[provider][clusterType] = [ |
| 951 | vlanConfig: '', |
| 952 | ] |
| 953 | break |
| 954 | case 'vsphere': |
| 955 | netMap[provider][clusterType] = [ |
| 956 | netName: 'default', |
| 957 | rangeConfig: '', |
| 958 | ] |
| 959 | break |
| 960 | default: |
| 961 | error('Net map locks supported for Equinix/Vsphere providers only') |
| 962 | } |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 963 | } |
Dmitry Teselkin | fce71aa | 2022-03-05 19:36:52 +0300 | [diff] [blame] | 964 | |
| 965 | /** |
| 966 | * getCIKeywordsFromCommitMsg parses commit message and returns all gerrit keywords with their values as a list of maps. |
| 967 | * Each element (map) contains keys 'key' for keyword name and 'value' for its value. |
| 968 | * If keyword contains only 'key' part then 'value' is boolean True. |
| 969 | * This function does not perform keywords validation. |
| 970 | * First line of a commit message is ignored. |
| 971 | * To use '[' or ']' characters inside keyword prepend it with backslash '\'. |
| 972 | * TODO: Remove backslash chars from values if they prepend '[' or ']'. |
| 973 | **/ |
| 974 | |
| 975 | List getCIKeywordsFromCommitMsg() { |
| 976 | String commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| 977 | List commitMsgLines = commitMsg.split('\n') |
| 978 | List keywords = [] |
| 979 | if (commitMsgLines.size() < 2) { |
| 980 | return keywords |
| 981 | } |
| 982 | |
| 983 | String commitMsgBody = commitMsgLines[1..-1].join('\n') |
| 984 | |
| 985 | // Split commit message body to chunks using '[' or ']' as delimiter, |
| 986 | // ignoring them if prepended by backslash (regex negative lookbehind). |
| 987 | // Resulting list will have chunks between '[' and ']' at odd indexes. |
| 988 | List parts = commitMsgBody.split(/(?<!\\)[\[\]]/) |
| 989 | |
| 990 | // Iterate chunks by odd indexes only, trim values and split to |
| 991 | // <key> / <value> pair where <key> is the part of a sting before the first |
| 992 | // whitespace delimiter, and <value> is the rest (may include whitespaces). |
| 993 | // If there is no whitespace in the string then this is a 'switch' |
| 994 | // and <value> will be boolean True. |
| 995 | for (i = 1; i < parts.size(); i += 2) { |
| 996 | def (key, value) = (parts[i].trim().split(/\s+/, 2) + [true, ])[0..1] |
| 997 | keywords.add(['key': key, 'value': value]) |
| 998 | } |
| 999 | |
| 1000 | return keywords |
| 1001 | } |
| 1002 | |
| 1003 | /** |
| 1004 | * getJobsParamsFromCommitMsg parses list of CI keywords and returns values of 'job-params' keyword |
| 1005 | * that were specified for given job name. `job-params` keyword has the following structure |
| 1006 | * |
| 1007 | * [job-params <job name> <parameter name> <parameter value>] |
| 1008 | * |
| 1009 | * Return value is a Map that contains those parameters using the following structure: |
| 1010 | * |
| 1011 | * <job name>: |
| 1012 | * <parameter name>: <parameter value> |
| 1013 | * |
| 1014 | **/ |
| 1015 | Map getJobsParamsFromCommitMsg() { |
| 1016 | List keywords = getCIKeywordsFromCommitMsg() |
| 1017 | |
| 1018 | List jobsParamsList = [] |
| 1019 | keywords.findAll{ it.key == 'job-params' }.collect(jobsParamsList) { |
| 1020 | def (name, params) = (it['value'].split(/\s+/, 2) + [null, ])[0..1] |
| 1021 | def (key, value) = params.split(/\s+/, 2) |
| 1022 | ['name': name, 'key': key, 'value': value] |
| 1023 | } |
| 1024 | |
| 1025 | Map jobsParams = jobsParamsList.inject([:]) { result, it -> |
| 1026 | if (!result.containsKey(it.name)) { |
| 1027 | result[it.name] = [:] |
| 1028 | } |
| 1029 | result[it.name][it.key] = it.value |
| 1030 | result |
| 1031 | } |
| 1032 | |
| 1033 | return jobsParams |
| 1034 | } |
| 1035 | |
| 1036 | |
| 1037 | /** |
| 1038 | * getJobParamsFromCommitMsg returns key:value Map of parameters set for a job in commit message. |
| 1039 | * It uses getJobsParamsFromCommitMsg to get all parameters from commit message and then |
| 1040 | * uses only those parametes that were set to all jobs (with <job name> == '*') or to |
| 1041 | * a particular job. Parameters set to a particular job have higher precedence. |
| 1042 | * |
| 1043 | * Return value is a Map that contains those parameters: |
| 1044 | * |
| 1045 | * <parameter name>: <parameter value> |
| 1046 | * |
| 1047 | **/ |
| 1048 | Map getJobParamsFromCommitMsg(String jobName) { |
| 1049 | jobsParams = getJobsParamsFromCommitMsg() |
| 1050 | jobParams = jobsParams.getOrDefault('*', [:]) |
| 1051 | if (jobName) { |
| 1052 | jobParams.putAll(jobsParams.getOrDefault(jobName, [:])) |
| 1053 | } |
| 1054 | return jobParams |
| 1055 | } |
azvyagintsev | c17d14b | 2022-06-06 19:06:33 +0300 | [diff] [blame] | 1056 | |
| 1057 | /** Getting test scheme from text, which should be |
| 1058 | Imput example: |
| 1059 | text=""" |
| 1060 | DATA |
| 1061 | |
| 1062 | kaas_bm_test_schemas: |
| 1063 | KAAS_RELEASES_REFSPEC: '' |
| 1064 | KEY: VAL |
| 1065 | |
| 1066 | DATA |
| 1067 | """ |
| 1068 | |
| 1069 | Call: parseTextForTestSchemas(['text' : text,'keyLine' : 'kaas_bm_test_schemas']) |
| 1070 | |
| 1071 | Return: |
| 1072 | ['KAAS_RELEASES_REFSPEC': '', 'KEY' : 'VAL'] |
| 1073 | **/ |
| 1074 | def parseTextForTestSchemas(Map opts) { |
azvyagintsev | d96aac2 | 2022-06-10 14:23:26 +0300 | [diff] [blame] | 1075 | String text = opts.getOrDefault('text', '') |
azvyagintsev | c17d14b | 2022-06-06 19:06:33 +0300 | [diff] [blame] | 1076 | String keyLine = opts.getOrDefault('keyLine', '') |
| 1077 | Map testScheme = [:] |
| 1078 | if (!text || !keyLine) { |
azvyagintsev | d96aac2 | 2022-06-10 14:23:26 +0300 | [diff] [blame] | 1079 | return testScheme |
azvyagintsev | c17d14b | 2022-06-06 19:06:33 +0300 | [diff] [blame] | 1080 | } |
| 1081 | if (text =~ /\n$keyLine\n.*/) { |
| 1082 | def common = new com.mirantis.mk.Common() |
| 1083 | try { |
| 1084 | String regExp = '\\n' + keyLine + '\\n' |
| 1085 | // regexep block must be followed by empty line |
| 1086 | testScheme = readYaml text: "${text.split(regExp)[1].split('\n\n')[0]}" |
| 1087 | common.infoMsg("parseTextForTestSchemas result:\n" + testScheme) |
| 1088 | common.mergeEnv(env, toJson(testScheme)) |
| 1089 | } |
| 1090 | catch (Exception e) { |
| 1091 | common.errorMsg("There is an error occured during parseTextForTestSchemas execution:\n${e}") |
| 1092 | throw e |
| 1093 | } |
| 1094 | } |
azvyagintsev | d96aac2 | 2022-06-10 14:23:26 +0300 | [diff] [blame] | 1095 | return testScheme |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 1096 | } |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1097 | |
| 1098 | |
| 1099 | /** |
| 1100 | * getEquinixMetrosWithCapacity returns list of Equinix metros using specified |
| 1101 | * instance type (nodeType) and desired count of instances (nodeCount) in a metro. |
| 1102 | * Function downloads metal CLI from the |
| 1103 | * https://github.com/equinix/metal-cli/releases/download/v0.9.0/metal-linux-amd64 |
| 1104 | * Empty list is returned in case of errors. |
| 1105 | * |
| 1106 | * @param: nodeCount (int) Desired count of instances |
| 1107 | * @param: nodeType (string) Instance type |
| 1108 | * @return ([]string) List of selected metros |
| 1109 | * |
| 1110 | **/ |
| 1111 | def getEquinixMetrosWithCapacity(nodeCount = 10, nodeType = 'c3.small.x86', version = '0.9.0') { |
| 1112 | def common = new com.mirantis.mk.Common() |
| 1113 | def metalUrl = "https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux" |
| 1114 | def metros = [] |
| 1115 | def out = '' |
| 1116 | try { |
| 1117 | sh "curl -o metal -# ${metalUrl} && chmod +x metal" |
| 1118 | withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) { |
| 1119 | sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml' |
| 1120 | out = sh(script: "./metal --config metal.yaml capacity get -m -P ${nodeType}|awk '/${nodeType}/ {print \$2}'|paste -s -d,|xargs ./metal --config metal.yaml capacity check -P ${nodeType} -q ${nodeCount} -m|grep true|awk '{print \$2}'|paste -s -d,", returnStdout: true).trim() |
| 1121 | sh 'rm metal.yaml' |
| 1122 | } |
| 1123 | metros = out.tokenize(',') |
| 1124 | } catch (Exception e) { |
| 1125 | common.errorMsg "Exception: '${e}'" |
| 1126 | return [] |
| 1127 | } |
| 1128 | return metros |
| 1129 | } |