blob: b6e112704821c78136704ac702c437d8e6c3132d [file] [log] [blame]
vnaumov33747e12020-05-04 17:35:20 +02001package com.mirantis.mk
vnaumov33747e12020-05-04 17:35:20 +02002
azvyagintsevc17d14b2022-06-06 19:06:33 +03003import static groovy.json.JsonOutput.toJson
4
vnaumov33747e12020-05-04 17:35:20 +02005/**
6 *
7 * KaaS Component Testing Utilities
8 *
9 */
10
Владислав Наумовe5345812020-08-12 16:30:20 +020011/**
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 */
20def 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}
vnaumov33747e12020-05-04 17:35:20 +020034
35/**
azvyagintseva12230a2020-06-05 13:24:06 +030036 * Determine scope of test suite against per-commit KaaS deployment based on keywords
Владислав Наумов81777472021-03-09 15:14:27 +040037 * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md
azvyagintseva12230a2020-06-05 13:24:06 +030038 *
39 * Used for components team to combine test-suites and forward desired parameters to kaas/core deployment jobs
40 * Example scheme:
Владислав Наумовe5345812020-08-12 16:30:20 +020041 * New CR pushed in kubernetes/lcm-ansible -> parsing it'cs commit body and combine test-suite -> trigger deployment jobs from kaas/core
azvyagintseva12230a2020-06-05 13:24:06 +030042 * manage test-suite through Jenkins Job Parameters
43 *
Владислав Наумов6c2afff2020-06-05 12:54:53 +020044 * @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
azvyagintseva12230a2020-06-05 13:24:06 +030047 * ]
48 */
vnaumov33747e12020-05-04 17:35:20 +020049def checkDeploymentTestSuite() {
vnaumovbdb90222020-05-04 18:25:50 +020050 def common = new com.mirantis.mk.Common()
51
vnaumov33747e12020-05-04 17:35:20 +020052 // Available triggers and its sane defaults
Владислав Наумов44c64b72020-12-04 20:22:53 +010053 def seedMacOs = env.SEED_MACOS ? env.SEED_MACOS.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020054 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
Sergey Lalovc1cb49f2022-09-27 01:16:25 +040056 def fullUpgradeChild = env.FULL_UPGRADE_CHILD_CLUSTER ? env.FULL_UPGRADE_CHILD_CLUSTER.toBoolean() : false
Mikhail Ivanov38ee4382022-01-27 16:21:51 +040057 def mosDeployChild = env.DEPLOY_MOS_CHILD_CLUSTER ? env.DEPLOY_MOS_CHILD_CLUSTER.toBoolean() : false
58 def mosUpgradeChild = env.UPGRADE_MOS_CHILD_CLUSTER ? env.UPGRADE_MOS_CHILD_CLUSTER.toBoolean() : false
Mikhail Ivanov74504372021-05-21 17:01:06 +040059 def customChildRelease = env.KAAS_CHILD_CLUSTER_RELEASE_NAME ? env.KAAS_CHILD_CLUSTER_RELEASE_NAME : ''
slalov021171f2022-03-04 14:48:38 +040060 def mosTfDeploy = env.MOS_TF_DEPLOY ? env.MOS_TF_DEPLOY.toBoolean() : false
Владислав Наумов0dc99252020-11-13 13:30:48 +010061 def attachBYO = env.ATTACH_BYO ? env.ATTACH_BYO.toBoolean() : false
Владислав Наумовcdbd84e2020-12-01 16:51:09 +010062 def upgradeBYO = env.UPGRADE_BYO ? env.UPGRADE_BYO.toBoolean() : false
Vladislav Naumov7930ab22021-11-22 18:24:24 +010063 def runBYOMatrix = env.RUN_BYO_MATRIX ? env.RUN_BYO_MATRIX.toBoolean() : false
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +040064 def defaultBYOOs = env.DEFAULT_BYO_OS ? env.DEFAULT_BYO_OS.toString() : 'ubuntu'
Владислав Наумов6c2afff2020-06-05 12:54:53 +020065 def upgradeMgmt = env.UPGRADE_MGMT_CLUSTER ? env.UPGRADE_MGMT_CLUSTER.toBoolean() : false
slalov1202bba2022-04-20 22:31:07 +040066 def autoUpgradeMgmt = env.AUTO_UPGRADE_MCC ? env.AUTO_UPGRADE_MCC.toBoolean() : false
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +040067 def enableLMALogging = env.ENABLE_LMA_LOGGING ? env.ENABLE_LMA_LOGGING.toBoolean(): false
Sergey Lalovb2f60372022-09-20 23:58:47 +040068 def deployOsOnMos = env.DEPLOY_OS_ON_MOS? env.DEPLOY_OS_ON_MOS.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020069 def runUie2e = env.RUN_UI_E2E ? env.RUN_UI_E2E.toBoolean() : false
Mikhail Ivanovf5e20af2022-03-24 15:38:06 +040070 def runUie2eNew = env.RUN_UI_E2E_NEW ? env.RUN_UI_E2E_NEW.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020071 def runMgmtConformance = env.RUN_MGMT_CFM ? env.RUN_MGMT_CFM.toBoolean() : false
Sergey Lalovafcc0432023-04-13 14:59:06 +040072 def runMgmtConformanceNetworkPolicy = env.RUN_MGMT_CFM_NETWORK_POLICY ? env.RUN_MGMT_CFM_NETWORK_POLICY.toBoolean() : false
Владислав Наумов9cec55d2021-08-03 15:00:59 +020073 def runLMATest = env.RUN_LMA_TEST ? env.RUN_LMA_TEST.toBoolean() : false
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +020074 def runMgmtUserControllerTest = env.RUN_MGMT_USER_CONTROLLER_TEST ? env.RUN_MGMT_USER_CONTROLLER_TEST.toBoolean() : false
Mikhail Ivanov2907e4d2022-04-25 16:41:21 +040075 def runProxyChildTest = env.RUN_PROXY_CHILD_TEST ? env.RUN_PROXY_CHILD_TEST.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020076 def runChildConformance = env.RUN_CHILD_CFM ? env.RUN_CHILD_CFM.toBoolean() : false
Sergey Lalovafcc0432023-04-13 14:59:06 +040077 def runChildConformanceNetworkPolicy = env.RUN_CHILD_CFM_NETWORK_POLICY ? env.RUN_CHILD_CFM_NETWORK_POLICY.toBoolean() : false
vryzhenkinb286bd82023-04-04 07:17:52 +040078 def runChildHPA = env.RUN_CHILD_HPA ? env.RUN_CHILD_HPA.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020079 def fetchServiceBinaries = env.FETCH_BINARIES_FROM_UPSTREAM ? env.FETCH_BINARIES_FROM_UPSTREAM.toBoolean() : false
Vladislav Naumov42b71dc2021-11-22 13:09:42 +010080 def equinixMetalV2ChildDiffMetro = env.EQUINIXMETALV2_CHILD_DIFF_METRO ? env.EQUINIXMETALV2_CHILD_DIFF_METRO.toBoolean() : false
slalov13e579c2022-01-31 21:37:02 +040081 def runMaintenanceTest = env.RUN_MAINTENANCE_TEST ? env.RUN_MAINTENANCE_TEST.toBoolean() : false
slalov0a4947a2022-06-09 15:44:35 +040082 def runContainerregistryTest = env.RUN_CONTAINER_REGISTRY_TEST ? env.RUN_CONTAINER_REGISTRY_TEST.toBoolean() : false
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +030083 def runMgmtDeleteMasterTest = env.RUN_MGMT_DELETE_MASTER_TEST ? env.RUN_MGMT_DELETE_MASTER_TEST.toBoolean() : false
84 def runRgnlDeleteMasterTest = env.RUN_RGNL_DELETE_MASTER_TEST ? env.RUN_RGNL_DELETE_MASTER_TEST.toBoolean() : false
85 def runChildDeleteMasterTest = env.RUN_CHILD_DELETE_MASTER_TEST ? env.RUN_CHILD_DELETE_MASTER_TEST.toBoolean() : false
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +030086 def runGracefulRebootTest = env.RUN_GRACEFUL_REBOOT_TEST ? env.RUN_GRACEFUL_REBOOT_TEST.toBoolean() : false
Sergey Lalovbc68d752022-11-08 13:40:53 +040087 def pauseForDebug = env.PAUSE_FOR_DEBUG ? env.PAUSE_FOR_DEBUG.toBoolean() : false
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +030088 def runChildMachineDeletionPolicyTest = env.RUN_CHILD_MACHINE_DELETION_POLICY_TEST ? env.RUN_CHILD_MACHINE_DELETION_POLICY_TEST.toBoolean() : false
Sergey Lalovd3e030e2023-03-16 14:32:47 +040089 def runChildCustomCertTest = env.RUN_CHILD_CUSTOM_CERT_TEST ? env.RUN_CHILD_CUSTOM_CERT_TEST.toBoolean() : false
Sergey Lalov430fcd72023-03-20 17:19:44 +040090 def runByoChildCustomCertTest = env.RUN_BYO_CHILD_CUSTOM_CERT_TEST ? env.RUN_BYO_CHILD_CUSTOM_CERT_TEST.toBoolean() : false
Sergey Lalovf6fbfea2023-04-06 17:05:40 +040091 def runMgmtCustomCacheCertTest = env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST ? env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST.toBoolean() : false
Владислав Наумов765f3bd2020-09-07 18:09:24 +020092 // multiregion configuration from env variable: comma-separated string in form $mgmt_provider,$regional_provider
93 def multiregionalMappings = env.MULTIREGION_SETUP ? multiregionWorkflowParser(env.MULTIREGION_SETUP) : [
94 enabled: false,
95 managementLocation: '',
96 regionLocation: '',
97 ]
Владислав Наумов4eb1da32020-08-31 14:45:16 +020098
Владислав Наумовb8305e22021-02-10 17:23:12 +010099 // proxy customization
100 def proxyConfig = [
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200101 mgmtOffline: env.OFFLINE_MGMT_CLUSTER ? env.OFFLINE_MGMT_CLUSTER.toBoolean() : false,
102 childOffline: env.OFFLINE_CHILD_CLUSTER ? env.OFFLINE_CHILD_CLUSTER.toBoolean() : false,
Владислав Наумов257ea132021-04-14 14:44:13 +0200103 childProxy: env.PROXY_CHILD_CLUSTER ? env.PROXY_CHILD_CLUSTER.toBoolean() : false,
Владислав Наумовb8305e22021-02-10 17:23:12 +0100104 ]
105
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200106 // optional demo deployment customization
Владислав Наумов905dd362020-06-08 16:37:01 +0200107 def awsOnDemandDemo = env.ALLOW_AWS_ON_DEMAND ? env.ALLOW_AWS_ON_DEMAND.toBoolean() : false
Владислав Наумовe021b022021-05-06 11:26:38 +0200108 def equinixOnDemandDemo = env.ALLOW_EQUINIX_ON_DEMAND ? env.ALLOW_EQUINIX_ON_DEMAND.toBoolean() : false
Владислав Наумов82305e92021-10-14 20:45:20 +0200109 def equinixMetalV2OnDemandDemo = env.ALLOW_EQUINIXMETALV2_ON_DEMAND ? env.ALLOW_EQUINIXMETALV2_ON_DEMAND.toBoolean() : false
Владислав Наумовf3715802021-05-03 18:06:45 +0200110 def equinixOnAwsDemo = env.EQUINIX_ON_AWS_DEMO ? env.EQUINIX_ON_AWS_DEMO.toBoolean() : false
Владислав Наумов2d3db332021-06-15 15:19:19 +0200111 def azureOnAwsDemo = env.AZURE_ON_AWS_DEMO ? env.AZURE_ON_AWS_DEMO.toBoolean() : false
Владислав Наумовc52dd9d2021-06-28 16:27:29 +0200112 def azureOnDemandDemo = env.ALLOW_AZURE_ON_DEMAND ? env.ALLOW_AZURE_ON_DEMAND.toBoolean() : false
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400113 def enableVsphereDemo = true
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200114 def enableOSDemo = true
azvyagintsev1761bdc2020-09-04 17:24:12 +0300115 def enableBMDemo = true
Mikhail Ivanovbd1a9fd2022-03-29 21:36:21 +0400116 def enableArtifactsBuild = true
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400117 def openstackIMC = env.OPENSTACK_CLOUD_LOCATION ? env.OPENSTACK_CLOUD_LOCATION : 'us'
Alexandr Lovtsov36473f32022-04-28 15:46:09 +0300118 def enableVsphereUbuntu = env.VSPHERE_DEPLOY_UBUNTU ? env.VSPHERE_DEPLOY_UBUNTU.toBoolean() : false
Sergey Zhemerdeeve67fb262022-06-21 00:49:34 +0300119 def childOsBootFromVolume = env.OPENSTACK_BOOT_FROM_VOLUME ? env.OPENSTACK_BOOT_FROM_VOLUME.toBoolean() : false
Ivan Berezovskiy29e72b72022-07-12 21:03:24 +0400120 def bootstrapV2Scenario = env.BOOTSTRAP_V2_ENABLED ? env.BOOTSTRAP_V2_ENABLED.toBoolean() : false
Sergey Lalovacec3c12022-07-20 16:00:14 +0400121 def equinixMetalV2Metro = env.EQUINIX_MGMT_METRO ? env.EQUINIX_MGMT_METRO : ''
Mikhail Ivanov3088d3d2022-10-24 14:05:46 +0400122 def enableFips = env.ENABLE_FIPS ? env.ENABLE_FIPS.toBoolean() : false
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300123 def aioCluster = env.AIO_CLUSTER ? env.AIO_CLUSTER.toBoolean() : false
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100124 def useVsphereVvmtObjects = env.VSPHERE_USE_VVMT_OBJECTS ? env.VSPHERE_USE_VVMT_OBJECTS.toBoolean() : false
vryzhenkin4fd3f242023-03-29 15:13:46 +0400125 def enableBv2Smoke = true
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400126 def runCacheWarmup = env.CACHE_WARMUP_ENABLED ? env.CACHE_WARMUP_ENABLED.toBoolean() : false
vnaumov33747e12020-05-04 17:35:20 +0200127
Владислав Наумов6c2afff2020-06-05 12:54:53 +0200128 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
Владислав Наумовb8305e22021-02-10 17:23:12 +0100129 if (commitMsg ==~ /(?s).*\[mgmt-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-proxy.*/) {
130 proxyConfig['mgmtOffline'] = true
Владислав Наумов70c02422021-04-19 14:29:41 +0200131 common.warningMsg('Forced running offline mgmt deployment, some provider CDN regions for mgmt deployment may be set to *public-ci* to verify proxy configuration')
Владислав Наумовb8305e22021-02-10 17:23:12 +0100132 }
Sergey Kolekonov5995dfd2023-07-06 16:09:43 +0600133 if (commitMsg ==~ /(?s).*\[mgmt-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-upgrade.*/) {
134 upgradeMgmt = true
135 }
136 if (commitMsg ==~ /(?s).*\[auto-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*auto-upgrade.*/) {
137 autoUpgradeMgmt = true
138 }
Владислав Наумов44c64b72020-12-04 20:22:53 +0100139 if (commitMsg ==~ /(?s).*\[seed-macos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*seed-macos.*/) {
140 seedMacOs = true
141 }
Sergey Lalovafcc0432023-04-13 14:59:06 +0400142 if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ ||
143 upgradeChild || runChildConformance || runProxyChildTest || runChildHPA || runChildConformanceNetworkPolicy) {
vnaumov33747e12020-05-04 17:35:20 +0200144 deployChild = true
145 }
146 if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) {
147 deployChild = true
148 upgradeChild = true
149 }
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400150 if (commitMsg ==~ /(?s).*\[child-upgrade-full\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade-full.*/) {
151 deployChild = true
152 upgradeChild = true
Sergey Lalova048df92023-06-19 19:36:41 +0400153 common.warningMsg("2-step child updates are not testing (PRODX-33510)")
154 //TODO: revert after start testing the two-step upgrade again (PRODX-33510)
155 //fullUpgradeChild = true
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400156 }
Sergey Kolekonov5995dfd2023-07-06 16:09:43 +0600157 if ((upgradeMgmt || autoUpgradeMgmt) && deployChild) {
158 upgradeChild = true
159 common.warningMsg('child upgrade is automatically enabled as mgmt upgrade and child deploy are enabled')
160 }
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400161 def childDeployMatches = (commitMsg =~ /(\[child-deploy\s*(\w|\-)+?\])/)
162 if (childDeployMatches.size() > 0) {
Mikhail Ivanov74504372021-05-21 17:01:06 +0400163 // override child version when it set explicitly
164 deployChild = true
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400165 customChildRelease = childDeployMatches[0][0].split('child-deploy')[1].replaceAll('[\\[\\]]', '').trim()
Mikhail Ivanov74504372021-05-21 17:01:06 +0400166 common.warningMsg("Forced child deployment using custom release version ${customChildRelease}")
167 }
Mikhail Ivanov38ee4382022-01-27 16:21:51 +0400168 if (commitMsg ==~ /(?s).*\[mos-child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-deploy.*/) {
169 mosDeployChild = true
170 }
171 if (commitMsg ==~ /(?s).*\[mos-child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-upgrade.*/) {
172 mosDeployChild = true
173 mosUpgradeChild = true
174 }
Sergey Kolekonov5995dfd2023-07-06 16:09:43 +0600175 if ((upgradeMgmt || autoUpgradeMgmt) && mosDeployChild) {
176 mosUpgradeChild = true
177 common.warningMsg('MOSK child upgrade is automatically enabled as mgmt upgrade and MOSK child deploy are enabled')
178 }
Владислав Наумов0dc99252020-11-13 13:30:48 +0100179 if (commitMsg ==~ /(?s).*\[byo-attach\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-attach.*/) {
180 attachBYO = true
181 }
Владислав Наумовcdbd84e2020-12-01 16:51:09 +0100182 if (commitMsg ==~ /(?s).*\[byo-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-upgrade.*/) {
183 attachBYO = true
184 upgradeBYO = true
185 }
Sergey Lalovacec3c12022-07-20 16:00:14 +0400186 if (commitMsg ==~ /(?s).*\[ui-test-on-all-providers\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-test-on-all-providers.*/) {
187 enableVsphereDemo = true
188 enableOSDemo = true
189 awsOnDemandDemo = true
190 azureOnDemandDemo = true
191 equinixOnDemandDemo = true
192 equinixMetalV2OnDemandDemo = true
193 runUie2e = true
Sergey Lalovacec3c12022-07-20 16:00:14 +0400194 // Edit after fix PRODX-3961
195 enableBMDemo = false
196 }
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400197 def byoDeployMatches = (commitMsg =~ /(\[run-byo-matrix\s*(ubuntu|centos)\])/)
198 if (commitMsg ==~ /(?s).*\[run-byo-matrix\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*run-byo-matrix\.*/ || byoDeployMatches.size() > 0) {
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100199 runBYOMatrix = true
200
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400201 if (byoDeployMatches.size() > 0) {
202 defaultBYOOs = byoDeployMatches[0][2]
203 common.warningMsg("Custom BYO OS detected, using ${defaultBYOOs}")
204 }
205
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100206 common.warningMsg('Forced byo matrix test via run-byo-matrix, all other byo triggers will be skipped')
207 attachBYO = false
208 upgradeBYO = false
209 }
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400210 if (commitMsg ==~ /(?s).*\[lma-logging\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-logging.*/) {
211 enableLMALogging = true
212 }
Sergey Lalovb2f60372022-09-20 23:58:47 +0400213 if (commitMsg ==~ /(?s).*\[deploy-os-on-mos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*deploy-os-on-mos.*/) {
214 deployOsOnMos = true
215 mosDeployChild = true
216 openstackIMC = 'eu2'
217 }
Sergey Lalov95040602023-03-07 16:42:16 +0400218 if (commitMsg ==~ /(?s).*\[ui-e2e-nw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-nw.*/) {
vnaumov33747e12020-05-04 17:35:20 +0200219 runUie2e = true
220 }
Sergey Lalov95040602023-03-07 16:42:16 +0400221 if (commitMsg ==~ /(?s).*\[ui-e2e-pw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-pw.*/) {
Mikhail Ivanovf5e20af2022-03-24 15:38:06 +0400222 runUie2eNew = true
223 }
vnaumov33747e12020-05-04 17:35:20 +0200224 if (commitMsg ==~ /(?s).*\[mgmt-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm.*/) {
225 runMgmtConformance = true
226 }
Sergey Lalovafcc0432023-04-13 14:59:06 +0400227 if (commitMsg ==~ /(?s).*\[mgmt-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm-netpolicy.*/) {
228 runMgmtConformanceNetworkPolicy = true
229 }
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +0200230 if (commitMsg ==~ /(?s).*\[test-user-controller\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-user-controller.*/) {
231 runMgmtUserControllerTest = true
232 }
slalov574123e2022-04-06 17:24:19 +0400233 if (commitMsg ==~ /(?s).*\[test-proxy-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-proxy-child.*/) {
234 runProxyChildTest = true
235 deployChild = true
236 common.infoMsg('Child cluster deployment will be enabled since proxy child test suite will be executed')
237 }
vnaumov33747e12020-05-04 17:35:20 +0200238 if (commitMsg ==~ /(?s).*\[child-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm.*/) {
239 runChildConformance = true
240 deployChild = true
241 }
Sergey Lalovafcc0432023-04-13 14:59:06 +0400242 if (commitMsg ==~ /(?s).*\[child-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm-netpolicy.*/) {
243 runChildConformanceNetworkPolicy = true
244 deployChild = true
245 }
vryzhenkinb286bd82023-04-04 07:17:52 +0400246 if (commitMsg ==~ /(?s).*\[child-hpa\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-hpa.*/) {
247 runChildHPA = true
248 deployChild = true
249 }
Владислав Наумов9cec55d2021-08-03 15:00:59 +0200250 if (commitMsg ==~ /(?s).*\[lma-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-test.*/) {
251 runLMATest = true
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400252 enableLMALogging = true
253 common.infoMsg('LMA logging will be enabled since LMA test suite will be executed')
Victor Ryzhenkin15206592021-06-21 17:38:23 +0400254 }
slalov13e579c2022-01-31 21:37:02 +0400255 if (commitMsg ==~ /(?s).*\[maintenance-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*maintenance-test.*/) {
256 runMaintenanceTest = true
257 }
slalov0a4947a2022-06-09 15:44:35 +0400258 if (commitMsg ==~ /(?s).*\[container-registry-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*container-registry-test.*/) {
259 runContainerregistryTest = true
260 }
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300261 if (commitMsg ==~ /(?s).*\[mgmt-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-delete-master-test.*/) {
262 runMgmtDeleteMasterTest = true
263 }
264 if (commitMsg ==~ /(?s).*\[rgnl-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*rgnl-delete-master-test.*/) {
265 runRgnlDeleteMasterTest = true
266 }
267 if (commitMsg ==~ /(?s).*\[child-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-delete-master-test.*/) {
268 runChildDeleteMasterTest = true
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300269 deployChild = true
270 common.infoMsg('Child cluster deployment will be enabled since delete child master node test suite will be executed')
271 }
272 if (commitMsg ==~ /(?s).*\[child-machine-deletion-policy-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-machine-deletion-policy-test.*/) {
273 runChildMachineDeletionPolicyTest = true
274 deployChild = true
275 common.infoMsg('Child cluster deployment will be enabled since machine deletion child policy test suite will be executed')
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300276 }
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +0300277 if (commitMsg ==~ /(?s).*\[graceful-reboot-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*graceful-reboot-test.*/) {
278 runGracefulRebootTest = true
279 }
Sergey Lalovbc68d752022-11-08 13:40:53 +0400280 if (commitMsg ==~ /(?s).*\[pause-for-debug\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*pause-for-debug.*/) {
281 pauseForDebug = true
282 }
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200283 if (commitMsg ==~ /(?s).*\[child-offline\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-offline.*/) {
284 proxyConfig['childOffline'] = true
285 deployChild = true
286 }
Владислав Наумов257ea132021-04-14 14:44:13 +0200287 if (commitMsg ==~ /(?s).*\[child-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-proxy.*/) {
288 proxyConfig['childOffline'] = true
289 proxyConfig['childProxy'] = true
290 deployChild = true
291 }
vnaumov33747e12020-05-04 17:35:20 +0200292 if (commitMsg ==~ /(?s).*\[fetch.*binaries\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*fetch.*binaries.*/) {
293 fetchServiceBinaries = true
294 }
Владислав Наумовf1665b52021-05-13 10:51:17 +0200295 if (commitMsg ==~ /(?s).*\[equinix-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-on-aws.*/) {
eromanovadf247c32020-12-25 15:44:13 +0400296 equinixOnAwsDemo = true
Владислав Наумовf1665b52021-05-13 10:51:17 +0200297 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]\' ')
eromanovadf247c32020-12-25 15:44:13 +0400298 }
Владислав Наумов2d3db332021-06-15 15:19:19 +0200299 if (commitMsg ==~ /(?s).*\[azure-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-on-aws.*/) {
300 azureOnAwsDemo = true
301 common.warningMsg('Forced running child cluster deployment on Azure provider based on AWS management cluster, triggered on patchset using custom keyword: \'[azure-on-aws]\' ')
302 }
303 if (commitMsg ==~ /(?s).*\[aws-demo\].*/ ||
304 env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aws-demo.*/ ||
305 attachBYO ||
306 upgradeBYO ||
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100307 runBYOMatrix ||
Владислав Наумов2d3db332021-06-15 15:19:19 +0200308 seedMacOs ||
309 equinixOnAwsDemo ||
310 azureOnAwsDemo) {
311
vnaumov33747e12020-05-04 17:35:20 +0200312 awsOnDemandDemo = true
Владислав Наумов2d3db332021-06-15 15:19:19 +0200313 common.warningMsg('Running additional kaas deployment with AWS provider, may be forced due applied trigger cross dependencies, follow docs to clarify info')
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200314 }
Владислав Наумовf1665b52021-05-13 10:51:17 +0200315 if (commitMsg ==~ /(?s).*\[equinix-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-demo\.*/) {
Владислав Наумовe021b022021-05-06 11:26:38 +0200316 equinixOnDemandDemo = true
317 }
Владислав Наумов82305e92021-10-14 20:45:20 +0200318 if (commitMsg ==~ /(?s).*\[equinixmetalv2-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-demo\.*/) {
Владислав Наумов144956f2021-10-14 17:49:19 +0200319 equinixMetalV2OnDemandDemo = true
320 }
Vladislav Naumov42b71dc2021-11-22 13:09:42 +0100321 if (commitMsg ==~ /(?s).*\[equinixmetalv2-child-diff-metro\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-child-diff-metro\.*/) {
322 equinixMetalV2OnDemandDemo = true
323 equinixMetalV2ChildDiffMetro = true
324 }
Владислав Наумовc52dd9d2021-06-28 16:27:29 +0200325 if (commitMsg ==~ /(?s).*\[azure-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-demo\.*/) {
326 azureOnDemandDemo = true
327 }
Sergey Lalov10cb3502023-03-27 22:13:49 +0400328 if (commitMsg ==~ /(?s).*\[disable-all-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-all-demo\.*/) {
329 enableVsphereDemo = false
330 enableOSDemo = false
331 enableBMDemo = false
332 common.errorMsg('vSphere, BM, Openstack demo deployments will be aborted, VF -1 will be set')
333 }
334
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200335 if (commitMsg ==~ /(?s).*\[disable-os-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-os-demo\.*/) {
336 enableOSDemo = false
337 common.errorMsg('Openstack demo deployment will be aborted, VF -1 will be set')
vnaumov33747e12020-05-04 17:35:20 +0200338 }
339
azvyagintsev1761bdc2020-09-04 17:24:12 +0300340 if (commitMsg ==~ /(?s).*\[disable-bm-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-demo\.*/) {
341 enableBMDemo = false
342 common.errorMsg('BM demo deployment will be aborted, VF -1 will be set')
343 }
344
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400345 if (commitMsg ==~ /(?s).*\[disable-vsphere-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-vsphere-demo\.*/) {
346 enableVsphereDemo = false
347 common.errorMsg('vSphere demo deployment will be aborted, VF -1 will be set')
348 }
Alexandr Lovtsov36473f32022-04-28 15:46:09 +0300349 if (commitMsg ==~ /(?s).*\[vsphere-ubuntu\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-ubuntu\.*/) {
350 enableVsphereUbuntu = true
351 common.warningMsg('Ubuntu will be used to deploy vsphere machines')
352 }
vryzhenkin4fd3f242023-03-29 15:13:46 +0400353 if (commitMsg ==~ /(?s).*\[disable-bv2-smoke\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bv2-smoke\.*/) {
354 enableBv2Smoke = false
355 common.errorMsg('Bootstrap v2 smoke checks will be aborted, WF -1 will be set')
356 }
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400357
Mikhail Ivanovbd1a9fd2022-03-29 21:36:21 +0400358 if (commitMsg ==~ /(?s).*\[disable-artifacts-build\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-artifacts-build\.*/) {
359 enableArtifactsBuild = false
360 common.errorMsg('artifacts build will be aborted, VF -1 will be set')
361 }
362
Sergey Zhemerdeeve67fb262022-06-21 00:49:34 +0300363 if (commitMsg ==~ /(?s).*\[child-os-boot-from-volume\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-os-boot-from-volume\.*/) {
364 childOsBootFromVolume = true
365 common.warningMsg('OS will be booted from Ceph volumes')
366 }
367
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400368 if (commitMsg ==~ /(?s).*\[child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-custom-cert-test\.*/) {
369 runChildCustomCertTest = true
370 deployChild = true
371 common.warningMsg('Child cluster deployment will be enabled since custom cert child test suite will be executed')
372 }
373
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400374 if (commitMsg ==~ /(?s).*\[mgmt-custom-cache-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-custom-cache-cert-test\.*/) {
375 runMgmtCustomCacheCertTest = true
376 deployChild = true
377 common.warningMsg('Child cluster deployment will be enabled as the test replaces the mgmt and cluster childcertificates')
378 }
379
Sergey Lalov430fcd72023-03-20 17:19:44 +0400380 if (commitMsg ==~ /(?s).*\[byo-child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-child-custom-cert-test\.*/) {
381 runByoChildCustomCertTest = true
382 attachBYO = true
383 common.warningMsg('Byo child cluster deployment will be enabled since custom cert child test suite will be executed')
384 }
385
vnaumov33747e12020-05-04 17:35:20 +0200386 // TODO (vnaumov) remove below condition after moving all releases to UCP
387 def ucpChildMatches = (commitMsg =~ /(\[child-ucp\s*ucp-.*?\])/)
388 if (ucpChildMatches.size() > 0) {
389 deployChild = true
390 common.warningMsg('Forced UCP based child deployment triggered on patchset using custom keyword: \'[child-ucp ucp-5-1-0-3-3-0-example]\' ')
391
392 // TODO(vnaumov) delete after ucp upgrades support
393 common.errorMsg('Child upgrade test will be skipped, UCP upgrades temporally disabled')
394 upgradeChild = false
395 }
396
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300397 if (commitMsg ==~ /(?s).*\[aio-cluster\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aio-cluster.*/) {
398 aioCluster = true
399 }
400
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400401 if (commitMsg ==~ /(?s).*\[cache-warmup\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*cache-warmup.*/) {
402 runCacheWarmup = true
403 }
404
405 if (runCacheWarmup && (!deployChild && !mosDeployChild)) {
406 runCacheWarmup = false
407 common.errorMsg('Child cluster deployment is not enabled, skipping Cache Warmup')
408 }
409
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200410 // multiregional tests
411 def multiRegionalMatches = (commitMsg =~ /(\[multiregion\s*.*?\])/)
412 if (multiRegionalMatches.size() > 0) {
413 multiregionalMappings = multiregionWorkflowParser(multiRegionalMatches)
414 }
415 switch (multiregionalMappings['managementLocation']) {
416 case 'aws':
Владислав Наумов53b07e52021-01-07 15:08:27 +0100417 common.warningMsg('Forced running additional kaas deployment with AWS provider according multiregional demo request')
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200418 awsOnDemandDemo = true
Владислав Наумов53b07e52021-01-07 15:08:27 +0100419
420 if (multiregionalMappings['regionLocation'] != 'aws' && seedMacOs) { // macstadium seed node has access only to *public* providers
421 error('incompatible triggers: [seed-macos] and multiregional deployment based on *private* regional provider cannot be applied simultaneously')
422 }
Владислав Наумов3e4b5a32020-09-11 17:05:34 +0200423 break
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200424 case 'os':
425 if (enableOSDemo == false) {
426 error('incompatible triggers: [disable-os-demo] and multiregional deployment based on OSt management region cannot be applied simultaneously')
427 }
Владислав Наумов3e4b5a32020-09-11 17:05:34 +0200428 break
Владислав Наумов865ba6c2021-05-13 13:05:45 +0200429 case 'vsphere':
430 if (enableVsphereDemo == false) {
431 error('incompatible triggers: [disable-vsphere-demo] and multiregional deployment based on Vsphere management region cannot be applied simultaneously')
432 }
433 break
Владислав Наумов5be02942021-05-13 12:34:37 +0200434 case 'equinix':
435 common.warningMsg('Forced running additional kaas deployment with Equinix provider according multiregional demo request')
436 equinixOnDemandDemo = true
eromanova35359162021-12-30 14:13:13 +0400437 break
eromanova8c702ae2021-12-24 17:43:12 +0400438 case 'equinixmetalv2':
439 common.warningMsg('Forced running additional kaas deployment with Equinix Metal V2 provider according multiregional demo request')
440 equinixMetalV2OnDemandDemo = true
eromanova35359162021-12-30 14:13:13 +0400441 break
slalovfd0b7e62021-07-28 18:05:16 +0400442 case 'azure':
443 common.warningMsg('Forced running additional kaas deployment with Azure provider according multiregional demo request')
444 azureOnDemandDemo = true
445 break
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200446 }
447
Владислав Наумовb8305e22021-02-10 17:23:12 +0100448 // CDN configuration
449 def cdnConfig = [
450 mgmt: [
Sergey Lalovde909ea2023-05-31 20:21:02 +0400451 openstack: 'internal-ci',
Владислав Наумов70c02422021-04-19 14:29:41 +0200452 vsphere: 'internal-ci',
Владислав Наумовb8305e22021-02-10 17:23:12 +0100453 aws: 'public-ci',
Владислав Наумовe021b022021-05-06 11:26:38 +0200454 equinix: 'public-ci',
Владислав Наумовc52dd9d2021-06-28 16:27:29 +0200455 azure: 'public-ci',
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200456 ],
Владислав Наумовb8305e22021-02-10 17:23:12 +0100457 ]
458
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400459 if (commitMsg ==~ /(?s).*\[eu-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*eu-demo.*/) {
460 openstackIMC = 'eu'
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400461 }
slalov021171f2022-03-04 14:48:38 +0400462 if (commitMsg ==~ /(?s).*\[mos-tf-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-tf-demo.*/) {
463 openstackIMC = 'eu2'
Mikhail Ivanovf05b8252022-04-27 18:14:03 +0400464 }
465 if (openstackIMC == 'eu' || openstackIMC == 'eu2') {
slalov021171f2022-03-04 14:48:38 +0400466 // use internal-eu because on internal-ci with eu cloud image pull takes much time
Sergey Lalovde909ea2023-05-31 20:21:02 +0400467 def cdnRegion = 'internal-eu'
slalov021171f2022-03-04 14:48:38 +0400468 common.infoMsg("eu2-demo was triggered, force switching CDN region to ${cdnRegion}")
469 cdnConfig['mgmt']['openstack'] = cdnRegion
470 }
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400471
Владислав Наумов74e2d6e2020-12-30 17:05:40 +0100472 // calculate weight of current demo run to manage lockable resources
Sergey Lalov46deb442022-08-18 12:11:03 +0400473 def demoWeight = deployChild ? 2 : 1 // management = 1, child += 1
Sergey Lalov95040602023-03-07 16:42:16 +0400474 if (runUie2e || runUie2eNew) {
Sergey Lalov46deb442022-08-18 12:11:03 +0400475 demoWeight += 1
476 }
Владислав Наумов74e2d6e2020-12-30 17:05:40 +0100477
Ivan Berezovskiy29e72b72022-07-12 21:03:24 +0400478 if (commitMsg ==~ /(?s).*\[bootstrapv2-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv2-scenario\.*/) {
479 bootstrapV2Scenario = true
480 }
481
Mikhail Ivanov3088d3d2022-10-24 14:05:46 +0400482 if (commitMsg ==~ /(?s).*\[enable-fips\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*enable-fips\.*/) {
483 enableFips = true
484 }
485
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100486 if (commitMsg ==~ /(?s).*\[vsphere-vvmt-obj\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-vvmt-obj\.*/) {
487 useVsphereVvmtObjects = true
488 }
489
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300490 // parse equinixmetalv2-metro trigger
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300491 def equinixMetalV2MetroMatcher = (commitMsg =~ /\[equinixmetalv2-metro(\s+.*)?\]/)
492 if (equinixMetalV2OnDemandDemo && equinixMetalV2MetroMatcher.size() > 0) {
Sergey Zhemerdeevcc785e42022-07-22 17:15:47 +0300493 equinixMetalV2Metro = equinixMetalV2MetroMatcher[0][1].trim().toLowerCase()
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300494 common.infoMsg("Forced Equnix mgmt deployment using custom metro ${equinixMetalV2Metro}")
495 }
496
vnaumov33747e12020-05-04 17:35:20 +0200497 common.infoMsg("""
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400498 OpenStack Cloud location: ${openstackIMC}
Владислав Наумовb8305e22021-02-10 17:23:12 +0100499 CDN deployment configuration: ${cdnConfig}
500 MCC offline deployment configuration: ${proxyConfig}
Владислав Наумов44c64b72020-12-04 20:22:53 +0100501 Use MacOS node as seed: ${seedMacOs}
vnaumov33747e12020-05-04 17:35:20 +0200502 Child cluster deployment scheduled: ${deployChild}
Mikhail Ivanov74504372021-05-21 17:01:06 +0400503 Custom child cluster release: ${customChildRelease}
vnaumov33747e12020-05-04 17:35:20 +0200504 Child cluster release upgrade scheduled: ${upgradeChild}
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400505 Full Child cluster release upgrade scheduled: ${fullUpgradeChild}
Mikhail Ivanov38ee4382022-01-27 16:21:51 +0400506 MOS child deploy scheduled: ${mosDeployChild}
507 MOS child upgrade scheduled: ${mosUpgradeChild}
vnaumov33747e12020-05-04 17:35:20 +0200508 Child conformance testing scheduled: ${runChildConformance}
Sergey Lalovafcc0432023-04-13 14:59:06 +0400509 Child conformance network policy testing scheduled: ${runChildConformanceNetworkPolicy}
vryzhenkinb286bd82023-04-04 07:17:52 +0400510 Child HPA testing scheduled: ${runChildHPA}
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100511 Single BYO cluster attachment scheduled: ${attachBYO}
512 Single Attached BYO cluster upgrade test scheduled: ${upgradeBYO}
513 BYO test matrix whole suite scheduled: ${runBYOMatrix}
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400514 Default BYO OS: ${defaultBYOOs}
vnaumov33747e12020-05-04 17:35:20 +0200515 Mgmt cluster release upgrade scheduled: ${upgradeMgmt}
slalov1202bba2022-04-20 22:31:07 +0400516 Mgmt cluster release auto upgrade scheduled: ${autoUpgradeMgmt}
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400517 Mgmt LMA logging enabled: ${enableLMALogging}
Sergey Lalovb2f60372022-09-20 23:58:47 +0400518 Deploy Os on child with mos release ${deployOsOnMos}
vnaumov33747e12020-05-04 17:35:20 +0200519 Mgmt conformance testing scheduled: ${runMgmtConformance}
Sergey Lalovafcc0432023-04-13 14:59:06 +0400520 Mgmt conformance network policy testing scheduled: ${runMgmtConformanceNetworkPolicy}
Владислав Наумов9cec55d2021-08-03 15:00:59 +0200521 LMA testing scheduled: ${runLMATest}
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +0200522 Mgmt user controller testing scheduled: ${runMgmtUserControllerTest}
vnaumov33747e12020-05-04 17:35:20 +0200523 Mgmt UI e2e testing scheduled: ${runUie2e}
Mikhail Ivanovf5e20af2022-03-24 15:38:06 +0400524 Mgmt UI e2e playwrite testing scheduled: ${runUie2eNew}
slalov13e579c2022-01-31 21:37:02 +0400525 Maintenance test: ${runMaintenanceTest}
slalov0a4947a2022-06-09 15:44:35 +0400526 Container Registry test: ${runContainerregistryTest}
slalov574123e2022-04-06 17:24:19 +0400527 Child proxy test: ${runProxyChildTest}
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +0300528 Graceful reboot test: ${runGracefulRebootTest}
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300529 Delete mgmt master node test: ${runMgmtDeleteMasterTest}
530 Delete rgnl master node test: ${runRgnlDeleteMasterTest}
531 Delete child master node test: ${runChildDeleteMasterTest}
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300532 Child machine deletion policy test: ${runChildMachineDeletionPolicyTest}
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400533 Custom cert test for child clusters: ${runChildCustomCertTest}
Sergey Lalov430fcd72023-03-20 17:19:44 +0400534 Custom cert test for Byo child clusters: ${runByoChildCustomCertTest}
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400535 Custom cache cert test for mgmt and child clusters: ${runMgmtCustomCacheCertTest}
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200536 AWS provider deployment scheduled: ${awsOnDemandDemo}
Владислав Наумовe021b022021-05-06 11:26:38 +0200537 Equinix provider deployment scheduled: ${equinixOnDemandDemo}
Владислав Наумов144956f2021-10-14 17:49:19 +0200538 EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo}
Vladislav Naumov42b71dc2021-11-22 13:09:42 +0100539 EquinixmetalV2 child deploy in a separate metro scheduled: ${equinixMetalV2ChildDiffMetro}
Sergey Zhemerdeev019c45a2022-08-13 00:09:07 +0300540 EquinixmetalV2 mgmt will be deployed on the metro: ${equinixMetalV2Metro?:'auto'}
Владислав Наумовf1665b52021-05-13 10:51:17 +0200541 Equinix@AWS child cluster deployment scheduled: ${equinixOnAwsDemo}
Владислав Наумовc52dd9d2021-06-28 16:27:29 +0200542 Azure provider deployment scheduled: ${azureOnDemandDemo}
Владислав Наумов2d3db332021-06-15 15:19:19 +0200543 Azure@AWS child cluster deployment scheduled: ${azureOnAwsDemo}
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400544 VSPHERE provider deployment scheduled: ${enableVsphereDemo}
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200545 OS provider deployment scheduled: ${enableOSDemo}
azvyagintsev1761bdc2020-09-04 17:24:12 +0300546 BM provider deployment scheduled: ${enableBMDemo}
Alexandr Lovtsov36473f32022-04-28 15:46:09 +0300547 Ubuntu on vSphere scheduled: ${enableVsphereUbuntu}
Mikhail Ivanovbd1a9fd2022-03-29 21:36:21 +0400548 Artifacts build scheduled: ${enableArtifactsBuild}
Sergey Zhemerdeeve67fb262022-06-21 00:49:34 +0300549 Boot OS child from Ceph volumes: ${childOsBootFromVolume}
Владислав Наумовf793fe32020-09-11 15:19:19 +0200550 Multiregional configuration: ${multiregionalMappings}
vnaumov33747e12020-05-04 17:35:20 +0200551 Service binaries fetching scheduled: ${fetchServiceBinaries}
Владислав Наумов74e2d6e2020-12-30 17:05:40 +0100552 Current weight of the demo run: ${demoWeight} (Used to manage lockable resources)
Ivan Berezovskiy29e72b72022-07-12 21:03:24 +0400553 Bootstrap v2 scenario enabled: ${bootstrapV2Scenario}
Mikhail Ivanov3088d3d2022-10-24 14:05:46 +0400554 FIPS enabled: ${enableFips}
Sergey Lalovbc68d752022-11-08 13:40:53 +0400555 Pause for debug enabled: ${pauseForDebug}
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300556 AIO cluster: ${aioCluster}
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100557 Use Vsphere VVMT Objects: ${useVsphereVvmtObjects}
vryzhenkin4fd3f242023-03-29 15:13:46 +0400558 Bootsrap v2 smoke checks enabled: ${enableBv2Smoke}
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400559 Run Cache warmup for child clusters: ${runCacheWarmup}
Владислав Наумов81777472021-03-09 15:14:27 +0400560 Triggers: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
vnaumov33747e12020-05-04 17:35:20 +0200561 return [
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300562 osCloudLocation : openstackIMC,
563 cdnConfig : cdnConfig,
564 proxyConfig : proxyConfig,
565 useMacOsSeedNode : seedMacOs,
566 deployChildEnabled : deployChild,
567 childDeployCustomRelease : customChildRelease,
568 upgradeChildEnabled : upgradeChild,
569 fullUpgradeChildEnabled : fullUpgradeChild,
570 mosDeployChildEnabled : mosDeployChild,
571 mosUpgradeChildEnabled : mosUpgradeChild,
572 runChildConformanceEnabled : runChildConformance,
Sergey Lalovafcc0432023-04-13 14:59:06 +0400573 runChildConformanceNetworkPolicyEnabled : runChildConformanceNetworkPolicy,
vryzhenkinb286bd82023-04-04 07:17:52 +0400574 runChildHPAEnabled : runChildHPA,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300575 attachBYOEnabled : attachBYO,
576 upgradeBYOEnabled : upgradeBYO,
577 runBYOMatrixEnabled : runBYOMatrix,
578 defaultBYOOs : defaultBYOOs,
579 upgradeMgmtEnabled : upgradeMgmt,
580 autoUpgradeMgmtEnabled : autoUpgradeMgmt,
581 enableLMALoggingEnabled : enableLMALogging,
582 deployOsOnMosEnabled : deployOsOnMos,
583 runUie2eEnabled : runUie2e,
584 runUie2eNewEnabled : runUie2eNew,
585 runMgmtConformanceEnabled : runMgmtConformance,
Sergey Lalovafcc0432023-04-13 14:59:06 +0400586 runMgmtConformanceNetworkPolicyEnabled : runMgmtConformanceNetworkPolicy,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300587 runMaintenanceTestEnabled : runMaintenanceTest,
588 runContainerregistryTestEnabled : runContainerregistryTest,
589 runGracefulRebootTestEnabled : runGracefulRebootTest,
590 pauseForDebugEnabled : pauseForDebug,
591 runMgmtDeleteMasterTestEnabled : runMgmtDeleteMasterTest,
592 runRgnlDeleteMasterTestEnabled : runRgnlDeleteMasterTest,
593 runChildDeleteMasterTestEnabled : runChildDeleteMasterTest,
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400594 runChildCustomCertTestEnabled : runChildCustomCertTest,
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400595 runMgmtCustomCacheCertTestEnabled : runMgmtCustomCacheCertTest,
Sergey Lalov430fcd72023-03-20 17:19:44 +0400596 runByoChildCustomCertTestEnabled : runByoChildCustomCertTest,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300597 runChildMachineDeletionPolicyTestEnabled : runChildMachineDeletionPolicyTest,
598 runLMATestEnabled : runLMATest,
599 runMgmtUserControllerTestEnabled : runMgmtUserControllerTest,
600 runProxyChildTestEnabled : runProxyChildTest,
601 fetchServiceBinariesEnabled : fetchServiceBinaries,
602 awsOnDemandDemoEnabled : awsOnDemandDemo,
603 equinixOnDemandDemoEnabled : equinixOnDemandDemo,
604 equinixMetalV2OnDemandDemoEnabled : equinixMetalV2OnDemandDemo,
605 equinixMetalV2ChildDiffMetroEnabled : equinixMetalV2ChildDiffMetro,
606 equinixOnAwsDemoEnabled : equinixOnAwsDemo,
607 azureOnDemandDemoEnabled : azureOnDemandDemo,
608 azureOnAwsDemoEnabled : azureOnAwsDemo,
609 vsphereDemoEnabled : enableVsphereDemo,
610 vsphereOnDemandDemoEnabled : enableVsphereDemo, // TODO: remove after MCC 2.7 is out
611 bmDemoEnabled : enableBMDemo,
612 osDemoEnabled : enableOSDemo,
613 vsphereUbuntuEnabled : enableVsphereUbuntu,
614 artifactsBuildEnabled : enableArtifactsBuild,
615 childOsBootFromVolume : childOsBootFromVolume,
616 multiregionalConfiguration : multiregionalMappings,
617 demoWeight : demoWeight,
618 bootstrapV2Scenario : bootstrapV2Scenario,
619 equinixMetalV2Metro : equinixMetalV2Metro,
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300620 enableFips : enableFips,
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100621 aioCluster : aioCluster,
vryzhenkin4fd3f242023-03-29 15:13:46 +0400622 useVsphereVvmtObjects : useVsphereVvmtObjects,
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400623 bv2SmokeEnabled : enableBv2Smoke,
624 runCacheWarmup : runCacheWarmup,
625 ]
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200626}
627
628/**
629 * Determine management and regional setup for demo workflow scenario
630 *
631 *
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300632 * @param: keyword (string) string , represents keyword trigger, specified in gerrit commit body, like `[multiregion aws,os]`
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200633 or Jenkins environment string variable in form like 'aws,os'
634 * @return (map)[
635 enabled: (bool),
636 * managementLocation: (string), //aws,os
637 * regionLocation: (string), //aws,os
638 * ]
639 */
640def multiregionWorkflowParser(keyword) {
Владислав Наумов8c0c39d2020-09-11 14:46:48 +0200641 def common = new com.mirantis.mk.Common()
eromanova8c702ae2021-12-24 17:43:12 +0400642 def supportedManagementProviders = ['os', 'aws', 'vsphere', 'equinix', 'equinixmetalv2', 'azure']
643 def supportedRegionalProviders = ['os', 'vsphere', 'equinix', 'equinixmetalv2', 'bm', 'azure', 'aws']
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200644
645 def clusterTypes = ''
Владислав Наумов38ed7bf2020-09-11 14:43:39 +0200646 if (keyword.toString().contains('multiregion')) {
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200647 common.infoMsg('Multiregion definition configured via gerrit keyword trigger')
648 clusterTypes = keyword[0][0].split('multiregion')[1].replaceAll('[\\[\\]]', '').trim().split(',')
649 } else {
650 common.infoMsg('Multiregion definition configured via environment variable')
651 clusterTypes = keyword.trim().split(',')
652 }
653
654 if (clusterTypes.size() != 2) {
Владислав Наумов482fb502020-10-30 17:59:27 +0100655 error("Incorrect regions definiton, valid scheme: [multiregion ${management}, ${region}], got: ${clusterTypes}")
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200656 }
657
Владислав Наумовf793fe32020-09-11 15:19:19 +0200658 def desiredManagementProvider = clusterTypes[0].trim()
659 def desiredRegionalProvider = clusterTypes[1].trim()
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200660 if (! supportedManagementProviders.contains(desiredManagementProvider) || ! supportedRegionalProviders.contains(desiredRegionalProvider)) {
661 error("""unsupported management <-> regional bundle, available options:
Владислав Наумовf793fe32020-09-11 15:19:19 +0200662 management providers list - ${supportedManagementProviders}
663 regional providers list - ${supportedRegionalProviders}""")
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200664 }
665
666 return [
667 enabled: true,
668 managementLocation: desiredManagementProvider,
669 regionLocation: desiredRegionalProvider,
670 ]
vnaumov33747e12020-05-04 17:35:20 +0200671}
672
673/**
674 * Determine if custom si tests/pipelines refspec forwarded from gerrit change request
675
Владислав Наумов81777472021-03-09 15:14:27 +0400676 * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md
vnaumov33747e12020-05-04 17:35:20 +0200677 * Used for components team to test component changes w/ custom SI refspecs using kaas/core deployment jobs
678 * Example scheme:
679 * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core
680 * manage refspecs through Jenkins Job Parameters
681 *
azvyagintseva12230a2020-06-05 13:24:06 +0300682 * @return (map)[* siTests: (string) final refspec for si-tests
vnaumov33747e12020-05-04 17:35:20 +0200683 * siPipelines: (string) final refspec for si-pipelines
684 * ]
685 */
686def checkCustomSIRefspec() {
vnaumovbdb90222020-05-04 18:25:50 +0200687 def common = new com.mirantis.mk.Common()
688
vnaumov33747e12020-05-04 17:35:20 +0200689 // Available triggers and its sane defaults
Владислав Наумов6c2afff2020-06-05 12:54:53 +0200690 def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master'
691 def siPipelinesRefspec = env.SI_PIPELINES_REFSPEC ?: 'master'
Владислав Наумов2db15e22020-07-14 12:29:22 +0200692 def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test'
693 def siTestsDockerImageTag = env.SI_TESTS_DOCKER_IMAGE_TAG ?: 'master'
Владислав Наумов6c2afff2020-06-05 12:54:53 +0200694 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
vnaumov33747e12020-05-04 17:35:20 +0200695
696 def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/)
697 def siPipelinesMatches = (commitMsg =~ /(\[si-pipelines-ref\s*refs\/changes\/.*?\])/)
698
699 if (siTestMatches.size() > 0) {
700 siTestsRefspec = siTestMatches[0][0].split('si-tests-ref')[1].replaceAll('[\\[\\]]', '').trim()
Владислав Наумов7f6c0882021-03-23 19:10:57 +0400701 siTestsDockerImage = "docker-review-local.docker.mirantis.net/review/kaas-si-test-${siTestsRefspec.split('/')[-2]}"
Владислав Наумов2db15e22020-07-14 12:29:22 +0200702 siTestsDockerImageTag = siTestsRefspec.split('/')[-1]
vnaumov33747e12020-05-04 17:35:20 +0200703 }
704 if (siPipelinesMatches.size() > 0) {
705 siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim()
706 }
707
708 common.infoMsg("""
709 kaas/si-pipelines will be fetched from: ${siPipelinesRefspec}
710 kaas/si-tests will be fetched from: ${siTestsRefspec}
Владислав Наумов2db15e22020-07-14 12:29:22 +0200711 kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}:${siTestsDockerImageTag}
Владислав Наумов81777472021-03-09 15:14:27 +0400712 Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
Владислав Наумов2db15e22020-07-14 12:29:22 +0200713 return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage, siTestsDockerImageTag: siTestsDockerImageTag]
vnaumov33747e12020-05-04 17:35:20 +0200714}
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200715
Владислав Наумов9080f372020-06-08 13:57:16 +0200716/**
Владислав Наумов418042b2020-07-09 18:31:10 +0200717 * Parse additional configuration for kaas component CICD repo
Владислав Наумов30a516c2020-07-09 13:15:41 +0200718 * @param configurationFile (str) path to configuration file in yaml format
719 *
720 * @return (map)[ siTestsFeatureFlags (string) dedicated feature flags that will be used in SI tests,
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300721 * siTestsFeatureFlagsStable (string) dedicated feature flags that will be used in SI tests for deploying stable release
Владислав Наумов30a516c2020-07-09 13:15:41 +0200722 * ]
723 */
724def parseKaaSComponentCIParameters(configurationFile){
725 def common = new com.mirantis.mk.Common()
726 def ciConfig = readYaml file: configurationFile
727 def ciSpec = [
728 siTestsFeatureFlags: env.SI_TESTS_FEATURE_FLAGS ?: '',
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300729 siTestsFeatureFlagsStable: env.SI_TESTS_FEATURE_FLAGS_STABLE ?: '',
Владислав Наумов30a516c2020-07-09 13:15:41 +0200730 ]
731
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300732 // If exists and not empty
733 if (ciConfig.getOrDefault('si-tests-feature-flags', [])) {
Владислав Наумов30a516c2020-07-09 13:15:41 +0200734 common.infoMsg("""SI tests feature flags customization detected,
735 results will be merged with existing flags: [${ciSpec['siTestsFeatureFlags']}] identification...""")
736
737 def ffMeta = ciSpec['siTestsFeatureFlags'].tokenize(',').collect { it.trim() }
738 ffMeta.addAll(ciConfig['si-tests-feature-flags'])
Владислав Наумов30a516c2020-07-09 13:15:41 +0200739
Владислав Наумовcb5ffca2020-07-14 15:28:36 +0200740 ciSpec['siTestsFeatureFlags'] = ffMeta.unique().join(',')
Владислав Наумов30a516c2020-07-09 13:15:41 +0200741 common.infoMsg("SI tests custom feature flags: ${ciSpec['siTestsFeatureFlags']}")
742 }
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300743 if (ciConfig.getOrDefault('si-tests-feature-flags-stable', [])) {
744 common.infoMsg("""SI tests feature flags for stable release customization detected,
745 results will be merged with existing flags: [${ciSpec['siTestsFeatureFlagsStable']}] identification...""")
746
747 def ffMeta = ciSpec['siTestsFeatureFlagsStable'].tokenize(',').collect { it.trim() }
748 ffMeta.addAll(ciConfig['si-tests-feature-flags-stable'])
749
750 ciSpec['siTestsFeatureFlagsStable'] = ffMeta.unique().join(',')
751 common.infoMsg("SI tests custom feature flags for stable release: ${ciSpec['siTestsFeatureFlagsStable']}")
752 }
Владислав Наумов30a516c2020-07-09 13:15:41 +0200753
754 common.infoMsg("""Additional ci configuration parsed successfully:
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300755 siTestsFeatureFlags: ${ciSpec['siTestsFeatureFlags']}
756 siTestsFeatureFlagsStable: ${ciSpec['siTestsFeatureFlagsStable']}""")
Владислав Наумов30a516c2020-07-09 13:15:41 +0200757 return ciSpec
758}
759
760/**
761 * Determine if custom kaas core/pipelines refspec forwarded from gerrit change request
Владислав Наумов9080f372020-06-08 13:57:16 +0200762
Владислав Наумов81777472021-03-09 15:14:27 +0400763 * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md
Владислав Наумов9080f372020-06-08 13:57:16 +0200764 * Used for components team to test component changes w/ custom Core refspecs using kaas/core deployment jobs
765 * Example scheme:
766 * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core
767 * manage refspecs through Jenkins Job Parameters
768 *
769 * @return (map)[ core: (string) final refspec for kaas/core
770 * corePipelines: (string) final refspec for pipelines in kaas/core
771 * ]
772 */
773def checkCustomCoreRefspec() {
774 def common = new com.mirantis.mk.Common()
775
776 // Available triggers and its sane defaults
777 def coreRefspec = env.KAAS_CORE_REFSPEC ?: 'master'
778 // by default using value of GERRIT_REFSPEC parameter in *kaas/core jobs*
779 def corePipelinesRefspec = env.KAAS_PIPELINE_REFSPEC ?: '\$GERRIT_REFSPEC'
780 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
781
782 def coreMatches = (commitMsg =~ /(\[core-ref\s*refs\/changes\/.*?\])/)
783 def corePipelinesMatches = (commitMsg =~ /(\[core-pipelines-ref\s*refs\/changes\/.*?\])/)
784
785 if (coreMatches.size() > 0) {
786 coreRefspec = coreMatches[0][0].split('core-ref')[1].replaceAll('[\\[\\]]', '').trim()
787 }
788 if (corePipelinesMatches.size() > 0) {
789 corePipelinesRefspec = corePipelinesMatches[0][0].split('core-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim()
790 }
791
792 common.infoMsg("""
793 kaas/core will be fetched from: ${coreRefspec}
794 kaas/core pipelines will be fetched from: ${corePipelinesRefspec}
Владислав Наумов81777472021-03-09 15:14:27 +0400795 Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
Владислав Наумов9080f372020-06-08 13:57:16 +0200796 return [core: coreRefspec, corePipelines: corePipelinesRefspec]
797}
798
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200799
800/**
Владислав Наумов92288d92020-07-13 18:36:21 +0200801 * generate Jenkins Parameter objects from from text parameter with additonal kaas core context
802 * needed to forward inside kaas core set of jobs
803 *
804 * @param context (string) Representation of the string enviroment variables needed for kaas core jobs in yaml format
805 * @return (list)[ string(name: '', value: ''),
806 * ]
807 */
808def generateKaaSVarsFromContext(context) {
809 def common = new com.mirantis.mk.Common()
810 def parameters = []
811 def config = readYaml text: context
812
813 config.each { k,v ->
814 common.infoMsg("Custom KaaS Core context parameter: ${k}=${v}")
815 parameters.add(string(name: k, value: v))
816 }
817
818 return parameters
819}
820
821/**
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200822 * Trigger KaaS demo jobs based on AWS/OS providers with customized test suite, parsed from external sources (gerrit commit/jj vars)
Владислав Наумов81777472021-03-09 15:14:27 +0400823 * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200824 * Used for components team to test component changes w/ customized SI tests/refspecs using kaas/core deployment jobs
825 *
Владислав Наумов418042b2020-07-09 18:31:10 +0200826 * @param: component (string) component name [iam, lcm, stacklight]
827 * @param: patchSpec (string) Patch for kaas/cluster releases in json format
828 * @param: configurationFile (string) Additional file for component repo CI config in yaml format
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200829 */
Владислав Наумов92288d92020-07-13 18:36:21 +0200830def triggerPatchedComponentDemo(component, patchSpec = '', configurationFile = '.ci-parameters.yaml', coreContext = '') {
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200831 def common = new com.mirantis.mk.Common()
832 // Determine if custom trigger keywords forwarded from gerrit
833 def triggers = checkDeploymentTestSuite()
834 // Determine SI refspecs
835 def siRefspec = checkCustomSIRefspec()
Владислав Наумов9080f372020-06-08 13:57:16 +0200836 // Determine Core refspecs
837 def coreRefspec = checkCustomCoreRefspec()
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200838
Владислав Наумов418042b2020-07-09 18:31:10 +0200839 // Determine component repo ci configuration
840 def ciSpec = [:]
841 def componentFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: ''
842 if (fileExists(configurationFile)) {
843 common.infoMsg('Component CI configuration file detected, parsing...')
844 ciSpec = parseKaaSComponentCIParameters(configurationFile)
845 componentFeatureFlags = ciSpec['siTestsFeatureFlags']
846 } else {
847 common.warningMsg('''Component CI configuration file is not exists,
Владислав Наумовc17dd552020-07-29 17:07:38 +0200848 several code-management features may be unavailable,
Владислав Наумов92288d92020-07-13 18:36:21 +0200849 follow https://mirantis.jira.com/wiki/spaces/QA/pages/2310832276/SI-tests+feature+flags#%5BUpdated%5D-Using-a-feature-flag
850 to create the configuration file''')
Владислав Наумов418042b2020-07-09 18:31:10 +0200851 }
Ivan Berezovskiy91ede502021-05-13 21:05:36 +0400852
853 def platforms = []
854 if (component == 'ipam' && triggers.vsphereDemoEnabled) {
855 // Currently only vsphere demo is required for IPAM component
856 platforms.add('vsphere')
857 } else {
858 if (triggers.osDemoEnabled) {
859 platforms.add('openstack')
860 }
861 if (triggers.awsOnDemandDemoEnabled) {
862 platforms.add('aws')
863 }
864 if (triggers.equinixOnDemandDemoEnabled) {
865 platforms.add('equinix')
866 }
Владислав Наумов144956f2021-10-14 17:49:19 +0200867 if (triggers.equinixMetalV2OnDemandDemoEnabled) {
868 platforms.add('equinixmetalv2')
869 }
Владислав Наумовc52dd9d2021-06-28 16:27:29 +0200870 if (triggers.azureOnDemandDemoEnabled) {
871 platforms.add('azure')
872 }
Ivan Berezovskiyb0229d02021-05-17 16:55:18 +0400873 if (triggers.vsphereDemoEnabled) {
874 platforms.add('vsphere')
875 }
Ivan Berezovskiy91ede502021-05-13 21:05:36 +0400876 }
877
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200878 def jobs = [:]
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200879 def parameters = [
Владислав Наумов9080f372020-06-08 13:57:16 +0200880 string(name: 'GERRIT_REFSPEC', value: coreRefspec.core),
881 string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines),
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200882 string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests),
Владислав Наумов418042b2020-07-09 18:31:10 +0200883 string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags),
Владислав Наумов2db15e22020-07-14 12:29:22 +0200884 string(name: 'SI_TESTS_DOCKER_IMAGE', value: siRefspec.siTestsDockerImage),
885 string(name: 'SI_TESTS_DOCKER_IMAGE_TAG', value: siRefspec.siTestsDockerImageTag),
Владислав Наумов4a5c3242020-06-08 14:36:11 +0200886 string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines),
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200887 string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec),
Mikhail Ivanov74504372021-05-21 17:01:06 +0400888 string(name: 'KAAS_CHILD_CLUSTER_RELEASE_NAME', value: triggers.childDeployCustomRelease),
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400889 string(name: 'OPENSTACK_CLOUD_LOCATION', value: triggers.osCloudLocation),
Владислав Наумовb8305e22021-02-10 17:23:12 +0100890 booleanParam(name: 'OFFLINE_MGMT_CLUSTER', value: triggers.proxyConfig['mgmtOffline']),
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200891 booleanParam(name: 'OFFLINE_CHILD_CLUSTER', value: triggers.proxyConfig['childOffline']),
Владислав Наумов257ea132021-04-14 14:44:13 +0200892 booleanParam(name: 'PROXY_CHILD_CLUSTER', value: triggers.proxyConfig['childProxy']),
Владислав Наумов44c64b72020-12-04 20:22:53 +0100893 booleanParam(name: 'SEED_MACOS', value: triggers.useMacOsSeedNode),
Владислав Наумов080d9412020-07-29 13:05:14 +0200894 booleanParam(name: 'UPGRADE_MGMT_CLUSTER', value: triggers.upgradeMgmtEnabled),
slalov1202bba2022-04-20 22:31:07 +0400895 booleanParam(name: 'AUTO_UPGRADE_MCC', value: triggers.autoUpgradeMgmtEnabled),
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400896 booleanParam(name: 'ENABLE_LMA_LOGGING', value: triggers.enableLMALoggingEnabled),
Sergey Lalovb2f60372022-09-20 23:58:47 +0400897 booleanParam(name: 'DEPLOY_OS_ON_MOS', value: triggers.deployOsOnMosEnabled),
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200898 booleanParam(name: 'RUN_UI_E2E', value: triggers.runUie2eEnabled),
Владислав Наумов080d9412020-07-29 13:05:14 +0200899 booleanParam(name: 'RUN_MGMT_CFM', value: triggers.runMgmtConformanceEnabled),
Sergey Lalovafcc0432023-04-13 14:59:06 +0400900 booleanParam(name: 'RUN_MGMT_CFM_NETWORK_POLICY', value: triggers.runMgmtConformanceNetworkPolicyEnabled),
slalov0a4947a2022-06-09 15:44:35 +0400901 booleanParam(name: 'RUN_MAINTENANCE_TEST', value: triggers.runMaintenanceTestEnabled),
902 booleanParam(name: 'RUN_CONTAINER_REGISTRY_TEST', value: triggers.runContainerregistryTestEnabled),
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +0300903 booleanParam(name: 'RUN_GRACEFUL_REBOOT_TEST', value: triggers.runGracefulRebootTestEnabled),
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300904 booleanParam(name: 'RUN_MGMT_DELETE_MASTER_TEST', value: triggers.runMgmtDeleteMasterTestEnabled),
905 booleanParam(name: 'RUN_RGNL_DELETE_MASTER_TEST', value: triggers.runRgnlDeleteMasterTestEnabled),
906 booleanParam(name: 'RUN_CHILD_DELETE_MASTER_TEST', value: triggers.runChildDeleteMasterTestEnabled),
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400907 booleanParam(name: 'RUN_CHILD_CUSTOM_CERT_TEST', value: triggers.runChildCustomCertTestEnabled),
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400908 booleanParam(name: 'RUN_MGMT_CUSTOM_CACHE_CERT_TEST', value: triggers.runMgmtCustomCacheCertTestEnabled),
Sergey Lalov430fcd72023-03-20 17:19:44 +0400909 booleanParam(name: 'RUN_BYO_CHILD_CUSTOM_CERT_TEST', value: triggers.runByoChildCustomCertTestEnabled),
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300910 booleanParam(name: 'RUN_CHILD_MACHINE_DELETION_POLICY_TEST', value: triggers.runChildMachineDeletionPolicyTestEnabled),
Владислав Наумов9cec55d2021-08-03 15:00:59 +0200911 booleanParam(name: 'RUN_LMA_TEST', value: triggers.runLMATestEnabled),
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +0200912 booleanParam(name: 'RUN_MGMT_USER_CONTROLLER_TEST', value: triggers.runMgmtUserControllerTestEnabled),
Владислав Наумов080d9412020-07-29 13:05:14 +0200913 booleanParam(name: 'DEPLOY_CHILD_CLUSTER', value: triggers.deployChildEnabled),
914 booleanParam(name: 'UPGRADE_CHILD_CLUSTER', value: triggers.upgradeChildEnabled),
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400915 booleanParam(name: 'FULL_UPGRADE_CHILD_CLUSTER', value: triggers.fullUpgradeChildEnabled),
slalov574123e2022-04-06 17:24:19 +0400916 booleanParam(name: 'RUN_PROXY_CHILD_TEST', value: triggers.runProxyChildTestEnabled),
Владислав Наумов0dc99252020-11-13 13:30:48 +0100917 booleanParam(name: 'ATTACH_BYO', value: triggers.attachBYOEnabled),
Владислав Наумовcdbd84e2020-12-01 16:51:09 +0100918 booleanParam(name: 'UPGRADE_BYO', value: triggers.upgradeBYOEnabled),
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100919 booleanParam(name: 'RUN_BYO_MATRIX', value: triggers.runBYOMatrixEnabled),
Владислав Наумов080d9412020-07-29 13:05:14 +0200920 booleanParam(name: 'RUN_CHILD_CFM', value: triggers.runChildConformanceEnabled),
Sergey Lalovafcc0432023-04-13 14:59:06 +0400921 booleanParam(name: 'RUN_CHILD_CFM_NETPOLICY', value: triggers.runChildConformanceNetworkPolicyEnabled),
vryzhenkinb286bd82023-04-04 07:17:52 +0400922 booleanParam(name: 'RUN_CHILD_HPA', value: triggers.runChildHPAEnabled),
Ivan Berezovskiycbf9eeb2021-03-22 15:57:32 +0400923 booleanParam(name: 'ALLOW_AWS_ON_DEMAND', value: triggers.awsOnDemandDemoEnabled),
Владислав Наумовe021b022021-05-06 11:26:38 +0200924 booleanParam(name: 'ALLOW_EQUINIX_ON_DEMAND', value: triggers.equinixOnDemandDemoEnabled),
Владислав Наумов82305e92021-10-14 20:45:20 +0200925 booleanParam(name: 'ALLOW_EQUINIXMETALV2_ON_DEMAND', value: triggers.equinixMetalV2OnDemandDemoEnabled),
Vladislav Naumov42b71dc2021-11-22 13:09:42 +0100926 booleanParam(name: 'EQUINIXMETALV2_CHILD_DIFF_METRO', value: triggers.equinixMetalV2ChildDiffMetroEnabled),
eromanovad3397512021-04-01 20:19:19 +0400927 booleanParam(name: 'EQUINIX_ON_AWS_DEMO', value: triggers.equinixOnAwsDemoEnabled),
Владислав Наумовc52dd9d2021-06-28 16:27:29 +0200928 booleanParam(name: 'ALLOW_AZURE_ON_DEMAND', value: triggers.azureOnDemandDemoEnabled),
Владислав Наумов2d3db332021-06-15 15:19:19 +0200929 booleanParam(name: 'AZURE_ON_AWS_DEMO', value: triggers.azureOnAwsDemoEnabled),
Sergey Zhemerdeev9074f6e2022-06-07 12:03:16 +0300930 booleanParam(name: 'VSPHERE_DEPLOY_UBUNTU', value: triggers.vsphereUbuntuEnabled),
Sergey Lalovbc68d752022-11-08 13:40:53 +0400931 booleanParam(name: 'PAUSE_FOR_DEBUG', value: triggers.pauseForDebugEnabled),
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300932 booleanParam(name: 'ENABLE_FIPS', value: triggers.enableFips),
933 booleanParam(name: 'AIO_CLUSTER', value: triggers.aioCluster),
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200934 ]
Владислав Наумов92288d92020-07-13 18:36:21 +0200935
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200936 // customize multiregional demo
937 if (triggers.multiregionalConfiguration.enabled) {
938 parameters.add(string(name: 'MULTIREGION_SETUP',
939 value: "${triggers.multiregionalConfiguration.managementLocation},${triggers.multiregionalConfiguration.regionLocation}"
940 ))
941 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200942
Владислав Наумов92288d92020-07-13 18:36:21 +0200943 // Determine component team custom context
944 if (coreContext != '') {
945 common.infoMsg('Additional KaaS Core context detected, will be forwarded into kaas core cicd...')
946 def additionalParameters = generateKaaSVarsFromContext(coreContext)
Владислав Наумовbef51a92020-10-01 17:36:51 +0200947 parameters.addAll(additionalParameters)
Владислав Наумов92288d92020-07-13 18:36:21 +0200948 }
949
Владислав Наумовaa430612020-06-08 17:18:31 +0200950 def jobResults = []
Ivan Berezovskiy91ede502021-05-13 21:05:36 +0400951
952 platforms.each { platform ->
953 jobs["kaas-core-${platform}-patched-${component}"] = {
Vladislav Naumov5313a202021-04-07 17:13:39 +0000954 try {
Ivan Berezovskiy91ede502021-05-13 21:05:36 +0400955 common.infoMsg("Deploy: patched KaaS demo with ${platform} provider")
956 def job_info = build job: "kaas-testing-core-${platform}-workflow-${component}", parameters: parameters, wait: true
957 def build_description = job_info.getDescription()
958 def build_result = job_info.getResult()
Vladislav Naumov5313a202021-04-07 17:13:39 +0000959 jobResults.add(build_result)
Владислав Наумовd044e842020-06-17 15:33:43 +0200960
Vladislav Naumov5313a202021-04-07 17:13:39 +0000961 if (build_description) {
962 currentBuild.description += build_description
963 }
964 } finally {
Ivan Berezovskiy91ede502021-05-13 21:05:36 +0400965 common.infoMsg("Patched KaaS demo with ${platform} provider finished")
Vladislav Naumov5313a202021-04-07 17:13:39 +0000966 }
967 }
968 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200969
970 common.infoMsg('Trigger KaaS demo deployments according to defined provider set')
Владислав Наумов37f7f842021-03-09 16:08:39 +0400971 if (jobs.size() == 0) {
972 error('No demo jobs matched with keywords, execution will be aborted, at least 1 provider should be enabled')
973 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200974 // Limit build concurency workaround examples: https://issues.jenkins-ci.org/browse/JENKINS-44085
975 parallel jobs
Владислав Наумовaa430612020-06-08 17:18:31 +0200976
977 if (jobResults.contains('FAILURE')) {
Владислав Наумовf86b1112020-06-09 14:04:48 +0200978 common.infoMsg('One of parallel downstream jobs is failed, mark executor job as failed')
Владислав Наумовaa430612020-06-08 17:18:31 +0200979 currentBuild.result = 'FAILURE'
980 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200981}
Владислав Наумов30a516c2020-07-09 13:15:41 +0200982
983
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +0400984/**
985 * Function currently supported to be called from aws or vsphere demos. It gets particular demo context
Владислав Наумов33e1e812021-08-17 17:09:25 +0200986 * and generate proper lockResources data and netMap data for vsphere,equinix related clusters.
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +0400987 *
988 * @param: callBackDemo (string) Demo which requested to generate lockResources [aws or vsphere]
989 * @param: triggers (map) Custom trigger keywords forwarded from gerrit
990 * @param: multiregionalConfiguration (map) Multiregional configuration
991 * @return (map) Return aggregated map with lockResources and netMap
992 */
993
994
995def generateLockResources(callBackDemo, triggers) {
996 def common = new com.mirantis.mk.Common()
Владислав Наумов33e1e812021-08-17 17:09:25 +0200997 def netMap = [
998 vsphere: [:],
999 equinix: [:],
1000 ]
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001001 // Define vsphere locklabels with initial quantity
1002 def lockLabels = [
1003 vsphere_networking_core_ci: 0,
1004 vsphere_offline_networking_core_ci: 0,
1005 ]
1006 def deployChild = triggers.deployChildEnabled
slalov27833272022-06-30 02:13:50 +04001007 def testUiVsphere = triggers.runUie2eEnabled
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001008 def multiregionConfig = triggers.multiregionalConfiguration
1009 def runMultiregion = multiregionConfig.enabled
1010
1011 // Generate vsphere netMap and lockLabels based on demo context
1012 switch (callBackDemo) {
1013 case 'aws':
1014 // Add aws specific lock label with quantity calculated based on single mgmt deploy or mgmt + child
1015 lockLabels['aws_core_ci_queue'] = triggers.demoWeight
Sergey Kolekonovf4c1f492022-02-03 14:44:45 +04001016 if (triggers.runBYOMatrixEnabled) { lockLabels['aws_core_ci_queue'] += 6 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001017
1018 // Define netMap for Vsphere region
Mikhail Ivanov90a27fa2022-05-30 15:18:24 +04001019 if (runMultiregion && multiregionConfig.managementLocation == 'aws') {
1020 if (multiregionConfig.regionLocation == 'vsphere') {
1021 if (deployChild) {
1022 addToProviderNetMap(netMap, 'vsphere', 'regional-child')
1023 }
1024 addToProviderNetMap(netMap, 'vsphere', 'region')
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001025 }
Mikhail Ivanov90a27fa2022-05-30 15:18:24 +04001026
1027 if (multiregionConfig.regionLocation == 'azure') {
1028 lockLabels['azure_core_ci_queue'] = 1
1029 if (deployChild) {
1030 lockLabels['azure_core_ci_queue'] += 1
1031 }
1032 }
1033 }
1034 if (triggers.azureOnAwsDemoEnabled) {
1035 lockLabels['azure_core_ci_queue'] = 1
1036 }
1037
1038 if (triggers.equinixOnAwsDemoEnabled) {
1039 lockLabels['equinix_core_ci_queue'] = 1
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001040 }
1041 break
1042 case 'vsphere':
Владислав Наумов33e1e812021-08-17 17:09:25 +02001043 addToProviderNetMap(netMap, 'vsphere', 'mgmt')
slalov27833272022-06-30 02:13:50 +04001044 if (deployChild || testUiVsphere) {
Владислав Наумов33e1e812021-08-17 17:09:25 +02001045 addToProviderNetMap(netMap, 'vsphere', 'child')
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001046 }
1047 if (runMultiregion && multiregionConfig.managementLocation == 'vsphere' &&
1048 multiregionConfig.regionLocation == 'vsphere') {
1049 if (deployChild) {
Владислав Наумов33e1e812021-08-17 17:09:25 +02001050 addToProviderNetMap(netMap, 'vsphere', 'regional-child')
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001051 }
Владислав Наумов33e1e812021-08-17 17:09:25 +02001052 addToProviderNetMap(netMap, 'vsphere', 'region')
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001053 }
1054 break
Mikhail Ivanov90a27fa2022-05-30 15:18:24 +04001055 case 'azure':
1056 lockLabels['azure_core_ci_queue'] = triggers.demoWeight
1057 if (runMultiregion && multiregionConfig.managementLocation == 'azure') {
1058 if (multiregionConfig.regionLocation == 'aws') {
1059 lockLabels['aws_core_ci_queue'] = 1
1060 if (deployChild) {
1061 lockLabels['aws_core_ci_queue'] += 1
1062 }
1063 }
1064
1065 if (multiregionConfig.regionLocation == 'equinix') {
1066 lockLabels['equinix_core_ci_queue'] = 1
1067 if (deployChild) {
1068 lockLabels['equinix_core_ci_queue'] +=1
1069 }
1070 }
1071 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001072 default:
Mikhail Ivanov90a27fa2022-05-30 15:18:24 +04001073 error('Supposed to be called from aws, azure or vsphere demos only')
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001074 }
1075
1076 // Checking gerrit triggers and manage lock label quantity and network types in case of Offline deployment
1077 // Vsphere labels only
Владислав Наумов33e1e812021-08-17 17:09:25 +02001078 netMap['vsphere'].each { clusterType, netConfig ->
1079 if (triggers.proxyConfig["${clusterType}Offline"] == true ||
1080 (clusterType == 'regional-child' && triggers.proxyConfig['childOffline'] == true) ||
1081 (clusterType == 'region' && triggers.proxyConfig['mgmtOffline'])) {
1082
1083 netMap['vsphere'][clusterType]['netName'] = 'offline'
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001084 lockLabels['vsphere_offline_networking_core_ci']++
1085 } else {
1086 lockLabels['vsphere_networking_core_ci']++
1087 }
1088 }
1089
1090 // generate lock metadata
1091 def lockResources = []
1092 lockLabels.each { label, quantity ->
1093 if (quantity > 0) {
1094 def res = [
1095 label: label,
1096 quantity: quantity,
1097 ]
1098 lockResources.add(res)
1099 }
1100 }
1101
1102 common.infoMsg("""Generated vsphere netMap: ${netMap}
1103 Generated lockResources: ${lockResources}""")
1104
1105 return [
1106 netMap: netMap,
1107 lockResources: lockResources,
1108 ]
1109}
1110
1111/**
1112 * Function gets vsphere netMap or empty map and adds new vsphere clusterType with default netName
1113 * and empty rangeConfig to the this map.
1114 *
Владислав Наумов33e1e812021-08-17 17:09:25 +02001115 * @param: netMap (string) vsphere, equinix netMap or empty map
1116 * @param: provider (string) provider type
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001117 * @param: clusterType (string) Vsphere cluster type
1118 */
1119
Владислав Наумов33e1e812021-08-17 17:09:25 +02001120def addToProviderNetMap (netMap, provider, clusterType) {
1121 switch (provider) {
1122 case 'equinix':
1123 netMap[provider][clusterType] = [
1124 vlanConfig: '',
1125 ]
1126 break
1127 case 'vsphere':
1128 netMap[provider][clusterType] = [
1129 netName: 'default',
1130 rangeConfig: '',
1131 ]
1132 break
1133 default:
1134 error('Net map locks supported for Equinix/Vsphere providers only')
1135 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001136}
Dmitry Teselkinfce71aa2022-03-05 19:36:52 +03001137
1138/**
1139* getCIKeywordsFromCommitMsg parses commit message and returns all gerrit keywords with their values as a list of maps.
1140* Each element (map) contains keys 'key' for keyword name and 'value' for its value.
1141* If keyword contains only 'key' part then 'value' is boolean True.
1142* This function does not perform keywords validation.
1143* First line of a commit message is ignored.
1144* To use '[' or ']' characters inside keyword prepend it with backslash '\'.
1145* TODO: Remove backslash chars from values if they prepend '[' or ']'.
1146**/
1147
1148List getCIKeywordsFromCommitMsg() {
1149 String commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
1150 List commitMsgLines = commitMsg.split('\n')
1151 List keywords = []
1152 if (commitMsgLines.size() < 2) {
1153 return keywords
1154 }
1155
1156 String commitMsgBody = commitMsgLines[1..-1].join('\n')
1157
1158 // Split commit message body to chunks using '[' or ']' as delimiter,
1159 // ignoring them if prepended by backslash (regex negative lookbehind).
1160 // Resulting list will have chunks between '[' and ']' at odd indexes.
1161 List parts = commitMsgBody.split(/(?<!\\)[\[\]]/)
1162
1163 // Iterate chunks by odd indexes only, trim values and split to
1164 // <key> / <value> pair where <key> is the part of a sting before the first
1165 // whitespace delimiter, and <value> is the rest (may include whitespaces).
1166 // If there is no whitespace in the string then this is a 'switch'
1167 // and <value> will be boolean True.
1168 for (i = 1; i < parts.size(); i += 2) {
1169 def (key, value) = (parts[i].trim().split(/\s+/, 2) + [true, ])[0..1]
1170 keywords.add(['key': key, 'value': value])
1171 }
1172
1173 return keywords
1174}
1175
1176/**
1177* getJobsParamsFromCommitMsg parses list of CI keywords and returns values of 'job-params' keyword
1178* that were specified for given job name. `job-params` keyword has the following structure
1179*
1180* [job-params <job name> <parameter name> <parameter value>]
1181*
1182* Return value is a Map that contains those parameters using the following structure:
1183*
1184* <job name>:
1185* <parameter name>: <parameter value>
1186*
1187**/
1188Map getJobsParamsFromCommitMsg() {
1189 List keywords = getCIKeywordsFromCommitMsg()
1190
1191 List jobsParamsList = []
1192 keywords.findAll{ it.key == 'job-params' }.collect(jobsParamsList) {
1193 def (name, params) = (it['value'].split(/\s+/, 2) + [null, ])[0..1]
1194 def (key, value) = params.split(/\s+/, 2)
1195 ['name': name, 'key': key, 'value': value]
1196 }
1197
1198 Map jobsParams = jobsParamsList.inject([:]) { result, it ->
1199 if (!result.containsKey(it.name)) {
1200 result[it.name] = [:]
1201 }
1202 result[it.name][it.key] = it.value
1203 result
1204 }
1205
1206 return jobsParams
1207}
1208
1209
1210/**
1211* getJobParamsFromCommitMsg returns key:value Map of parameters set for a job in commit message.
1212* It uses getJobsParamsFromCommitMsg to get all parameters from commit message and then
1213* uses only those parametes that were set to all jobs (with <job name> == '*') or to
1214* a particular job. Parameters set to a particular job have higher precedence.
1215*
1216* Return value is a Map that contains those parameters:
1217*
1218* <parameter name>: <parameter value>
1219*
1220**/
1221Map getJobParamsFromCommitMsg(String jobName) {
1222 jobsParams = getJobsParamsFromCommitMsg()
1223 jobParams = jobsParams.getOrDefault('*', [:])
1224 if (jobName) {
1225 jobParams.putAll(jobsParams.getOrDefault(jobName, [:]))
1226 }
1227 return jobParams
1228}
azvyagintsevc17d14b2022-06-06 19:06:33 +03001229
1230/** Getting test scheme from text, which should be
1231Imput example:
1232text="""
1233 DATA
1234
1235 kaas_bm_test_schemas:
1236 KAAS_RELEASES_REFSPEC: ''
1237 KEY: VAL
1238
1239 DATA
1240 """
1241
1242 Call: parseTextForTestSchemas(['text' : text,'keyLine' : 'kaas_bm_test_schemas'])
1243
1244 Return:
1245 ['KAAS_RELEASES_REFSPEC': '', 'KEY' : 'VAL']
1246 **/
1247def parseTextForTestSchemas(Map opts) {
azvyagintsevd96aac22022-06-10 14:23:26 +03001248 String text = opts.getOrDefault('text', '')
azvyagintsevc17d14b2022-06-06 19:06:33 +03001249 String keyLine = opts.getOrDefault('keyLine', '')
1250 Map testScheme = [:]
1251 if (!text || !keyLine) {
azvyagintsevd96aac22022-06-10 14:23:26 +03001252 return testScheme
azvyagintsevc17d14b2022-06-06 19:06:33 +03001253 }
1254 if (text =~ /\n$keyLine\n.*/) {
1255 def common = new com.mirantis.mk.Common()
1256 try {
1257 String regExp = '\\n' + keyLine + '\\n'
1258 // regexep block must be followed by empty line
1259 testScheme = readYaml text: "${text.split(regExp)[1].split('\n\n')[0]}"
1260 common.infoMsg("parseTextForTestSchemas result:\n" + testScheme)
1261 common.mergeEnv(env, toJson(testScheme))
1262 }
1263 catch (Exception e) {
1264 common.errorMsg("There is an error occured during parseTextForTestSchemas execution:\n${e}")
1265 throw e
1266 }
1267 }
azvyagintsevd96aac22022-06-10 14:23:26 +03001268 return testScheme
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +03001269}
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001270
1271
1272/**
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001273* getEquinixFacilityWithCapacity returns list of Equinix facilities using specified
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001274* instance type (nodeType), desired count of facilities (facilityCount) and
1275* instances (nodeCount) in a facility using specified matal version.
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001276* Function downloads metal CLI from the
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001277* https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux
1278* Empty list is returned in case of no facilities with specified capacity was found or any other errors.
Sergey Zhemerdeev15aa8602022-10-13 11:10:02 +03001279* Non-empty list is shuffled.
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001280*
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001281* @param: facilityCount (int) Desired count of facilities
1282* @param: nodeCount (int) Desired count of instances
1283* @param: nodeType (string) Instance type
1284* @param: version (string) Metal version to use
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001285* @return ([]string) List of selected facilities
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001286*
1287**/
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001288def getEquinixFacilityWithCapacity(facilityCount = 1, nodeCount = 50, nodeType = 'c3.small.x86', version = '0.9.0') {
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001289 def common = new com.mirantis.mk.Common()
1290 def metalUrl = "https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux"
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001291 def metal = './metal --config metal.yaml'
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001292 def facility = []
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001293 def out = ''
Sergey Zhemerdeevbcccb912022-08-25 14:26:52 +03001294 def retries = 3 // number of retries
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001295 def i = 0
1296 def delay = 60 // 1 minute sleep
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001297 def excludeFacility = [] // list of facilities to exclude from selection
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001298 try {
Sergey Zhemerdeevb3575342022-10-04 11:02:19 +03001299 if (excludeFacility.size() > 0) {
1300 common.infoMsg("Excluded facilities: ${excludeFacility}")
1301 }
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001302 sh "curl -o metal -# ${metalUrl} && chmod +x metal"
1303 withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) {
1304 sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml'
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001305 }
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001306 while (facility.size() < facilityCount && i < retries) {
1307 common.infoMsg("Selecting ${facilityCount} available Equinix facilities with free ${nodeCount} ${nodeType} hosts, try ${i+1}/${retries} ...")
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001308 if (i > 0 ) { // skip sleep on first step
1309 sleep(delay)
1310 }
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001311 out = sh(script: "${metal} capacity get -f -P ${nodeType}|awk '/${nodeType}/ {print \$2}'|paste -s -d,|xargs ${metal} capacity check -P ${nodeType} -q ${nodeCount} -f|grep true|awk '{print \$2}'|paste -s -d,", returnStdout: true).trim()
1312 facility = out.tokenize(',')
Sergey Zhemerdeevb3575342022-10-04 11:02:19 +03001313 facility -= excludeFacility
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001314 if (facility.size() < facilityCount) {
1315 nodeCount -= 10
1316 // We need different metros for the [equinixmetalv2-child-diff-metro] case, facility[][0, 1] contains a metro name
1317 } else if (facility.size() == 2 && facility[0][0, 1] == facility[1][0, 1]) {
Sergey Zhemerdeevbcccb912022-08-25 14:26:52 +03001318 nodeCount -= 10
1319 }
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001320 i++
1321 }
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001322 if (facility.size() > 0) {
1323 f = facility.size() > 1 ? "${facility[0]},${facility[1]}" : "${facility[0]}"
1324 sh "${metal} capacity check -P ${nodeType} -f ${f} -q ${nodeCount}"
Sergey Zhemerdeevbcccb912022-08-25 14:26:52 +03001325 }
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001326 } catch (Exception e) {
1327 common.errorMsg "Exception: '${e}'"
1328 return []
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001329 } finally {
1330 sh 'rm metal.yaml'
1331 }
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001332 if (facility.size() > 0) {
Sergey Zhemerdeev15aa8602022-10-13 11:10:02 +03001333 Collections.shuffle(facility)
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001334 common.infoMsg("Selected facilities: ${facility}")
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001335 } else {
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001336 common.warningMsg('No any facilities have been selected !!! :(')
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001337 }
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001338 return facility
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001339}
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001340
1341
1342/**
1343 * genCommandLine prepares command line for artifactory-replication
1344 * command using legacy environment variables
1345 *
1346 * @return: (string) Prepared command line
1347 */
1348def genCommandLine() {
1349 def envToParam = [
1350 'DESTINATION_USER': '-dst-user',
1351 'ARTIFACT_FILTER': '-artifact-filter',
1352 'ARTIFACT_FILTER_PROD': '-artifact-filter-prod',
1353 'ARTIFACT_TYPE': '-artifact-type',
1354 'BINARY_CLEAN': '-bin-cleanup',
1355 'BINARY_CLEAN_KEEP_DAYS': '-bin-clean-keep-days',
1356 'BINARY_CLEAN_PREFIX': '-bin-clean-prefix',
1357 'BUILD_URL': '-slack-build-url',
1358 'CHECK_REPOS': '-check-repos',
1359 'DESTINATION_REGISTRY': '-dst-repo',
1360 'DESTINATION_REGISTRY_TYPE': '-dst-repo-type',
1361 'DOCKER_CLEAN': '-cleanup',
1362 'DOCKER_REPO_PREFIX': '-docker-repo-prefix',
1363 'DOCKER_TAG': '-docker-tag',
1364 'FORCE': '-force',
1365 'HELM_CDN_DOMAIN': '-helm-cdn-domain',
1366 'SLACK_CHANNEL': '-slack-channel',
1367 'SLACK_USER': '-slack-user',
1368 'SOURCE_REGISTRY': '-src-repo',
1369 'SOURCE_REGISTRY_TYPE': '-src-repo-type',
1370 'SYNC_PATTERN': '-sync-pattern'
1371 ]
1372 def cmdParams = ''
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001373 def isCheckClean = false
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001374 for (e in envToParam) {
1375 if (env[e.key] == null) {
1376 continue
1377 }
1378 if (e.key == 'CHECK_REPOS' || e.key == 'DOCKER_CLEAN') {
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001379 // Avoid CHECK_REPOS=true and DOCKER_CLEAN=true
1380 if (env[e.key].toBoolean() && !isCheckClean) {
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001381 cmdParams += e.value + ' '
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001382 isCheckClean = true
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001383 }
1384 } else if (e.key == 'FORCE') {
1385 if (env[e.key].toBoolean()) {
1386 cmdParams += e.value + ' '
1387 }
1388 } else {
Sergey Zhemerdeeve2926cd2022-08-29 15:28:47 +03001389 cmdParams += "${e.value} '${env[e.key]}' "
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001390 }
1391 }
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001392 // No any check or clean was specified - take a default action
1393 if (!isCheckClean) {
1394 cmdParams += '-replicate'
1395 }
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001396 return cmdParams
1397}
Sergey Kolekonov0e60a942022-09-05 13:02:22 +04001398
1399/**
1400 * custom scheduling algorithm
1401 * it ensures that builds of the same job are distributed as much as possible between different nodes
1402 * @param label (string) desired node label
1403 * @return: (string) node name
1404 */
1405def schedule (label='docker') {
1406 def common = new com.mirantis.mk.Common()
1407 def freeNodes = []
1408 def nodesMap = [:]
1409
1410 // filter nodes with the specified label and at least one free executor
1411 timeout(time: 30, unit: 'MINUTES') {
1412 while (!freeNodes) {
1413 freeNodes = jenkins.model.Jenkins.instance.computers.findAll { node ->
1414 label in node.getAssignedLabels().collect { it.name } &&
Sergey Kolekonovd5887172022-11-10 12:13:22 +06001415 node.isPartiallyIdle() &&
1416 node.isOnline()
Sergey Kolekonov0e60a942022-09-05 13:02:22 +04001417 }
1418 if (!freeNodes) {
1419 echo 'No nodes available for scheduling, retrying...'
1420 sleep 30
1421 }
1422 }
1423 }
1424
1425 // generate a map of nodes matching other criteria
1426 for (node in freeNodes) {
1427 // sameJobExecutors is the number of executors running the same job as the calling one
1428 sameJobExecutors = node.getExecutors() // get all executors
1429 .collect { executor -> executor.getCurrentExecutable() } // get running "threads"
1430 .collect { thread -> thread?.displayName } // filter job names from threads
1431 .minus(null) // null = empty executors, remove them from the list
1432 .findAll { it.contains(env.JOB_NAME) } // filter the same jobs as the calling one
1433 .size()
1434
1435 // calculate busy executors, we don't want to count "sameJobExecutors" twice
1436 totalBusyExecutors = node.countBusy() - sameJobExecutors
1437 // generate the final map which contains nodes matching criteria with their load score
1438 // builds of the same jobs have x10 score, all others x1
1439 nodesMap += ["${node.getName()}" : sameJobExecutors * 10 + totalBusyExecutors]
1440 }
1441
1442 // return the least loaded node
1443 return common.SortMapByValueAsc(nodesMap).collect { it.key }[0]
1444}
Sergey Zhemerdeev78a65272023-03-23 18:05:22 +02001445
1446
1447/**
1448 * Get latest tag for test/frontend & equinix-private-infra images
1449 * @param version (str) default tag value from main workflow
1450 * @param isChanged (bool) is dependent directory files were changed
1451 * @param imageName (string) image name for information message
1452 * @return: (string) tag name
1453 */
1454def getImageTag(version, isChanged, imageName) {
1455 def common = new com.mirantis.mk.Common()
Sergey Zhemerdeevebdcad22023-04-25 16:58:28 +03001456 def latestTag = ''
Sergey Zhemerdeev7aeff5a2023-04-19 12:45:19 +03001457 if (!(env.GERRIT_EVENT_TYPE in ['change-merged', 'ref-updated']) && isChanged) {
Sergey Zhemerdeev78a65272023-03-23 18:05:22 +02001458 latestTag = version
Sergey Zhemerdeevebdcad22023-04-25 16:58:28 +03001459 } else {
1460 if (env.GERRIT_EVENT_TYPE == 'ref-updated') {
1461 latestTag = env.GERRIT_REFNAME.replace('refs/tags/v', '').trim()
1462 } else {
1463 latestTag = env.GERRIT_BRANCH ? env.GERRIT_BRANCH : env.GERRIT_REFSPEC ? env.GERRIT_REFSPEC : 'master'
1464 if (latestTag != 'master') {
1465 latestTag = latestTag.replaceAll('/', '_')
1466 }
1467 }
Sergey Zhemerdeev78a65272023-03-23 18:05:22 +02001468 }
1469 common.infoMsg("${imageName} image will use tag '${latestTag}'")
1470 return latestTag
1471}
Sergey Zhemerdeev1d2c03e2023-04-28 11:07:24 +03001472
1473
1474/**
1475 * Translates set of environment vars into actual replicator command line
1476 * @return: (string cmdParams, string jobDescription)
1477 * cmdParams - generated command line
1478 * jobDescription - job description
1479 */
1480def genReplicatorCommandLine() {
1481 def mainModes = ['REPLICATE', 'CLEANUP', 'CHECK_REPOS', 'BIN_CLEANUP']
Sergey Zhemerdeev9919b1b2023-04-28 17:24:21 +03001482 def parameterWithoutArgument = mainModes
Sergey Zhemerdeev1d2c03e2023-04-28 11:07:24 +03001483 def parametersList = parameterWithoutArgument + [
1484 'ARTIFACT_FILTER',
1485 'ARTIFACT_TYPE',
1486 'BIN_CLEAN_KEEP_DAYS',
1487 'BIN_CLEAN_PREFIX',
1488 'DOCKER_TAG',
1489 // DST_ will be changed to TARGET_
1490 'DST_REPO',
1491 'DST_REPO_TYPE',
1492 'DST_USER',
1493 'OLDER_THAN_DAYS',
1494 'SLACK_BUILD_URL',
1495 'SLACK_CHANNEL',
1496 'SLACK_USER',
1497 'SRC_REPO',
1498 'SRC_REPO_TYPE',
1499 'SRC_USER',
1500 'SYNC_PATTERN',
1501 'THREAD_COUNT'
1502 ]
1503 def mainModesDescriptions = [
1504 'REPLICATE': 'Replicating binaries/Docker images',
1505 'CLEANUP': 'Cleaning Docker images',
1506 'BIN_CLEANUP': 'Cleaning binaries',
1507 'CHECK_REPOS': 'Checking binaries'
1508 ]
1509
1510 def cmdParams = ''
1511 def jobDescription = ''
1512 for (e in parametersList) {
1513 if (env[e] == null || env[e] == '') {
1514 continue
1515 }
1516 if (e in mainModes) {
1517 jobDescription = mainModesDescriptions[e]
1518 }
1519 cmdParams += "-${e.replaceAll('_', '-').toLowerCase()} "
1520 if (!(e in parameterWithoutArgument)) {
1521 cmdParams += "'${env[e]}' "
1522 }
1523 }
1524 return [cmdParams, jobDescription]
1525}