blob: b8cfa0d6b7ef50e1f7c2a9923614d608d43afcce [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
Sergey Lalov78659102024-02-15 16:57:21 +04004import java.util.regex.Pattern
azvyagintsevc17d14b2022-06-06 19:06:33 +03005
vnaumov33747e12020-05-04 17:35:20 +02006/**
7 *
8 * KaaS Component Testing Utilities
9 *
10 */
11
Владислав Наумовe5345812020-08-12 16:30:20 +020012/**
13 * Check KaaS Core CICD feature flags
14 * such triggers can be used in case of switching between pipelines,
15 * conditions inside pipelines to reduce dependency on jenkins job builder and jenkins job templates itself
16 *
17 * @return (map)[
18 * ffNameEnabled: (bool) True/False
19 * ]
20 */
21def checkCoreCIFeatureFlags() {
22 def common = new com.mirantis.mk.Common()
23 def ff = [
24 build_artifacts_upgrade: false,
25 ]
26
27 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
28 if (commitMsg ==~ /(?s).*\[ci-build-artifacts-upgrade\].*/) {
29 ff['build_artifacts_upgrade'] = true
30 }
31
32 common.infoMsg("Core ci feature flags status: ${ff}")
33 return ff
34}
vnaumov33747e12020-05-04 17:35:20 +020035
36/**
azvyagintseva12230a2020-06-05 13:24:06 +030037 * Determine scope of test suite against per-commit KaaS deployment based on keywords
Владислав Наумов81777472021-03-09 15:14:27 +040038 * 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 +030039 *
40 * Used for components team to combine test-suites and forward desired parameters to kaas/core deployment jobs
41 * Example scheme:
Владислав Наумовe5345812020-08-12 16:30:20 +020042 * 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 +030043 * manage test-suite through Jenkins Job Parameters
44 *
Владислав Наумов6c2afff2020-06-05 12:54:53 +020045 * @return (map)[
46 * deployChildEnabled: (bool) True if need to deploy child cluster during demo-run
47 * runUie2eEnabled: (bool) True if need to run ui-e2e cluster during demo-run
azvyagintseva12230a2020-06-05 13:24:06 +030048 * ]
49 */
vnaumov33747e12020-05-04 17:35:20 +020050def checkDeploymentTestSuite() {
vnaumovbdb90222020-05-04 18:25:50 +020051 def common = new com.mirantis.mk.Common()
52
vnaumov33747e12020-05-04 17:35:20 +020053 // Available triggers and its sane defaults
Владислав Наумов44c64b72020-12-04 20:22:53 +010054 def seedMacOs = env.SEED_MACOS ? env.SEED_MACOS.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020055 def deployChild = env.DEPLOY_CHILD_CLUSTER ? env.DEPLOY_CHILD_CLUSTER.toBoolean() : false
56 def upgradeChild = env.UPGRADE_CHILD_CLUSTER ? env.UPGRADE_CHILD_CLUSTER.toBoolean() : false
Sergey Lalovc1cb49f2022-09-27 01:16:25 +040057 def fullUpgradeChild = env.FULL_UPGRADE_CHILD_CLUSTER ? env.FULL_UPGRADE_CHILD_CLUSTER.toBoolean() : false
Mikhail Ivanov38ee4382022-01-27 16:21:51 +040058 def mosDeployChild = env.DEPLOY_MOS_CHILD_CLUSTER ? env.DEPLOY_MOS_CHILD_CLUSTER.toBoolean() : false
59 def mosUpgradeChild = env.UPGRADE_MOS_CHILD_CLUSTER ? env.UPGRADE_MOS_CHILD_CLUSTER.toBoolean() : false
Mikhail Ivanov74504372021-05-21 17:01:06 +040060 def customChildRelease = env.KAAS_CHILD_CLUSTER_RELEASE_NAME ? env.KAAS_CHILD_CLUSTER_RELEASE_NAME : ''
slalov021171f2022-03-04 14:48:38 +040061 def mosTfDeploy = env.MOS_TF_DEPLOY ? env.MOS_TF_DEPLOY.toBoolean() : false
Владислав Наумов0dc99252020-11-13 13:30:48 +010062 def attachBYO = env.ATTACH_BYO ? env.ATTACH_BYO.toBoolean() : false
Владислав Наумовcdbd84e2020-12-01 16:51:09 +010063 def upgradeBYO = env.UPGRADE_BYO ? env.UPGRADE_BYO.toBoolean() : false
Vladislav Naumov7930ab22021-11-22 18:24:24 +010064 def runBYOMatrix = env.RUN_BYO_MATRIX ? env.RUN_BYO_MATRIX.toBoolean() : false
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +040065 def defaultBYOOs = env.DEFAULT_BYO_OS ? env.DEFAULT_BYO_OS.toString() : 'ubuntu'
Владислав Наумов6c2afff2020-06-05 12:54:53 +020066 def upgradeMgmt = env.UPGRADE_MGMT_CLUSTER ? env.UPGRADE_MGMT_CLUSTER.toBoolean() : false
slalov1202bba2022-04-20 22:31:07 +040067 def autoUpgradeMgmt = env.AUTO_UPGRADE_MCC ? env.AUTO_UPGRADE_MCC.toBoolean() : false
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +040068 def enableLMALogging = env.ENABLE_LMA_LOGGING ? env.ENABLE_LMA_LOGGING.toBoolean(): false
Sergey Lalovb2f60372022-09-20 23:58:47 +040069 def deployOsOnMos = env.DEPLOY_OS_ON_MOS? env.DEPLOY_OS_ON_MOS.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020070 def runUie2e = env.RUN_UI_E2E ? env.RUN_UI_E2E.toBoolean() : false
Mikhail Ivanovf5e20af2022-03-24 15:38:06 +040071 def runUie2eNew = env.RUN_UI_E2E_NEW ? env.RUN_UI_E2E_NEW.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020072 def runMgmtConformance = env.RUN_MGMT_CFM ? env.RUN_MGMT_CFM.toBoolean() : false
Sergey Lalovafcc0432023-04-13 14:59:06 +040073 def runMgmtConformanceNetworkPolicy = env.RUN_MGMT_CFM_NETWORK_POLICY ? env.RUN_MGMT_CFM_NETWORK_POLICY.toBoolean() : false
Владислав Наумов9cec55d2021-08-03 15:00:59 +020074 def runLMATest = env.RUN_LMA_TEST ? env.RUN_LMA_TEST.toBoolean() : false
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +020075 def runMgmtUserControllerTest = env.RUN_MGMT_USER_CONTROLLER_TEST ? env.RUN_MGMT_USER_CONTROLLER_TEST.toBoolean() : false
Mikhail Ivanov2907e4d2022-04-25 16:41:21 +040076 def runProxyChildTest = env.RUN_PROXY_CHILD_TEST ? env.RUN_PROXY_CHILD_TEST.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020077 def runChildConformance = env.RUN_CHILD_CFM ? env.RUN_CHILD_CFM.toBoolean() : false
Sergey Lalov012496a2023-11-27 15:57:52 +040078 def runChildStacklightHa = env.RUN_STACKLIGHT_CHILD_HA ? env.RUN_STACKLIGHT_CHILD_HA.toBoolean() : false
Sergey Lalovafcc0432023-04-13 14:59:06 +040079 def runChildConformanceNetworkPolicy = env.RUN_CHILD_CFM_NETWORK_POLICY ? env.RUN_CHILD_CFM_NETWORK_POLICY.toBoolean() : false
vryzhenkinb286bd82023-04-04 07:17:52 +040080 def runChildHPA = env.RUN_CHILD_HPA ? env.RUN_CHILD_HPA.toBoolean() : false
Владислав Наумов6c2afff2020-06-05 12:54:53 +020081 def fetchServiceBinaries = env.FETCH_BINARIES_FROM_UPSTREAM ? env.FETCH_BINARIES_FROM_UPSTREAM.toBoolean() : false
Vladislav Naumov42b71dc2021-11-22 13:09:42 +010082 def equinixMetalV2ChildDiffMetro = env.EQUINIXMETALV2_CHILD_DIFF_METRO ? env.EQUINIXMETALV2_CHILD_DIFF_METRO.toBoolean() : false
slalov13e579c2022-01-31 21:37:02 +040083 def runMaintenanceTest = env.RUN_MAINTENANCE_TEST ? env.RUN_MAINTENANCE_TEST.toBoolean() : false
slalov0a4947a2022-06-09 15:44:35 +040084 def runContainerregistryTest = env.RUN_CONTAINER_REGISTRY_TEST ? env.RUN_CONTAINER_REGISTRY_TEST.toBoolean() : false
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +030085 def runMgmtDeleteMasterTest = env.RUN_MGMT_DELETE_MASTER_TEST ? env.RUN_MGMT_DELETE_MASTER_TEST.toBoolean() : false
86 def runRgnlDeleteMasterTest = env.RUN_RGNL_DELETE_MASTER_TEST ? env.RUN_RGNL_DELETE_MASTER_TEST.toBoolean() : false
87 def runChildDeleteMasterTest = env.RUN_CHILD_DELETE_MASTER_TEST ? env.RUN_CHILD_DELETE_MASTER_TEST.toBoolean() : false
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +030088 def runGracefulRebootTest = env.RUN_GRACEFUL_REBOOT_TEST ? env.RUN_GRACEFUL_REBOOT_TEST.toBoolean() : false
Sergey Lalovbc68d752022-11-08 13:40:53 +040089 def pauseForDebug = env.PAUSE_FOR_DEBUG ? env.PAUSE_FOR_DEBUG.toBoolean() : false
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +030090 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 +040091 def runChildCustomCertTest = env.RUN_CHILD_CUSTOM_CERT_TEST ? env.RUN_CHILD_CUSTOM_CERT_TEST.toBoolean() : false
Sergey Lalov430fcd72023-03-20 17:19:44 +040092 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 +040093 def runMgmtCustomCacheCertTest = env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST ? env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST.toBoolean() : false
Sergey Lalov48e69022023-07-25 16:08:00 +040094 def runMkeCustomCertTest = env.RUN_MKE_CUSTOM_CERT_TEST ? env.RUN_MKE_CUSTOM_CERT_TEST.toBoolean() : false
Sergey Lalov62c28312023-10-18 19:23:59 +040095 def runCustomHostnames = env.RUN_CUSTOM_HOSTNAMES ? env.RUN_CUSTOM_HOSTNAMES.toBoolean() : false
vryzhenkin504dfc92023-11-01 15:49:47 +040096 def slLatest = env.SL_LATEST ? env.SL_LATEST.toBoolean() : false
vryzhenkina8d74e72024-02-26 14:59:37 +040097 def coreKeycloakLdap = env.CORE_KEYCLOAK_LDAP_ENABLED ? env.CORE_KEYCLOAK_LDAP_ENABLED.toBoolean() : false
vryzhenkine0ff1d82024-03-18 15:08:09 +040098 def configureInternalNTP = env.CORE_KAAS_NTP_ENABLED ? env.CORE_KAAS_NTP_ENABLED.toBoolean() : false
Sergey Lalovd7593ab2024-01-11 13:40:13 +040099 def disableKubeApiAudit = env.DISABLE_KUBE_API_AUDIT ? env.DISABLE_KUBE_API_AUDIT.toBoolean() : false
Sergey Lalovf44cbb72024-03-27 15:19:24 +0400100 def auditd = env.AUDITD_ENABLE ? env.AUDITD_ENABLE.toBoolean() : false
Sergey Lalov7c2377e2023-12-15 23:14:45 +0400101 def customSlackChannel = env.SLACK_CHANNEL_NOTIFY ? env.SLACK_CHANNEL_NOTIFY : ''
Viktor Astakhovadfcfb52024-05-16 16:56:21 +0400102 def runNTPUpdateTest = env.RUN_NTP_UPDATE_TEST ? env.RUN_NTP_UPDATE_TEST.toBoolean() : false
Viktor Astakhov8da448c2024-06-14 14:59:32 +0400103 def runMCCMariaBackupRestoreTest = env.RUN_MCC_MARIA_BACKUP_RESTORE_TEST ? env.RUN_MCC_MARIA_BACKUP_RESTORE_TEST.toBoolean() : false
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000104 // multiregion configuration from env variable: comma-separated string in form $mgmt_provider,$regional_provider
105 def multiregionalMappings = env.MULTIREGION_SETUP ? multiregionWorkflowParser(env.MULTIREGION_SETUP) : [
106 enabled: false,
107 managementLocation: '',
108 regionLocation: '',
109 ]
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200110
Владислав Наумовb8305e22021-02-10 17:23:12 +0100111 // proxy customization
112 def proxyConfig = [
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200113 mgmtOffline: env.OFFLINE_MGMT_CLUSTER ? env.OFFLINE_MGMT_CLUSTER.toBoolean() : false,
114 childOffline: env.OFFLINE_CHILD_CLUSTER ? env.OFFLINE_CHILD_CLUSTER.toBoolean() : false,
Владислав Наумов257ea132021-04-14 14:44:13 +0200115 childProxy: env.PROXY_CHILD_CLUSTER ? env.PROXY_CHILD_CLUSTER.toBoolean() : false,
Владислав Наумовb8305e22021-02-10 17:23:12 +0100116 ]
117
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200118 // optional demo deployment customization
Владислав Наумов905dd362020-06-08 16:37:01 +0200119 def awsOnDemandDemo = env.ALLOW_AWS_ON_DEMAND ? env.ALLOW_AWS_ON_DEMAND.toBoolean() : false
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000120 def equinixOnDemandDemo = env.ALLOW_EQUINIX_ON_DEMAND ? env.ALLOW_EQUINIX_ON_DEMAND.toBoolean() : false
Владислав Наумов82305e92021-10-14 20:45:20 +0200121 def equinixMetalV2OnDemandDemo = env.ALLOW_EQUINIXMETALV2_ON_DEMAND ? env.ALLOW_EQUINIXMETALV2_ON_DEMAND.toBoolean() : false
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000122 def equinixOnAwsDemo = env.EQUINIX_ON_AWS_DEMO ? env.EQUINIX_ON_AWS_DEMO.toBoolean() : false
123 def azureOnAwsDemo = env.AZURE_ON_AWS_DEMO ? env.AZURE_ON_AWS_DEMO.toBoolean() : false
124 def azureOnDemandDemo = env.ALLOW_AZURE_ON_DEMAND ? env.ALLOW_AZURE_ON_DEMAND.toBoolean() : false
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400125 def enableVsphereDemo = true
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200126 def enableOSDemo = true
azvyagintsev1761bdc2020-09-04 17:24:12 +0300127 def enableBMDemo = true
Sergey Lalovc62e9382024-01-29 15:19:15 +0400128 def enablebmCoreDemo = env.ALLOW_BM_CORE_ON_DEMAND ? env.ALLOW_BM_CORE_ON_DEMAND.toBoolean() : false
Sergey Lalovef5c9dc2024-03-20 22:30:06 +0400129 def bmCoreCleanup = env.BM_CORE_CLEANUP ? env.BM_CORE_CLEANUP.toBoolean() : true
Mikhail Ivanovbd1a9fd2022-03-29 21:36:21 +0400130 def enableArtifactsBuild = true
Sergey Lalovcad93332024-03-11 16:19:31 +0400131 def bmDeployType = env.BM_DEPLOY_TYPE ? env.BM_DEPLOY_TYPE.toString() : 'virtual'
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400132 def openstackIMC = env.OPENSTACK_CLOUD_LOCATION ? env.OPENSTACK_CLOUD_LOCATION : 'us'
Alexandr Lovtsov36473f32022-04-28 15:46:09 +0300133 def enableVsphereUbuntu = env.VSPHERE_DEPLOY_UBUNTU ? env.VSPHERE_DEPLOY_UBUNTU.toBoolean() : false
Ivan Berezovskiy30c4b122023-11-06 18:03:18 +0500134 def enableVsphereRHEL = env.VSPHERE_DEPLOY_RHEL ? env.VSPHERE_DEPLOY_RHEL.toBoolean() : false
Sergey Zhemerdeeve67fb262022-06-21 00:49:34 +0300135 def childOsBootFromVolume = env.OPENSTACK_BOOT_FROM_VOLUME ? env.OPENSTACK_BOOT_FROM_VOLUME.toBoolean() : false
Ivan Berezovskiy29e72b72022-07-12 21:03:24 +0400136 def bootstrapV2Scenario = env.BOOTSTRAP_V2_ENABLED ? env.BOOTSTRAP_V2_ENABLED.toBoolean() : false
Sergey Lalovacec3c12022-07-20 16:00:14 +0400137 def equinixMetalV2Metro = env.EQUINIX_MGMT_METRO ? env.EQUINIX_MGMT_METRO : ''
Mikhail Ivanov3088d3d2022-10-24 14:05:46 +0400138 def enableFips = env.ENABLE_FIPS ? env.ENABLE_FIPS.toBoolean() : false
Sergey Lalov00bea0f2023-08-14 16:46:33 +0400139 def enableMkeDebug = env.ENABLE_MKE_DEBUG ? env.ENABLE_MKE_DEBUG.toBoolean() : false
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300140 def aioCluster = env.AIO_CLUSTER ? env.AIO_CLUSTER.toBoolean() : false
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100141 def useVsphereVvmtObjects = env.VSPHERE_USE_VVMT_OBJECTS ? env.VSPHERE_USE_VVMT_OBJECTS.toBoolean() : false
vryzhenkin4fd3f242023-03-29 15:13:46 +0400142 def enableBv2Smoke = true
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400143 def runCacheWarmup = env.CACHE_WARMUP_ENABLED ? env.CACHE_WARMUP_ENABLED.toBoolean() : false
vryzhenkin211a4e82023-11-23 12:48:27 +0400144 def cveScan = false
vnaumov33747e12020-05-04 17:35:20 +0200145
Владислав Наумов6c2afff2020-06-05 12:54:53 +0200146 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
Владислав Наумовb8305e22021-02-10 17:23:12 +0100147 if (commitMsg ==~ /(?s).*\[mgmt-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-proxy.*/) {
148 proxyConfig['mgmtOffline'] = true
Владислав Наумов70c02422021-04-19 14:29:41 +0200149 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 +0100150 }
Sergey Kolekonov5995dfd2023-07-06 16:09:43 +0600151 if (commitMsg ==~ /(?s).*\[mgmt-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-upgrade.*/) {
152 upgradeMgmt = true
153 }
154 if (commitMsg ==~ /(?s).*\[auto-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*auto-upgrade.*/) {
155 autoUpgradeMgmt = true
156 }
Владислав Наумов44c64b72020-12-04 20:22:53 +0100157 if (commitMsg ==~ /(?s).*\[seed-macos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*seed-macos.*/) {
158 seedMacOs = true
159 }
Sergey Lalovafcc0432023-04-13 14:59:06 +0400160 if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ ||
161 upgradeChild || runChildConformance || runProxyChildTest || runChildHPA || runChildConformanceNetworkPolicy) {
vnaumov33747e12020-05-04 17:35:20 +0200162 deployChild = true
163 }
164 if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) {
165 deployChild = true
166 upgradeChild = true
167 }
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400168 if (commitMsg ==~ /(?s).*\[child-upgrade-full\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade-full.*/) {
169 deployChild = true
170 upgradeChild = true
Sergey Lalova048df92023-06-19 19:36:41 +0400171 common.warningMsg("2-step child updates are not testing (PRODX-33510)")
172 //TODO: revert after start testing the two-step upgrade again (PRODX-33510)
173 //fullUpgradeChild = true
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400174 }
Sergey Kolekonov5995dfd2023-07-06 16:09:43 +0600175 if ((upgradeMgmt || autoUpgradeMgmt) && deployChild) {
176 upgradeChild = true
177 common.warningMsg('child upgrade is automatically enabled as mgmt upgrade and child deploy are enabled')
178 }
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400179 def childDeployMatches = (commitMsg =~ /(\[child-deploy\s*(\w|\-)+?\])/)
180 if (childDeployMatches.size() > 0) {
Mikhail Ivanov74504372021-05-21 17:01:06 +0400181 // override child version when it set explicitly
182 deployChild = true
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400183 customChildRelease = childDeployMatches[0][0].split('child-deploy')[1].replaceAll('[\\[\\]]', '').trim()
Mikhail Ivanov74504372021-05-21 17:01:06 +0400184 common.warningMsg("Forced child deployment using custom release version ${customChildRelease}")
185 }
Mikhail Ivanov38ee4382022-01-27 16:21:51 +0400186 if (commitMsg ==~ /(?s).*\[mos-child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-deploy.*/) {
187 mosDeployChild = true
188 }
189 if (commitMsg ==~ /(?s).*\[mos-child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-upgrade.*/) {
190 mosDeployChild = true
191 mosUpgradeChild = true
192 }
Sergey Kolekonov5995dfd2023-07-06 16:09:43 +0600193 if ((upgradeMgmt || autoUpgradeMgmt) && mosDeployChild) {
194 mosUpgradeChild = true
195 common.warningMsg('MOSK child upgrade is automatically enabled as mgmt upgrade and MOSK child deploy are enabled')
196 }
Владислав Наумов0dc99252020-11-13 13:30:48 +0100197 if (commitMsg ==~ /(?s).*\[byo-attach\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-attach.*/) {
198 attachBYO = true
199 }
Владислав Наумовcdbd84e2020-12-01 16:51:09 +0100200 if (commitMsg ==~ /(?s).*\[byo-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-upgrade.*/) {
201 attachBYO = true
202 upgradeBYO = true
203 }
Sergey Lalovacec3c12022-07-20 16:00:14 +0400204 if (commitMsg ==~ /(?s).*\[ui-test-on-all-providers\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-test-on-all-providers.*/) {
205 enableVsphereDemo = true
206 enableOSDemo = true
207 awsOnDemandDemo = true
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000208 azureOnDemandDemo = true
209 equinixOnDemandDemo = true
Sergey Lalovacec3c12022-07-20 16:00:14 +0400210 equinixMetalV2OnDemandDemo = true
211 runUie2e = true
Sergey Lalovacec3c12022-07-20 16:00:14 +0400212 // Edit after fix PRODX-3961
213 enableBMDemo = false
214 }
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400215 def byoDeployMatches = (commitMsg =~ /(\[run-byo-matrix\s*(ubuntu|centos)\])/)
216 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 +0100217 runBYOMatrix = true
218
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400219 if (byoDeployMatches.size() > 0) {
220 defaultBYOOs = byoDeployMatches[0][2]
221 common.warningMsg("Custom BYO OS detected, using ${defaultBYOOs}")
222 }
223
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100224 common.warningMsg('Forced byo matrix test via run-byo-matrix, all other byo triggers will be skipped')
225 attachBYO = false
226 upgradeBYO = false
227 }
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400228 if (commitMsg ==~ /(?s).*\[lma-logging\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-logging.*/) {
229 enableLMALogging = true
230 }
Sergey Lalovb2f60372022-09-20 23:58:47 +0400231 if (commitMsg ==~ /(?s).*\[deploy-os-on-mos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*deploy-os-on-mos.*/) {
232 deployOsOnMos = true
233 mosDeployChild = true
Sergey Lalovb2f60372022-09-20 23:58:47 +0400234 }
Sergey Lalovd0e20852023-08-17 19:11:19 +0400235
236 if (commitMsg ==~ /(?s).*\[half-virtual\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*half-virtual.*/ || upgradeMgmt) {
237 bmDeployType = 'half-virtual'
238 common.infoMsg('Half-virtual will be deployed by default on upgrade case')
239 }
240
Sergey Lalov95040602023-03-07 16:42:16 +0400241 if (commitMsg ==~ /(?s).*\[ui-e2e-nw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-nw.*/) {
vnaumov33747e12020-05-04 17:35:20 +0200242 runUie2e = true
243 }
Sergey Lalov95040602023-03-07 16:42:16 +0400244 if (commitMsg ==~ /(?s).*\[ui-e2e-pw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-pw.*/) {
Mikhail Ivanovf5e20af2022-03-24 15:38:06 +0400245 runUie2eNew = true
246 }
vnaumov33747e12020-05-04 17:35:20 +0200247 if (commitMsg ==~ /(?s).*\[mgmt-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm.*/) {
248 runMgmtConformance = true
249 }
Sergey Lalovafcc0432023-04-13 14:59:06 +0400250 if (commitMsg ==~ /(?s).*\[mgmt-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm-netpolicy.*/) {
251 runMgmtConformanceNetworkPolicy = true
252 }
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +0200253 if (commitMsg ==~ /(?s).*\[test-user-controller\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-user-controller.*/) {
254 runMgmtUserControllerTest = true
255 }
slalov574123e2022-04-06 17:24:19 +0400256 if (commitMsg ==~ /(?s).*\[test-proxy-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-proxy-child.*/) {
257 runProxyChildTest = true
258 deployChild = true
259 common.infoMsg('Child cluster deployment will be enabled since proxy child test suite will be executed')
260 }
vnaumov33747e12020-05-04 17:35:20 +0200261 if (commitMsg ==~ /(?s).*\[child-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm.*/) {
262 runChildConformance = true
263 deployChild = true
264 }
Sergey Lalovafcc0432023-04-13 14:59:06 +0400265 if (commitMsg ==~ /(?s).*\[child-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm-netpolicy.*/) {
266 runChildConformanceNetworkPolicy = true
267 deployChild = true
268 }
vryzhenkinb286bd82023-04-04 07:17:52 +0400269 if (commitMsg ==~ /(?s).*\[child-hpa\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-hpa.*/) {
270 runChildHPA = true
271 deployChild = true
272 }
Sergey Lalov012496a2023-11-27 15:57:52 +0400273 if (commitMsg ==~ /(?s).*\[child-sl-ha\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-sl-ha.*/) {
274 runChildStacklightHa = true
275 deployChild = true
276 }
Владислав Наумов9cec55d2021-08-03 15:00:59 +0200277 if (commitMsg ==~ /(?s).*\[lma-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-test.*/) {
278 runLMATest = true
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400279 enableLMALogging = true
280 common.infoMsg('LMA logging will be enabled since LMA test suite will be executed')
Victor Ryzhenkin15206592021-06-21 17:38:23 +0400281 }
slalov13e579c2022-01-31 21:37:02 +0400282 if (commitMsg ==~ /(?s).*\[maintenance-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*maintenance-test.*/) {
283 runMaintenanceTest = true
284 }
slalov0a4947a2022-06-09 15:44:35 +0400285 if (commitMsg ==~ /(?s).*\[container-registry-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*container-registry-test.*/) {
286 runContainerregistryTest = true
287 }
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300288 if (commitMsg ==~ /(?s).*\[mgmt-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-delete-master-test.*/) {
289 runMgmtDeleteMasterTest = true
290 }
291 if (commitMsg ==~ /(?s).*\[rgnl-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*rgnl-delete-master-test.*/) {
292 runRgnlDeleteMasterTest = true
293 }
294 if (commitMsg ==~ /(?s).*\[child-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-delete-master-test.*/) {
Sergey Lalov47e21592023-07-18 23:36:32 +0400295 if (!mosDeployChild) {
296 deployChild = true
297 }
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300298 runChildDeleteMasterTest = true
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300299 common.infoMsg('Child cluster deployment will be enabled since delete child master node test suite will be executed')
300 }
301 if (commitMsg ==~ /(?s).*\[child-machine-deletion-policy-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-machine-deletion-policy-test.*/) {
302 runChildMachineDeletionPolicyTest = true
303 deployChild = true
304 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 +0300305 }
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +0300306 if (commitMsg ==~ /(?s).*\[graceful-reboot-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*graceful-reboot-test.*/) {
307 runGracefulRebootTest = true
308 }
Sergey Lalovbc68d752022-11-08 13:40:53 +0400309 if (commitMsg ==~ /(?s).*\[pause-for-debug\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*pause-for-debug.*/) {
310 pauseForDebug = true
311 }
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200312 if (commitMsg ==~ /(?s).*\[child-offline\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-offline.*/) {
313 proxyConfig['childOffline'] = true
314 deployChild = true
315 }
Владислав Наумов257ea132021-04-14 14:44:13 +0200316 if (commitMsg ==~ /(?s).*\[child-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-proxy.*/) {
317 proxyConfig['childOffline'] = true
318 proxyConfig['childProxy'] = true
319 deployChild = true
320 }
vnaumov33747e12020-05-04 17:35:20 +0200321 if (commitMsg ==~ /(?s).*\[fetch.*binaries\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*fetch.*binaries.*/) {
322 fetchServiceBinaries = true
323 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000324 if (commitMsg ==~ /(?s).*\[equinix-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-on-aws.*/) {
325 equinixOnAwsDemo = true
326 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]\' ')
327 }
328 if (commitMsg ==~ /(?s).*\[azure-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-on-aws.*/) {
329 azureOnAwsDemo = true
330 common.warningMsg('Forced running child cluster deployment on Azure provider based on AWS management cluster, triggered on patchset using custom keyword: \'[azure-on-aws]\' ')
331 }
Владислав Наумов2d3db332021-06-15 15:19:19 +0200332 if (commitMsg ==~ /(?s).*\[aws-demo\].*/ ||
333 env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aws-demo.*/ ||
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100334 runBYOMatrix ||
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000335 seedMacOs ||
336 equinixOnAwsDemo ||
337 azureOnAwsDemo) {
Владислав Наумов2d3db332021-06-15 15:19:19 +0200338
vnaumov33747e12020-05-04 17:35:20 +0200339 awsOnDemandDemo = true
Владислав Наумов2d3db332021-06-15 15:19:19 +0200340 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 +0200341 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000342 if (commitMsg ==~ /(?s).*\[equinix-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-demo\.*/) {
343 equinixOnDemandDemo = true
344 }
Владислав Наумов82305e92021-10-14 20:45:20 +0200345 if (commitMsg ==~ /(?s).*\[equinixmetalv2-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-demo\.*/) {
Владислав Наумов144956f2021-10-14 17:49:19 +0200346 equinixMetalV2OnDemandDemo = true
347 }
Vladislav Naumov42b71dc2021-11-22 13:09:42 +0100348 if (commitMsg ==~ /(?s).*\[equinixmetalv2-child-diff-metro\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-child-diff-metro\.*/) {
349 equinixMetalV2OnDemandDemo = true
350 equinixMetalV2ChildDiffMetro = true
351 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000352 if (commitMsg ==~ /(?s).*\[azure-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-demo\.*/) {
353 azureOnDemandDemo = true
354 }
Sergey Lalov10cb3502023-03-27 22:13:49 +0400355 if (commitMsg ==~ /(?s).*\[disable-all-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-all-demo\.*/) {
356 enableVsphereDemo = false
357 enableOSDemo = false
358 enableBMDemo = false
Sergey Lalov781fccc2023-10-12 21:55:17 +0400359 enableBv2Smoke = false
360 common.errorMsg('vSphere, BM, Openstack, demo deployments and Bootstrap v2 smoke checks will be aborted, VF -1 will be set')
Sergey Lalov10cb3502023-03-27 22:13:49 +0400361 }
362
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200363 if (commitMsg ==~ /(?s).*\[disable-os-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-os-demo\.*/) {
364 enableOSDemo = false
365 common.errorMsg('Openstack demo deployment will be aborted, VF -1 will be set')
vnaumov33747e12020-05-04 17:35:20 +0200366 }
367
azvyagintsev1761bdc2020-09-04 17:24:12 +0300368 if (commitMsg ==~ /(?s).*\[disable-bm-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-demo\.*/) {
369 enableBMDemo = false
370 common.errorMsg('BM demo deployment will be aborted, VF -1 will be set')
371 }
372
Sergey Lalovd0e20852023-08-17 19:11:19 +0400373 if (commitMsg ==~ /(?s).*\[bm-core-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bm-core-demo\\.*/) {
374 enablebmCoreDemo = true
375 enableBMDemo = false
376 }
377
378 if (commitMsg ==~ /(?s).*\[disable-bm-core-cleanup\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-core-cleanup\\.*/) {
379 bmCoreCleanup = false
380 }
381
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400382 if (commitMsg ==~ /(?s).*\[disable-vsphere-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-vsphere-demo\.*/) {
383 enableVsphereDemo = false
384 common.errorMsg('vSphere demo deployment will be aborted, VF -1 will be set')
385 }
Alexandr Lovtsov36473f32022-04-28 15:46:09 +0300386 if (commitMsg ==~ /(?s).*\[vsphere-ubuntu\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-ubuntu\.*/) {
387 enableVsphereUbuntu = true
388 common.warningMsg('Ubuntu will be used to deploy vsphere machines')
389 }
Ivan Berezovskiy30c4b122023-11-06 18:03:18 +0500390 if (commitMsg ==~ /(?s).*\[vsphere-rhel\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-rhel\.*/) {
391 enableVsphereRHEL = true
392 common.warningMsg('RHEL will be used to deploy vsphere machines')
393 }
vryzhenkin4fd3f242023-03-29 15:13:46 +0400394 if (commitMsg ==~ /(?s).*\[disable-bv2-smoke\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bv2-smoke\.*/) {
395 enableBv2Smoke = false
396 common.errorMsg('Bootstrap v2 smoke checks will be aborted, WF -1 will be set')
397 }
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400398
vryzhenkin211a4e82023-11-23 12:48:27 +0400399 if (commitMsg ==~ /(?s).*\[cve-scan\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*cve-scan\.*/) {
400 cveScan = true
401 common.errorMsg('CVE Scan job enabled')
402 }
403
Sergey Lalov7c2377e2023-12-15 23:14:45 +0400404 def slackChannelMatches = (commitMsg =~ /(\[slack-channel\s*[#@](\S+)])/)
405 if (slackChannelMatches.size() > 0) {
406 // override chanenel notify when it set explicitly
407 customSlackChannel = slackChannelMatches[0][0].split("slack-channel")[1].replaceAll('[\\[\\]]', '').trim()
408 common.warningMsg("Forced send notify to ${customSlackChannel} channel")
409 }
410
Mikhail Ivanovbd1a9fd2022-03-29 21:36:21 +0400411 if (commitMsg ==~ /(?s).*\[disable-artifacts-build\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-artifacts-build\.*/) {
412 enableArtifactsBuild = false
413 common.errorMsg('artifacts build will be aborted, VF -1 will be set')
414 }
415
Sergey Zhemerdeeve67fb262022-06-21 00:49:34 +0300416 if (commitMsg ==~ /(?s).*\[child-os-boot-from-volume\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-os-boot-from-volume\.*/) {
417 childOsBootFromVolume = true
418 common.warningMsg('OS will be booted from Ceph volumes')
419 }
420
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400421 if (commitMsg ==~ /(?s).*\[child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-custom-cert-test\.*/) {
422 runChildCustomCertTest = true
423 deployChild = true
424 common.warningMsg('Child cluster deployment will be enabled since custom cert child test suite will be executed')
425 }
426
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400427 if (commitMsg ==~ /(?s).*\[mgmt-custom-cache-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-custom-cache-cert-test\.*/) {
428 runMgmtCustomCacheCertTest = true
429 deployChild = true
430 common.warningMsg('Child cluster deployment will be enabled as the test replaces the mgmt and cluster childcertificates')
431 }
432
Sergey Lalov48e69022023-07-25 16:08:00 +0400433 if (commitMsg ==~ /(?s).*\[mke-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mke-custom-cert-test\.*/) {
434 runMkeCustomCertTest = true
435 }
436
Sergey Lalov62c28312023-10-18 19:23:59 +0400437 if (commitMsg ==~ /(?s).*\[custom-hostnames\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*custom-hostnames\.*/) {
438 runCustomHostnames = true
439 common.warningMsg('All clusters will be deployed with Custom Hostnames')
440 }
441
vryzhenkin504dfc92023-11-01 15:49:47 +0400442 if (commitMsg ==~ /(?s).*\[sl-latest\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*sl-latest\.*/) {
443 slLatest = true
444 common.warningMsg('All clusters will be deployed with Stacklight version from artifact-metadata')
445 }
446
vryzhenkina8d74e72024-02-26 14:59:37 +0400447 if (commitMsg ==~ /(?s).*\[keycloak-ldap\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*keycloak-ldap\.*/) {
448 coreKeycloakLdap = true
449 common.warningMsg('Management cluster will be deployed with LDAP integration enabled and after-deployment checks will be executed')
450 }
451
Viktor Astakhovadfcfb52024-05-16 16:56:21 +0400452 if (commitMsg ==~ /(?s).*\[ntp-update\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ntp-update\.*/) {
453 runNTPUpdateTest = true
454 common.warningMsg('After deployment of mgmt job with NTP update will be executed')
455 }
456
Viktor Astakhov8da448c2024-06-14 14:59:32 +0400457 if (commitMsg ==~ /(?s).*\[mcc-maria-backup-restore\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mcc-maria-backup-restore\.*/) {
458 runMCCMariaBackupRestoreTest = true
459 common.warningMsg('MCC Maria Backup/Restore test will be executed as part of mgmt test suite')
460 }
461
vryzhenkine0ff1d82024-03-18 15:08:09 +0400462 if (commitMsg ==~ /(?s).*\[internal-ntp\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*internal-ntp\.*/ || proxyConfig['mgmtOffline'] || proxyConfig['childOffline']) {
463 configureInternalNTP = true
Sergey Lalov348f9452024-04-18 10:34:04 +0000464 openstackIMC = 'eu'
465 common.warningMsg('Internal NTP servers will be used. Forced deployment for an offline case in eu cloud')
vryzhenkine0ff1d82024-03-18 15:08:09 +0400466 }
467
Sergey Lalovd7593ab2024-01-11 13:40:13 +0400468 if (commitMsg ==~ /(?s).*\[disable-kube-api-audit\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-kube-api-audit\.*/) {
469 disableKubeApiAudit = true
470 common.warningMsg('Disable KUBE API audit for mgmt cluster')
471 }
472
Sergey Lalov26e24c22024-03-20 13:47:31 +0400473 if (commitMsg ==~ /(?s).*\[auditd\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-kube-api-audit\.*/) {
474 auditd = true
475 }
476
Sergey Lalov430fcd72023-03-20 17:19:44 +0400477 if (commitMsg ==~ /(?s).*\[byo-child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-child-custom-cert-test\.*/) {
478 runByoChildCustomCertTest = true
479 attachBYO = true
480 common.warningMsg('Byo child cluster deployment will be enabled since custom cert child test suite will be executed')
481 }
482
vnaumov33747e12020-05-04 17:35:20 +0200483 // TODO (vnaumov) remove below condition after moving all releases to UCP
484 def ucpChildMatches = (commitMsg =~ /(\[child-ucp\s*ucp-.*?\])/)
485 if (ucpChildMatches.size() > 0) {
486 deployChild = true
487 common.warningMsg('Forced UCP based child deployment triggered on patchset using custom keyword: \'[child-ucp ucp-5-1-0-3-3-0-example]\' ')
488
489 // TODO(vnaumov) delete after ucp upgrades support
490 common.errorMsg('Child upgrade test will be skipped, UCP upgrades temporally disabled')
491 upgradeChild = false
492 }
493
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300494 if (commitMsg ==~ /(?s).*\[aio-cluster\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aio-cluster.*/) {
495 aioCluster = true
496 }
497
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400498 if (commitMsg ==~ /(?s).*\[cache-warmup\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*cache-warmup.*/) {
499 runCacheWarmup = true
500 }
501
502 if (runCacheWarmup && (!deployChild && !mosDeployChild)) {
503 runCacheWarmup = false
504 common.errorMsg('Child cluster deployment is not enabled, skipping Cache Warmup')
505 }
506
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000507 // multiregional tests
508 def multiRegionalMatches = (commitMsg =~ /(\[multiregion\s*.*?\])/)
509 if (multiRegionalMatches.size() > 0) {
510 multiregionalMappings = multiregionWorkflowParser(multiRegionalMatches)
511 }
512 switch (multiregionalMappings['managementLocation']) {
513 case 'aws':
514 common.warningMsg('Forced running additional kaas deployment with AWS provider according multiregional demo request')
515 awsOnDemandDemo = true
516
517 if (multiregionalMappings['regionLocation'] != 'aws' && seedMacOs) { // macstadium seed node has access only to *public* providers
518 error('incompatible triggers: [seed-macos] and multiregional deployment based on *private* regional provider cannot be applied simultaneously')
519 }
520 break
521 case 'os':
522 if (enableOSDemo == false) {
523 error('incompatible triggers: [disable-os-demo] and multiregional deployment based on OSt management region cannot be applied simultaneously')
524 }
525 break
526 case 'vsphere':
527 if (enableVsphereDemo == false) {
528 error('incompatible triggers: [disable-vsphere-demo] and multiregional deployment based on Vsphere management region cannot be applied simultaneously')
529 }
530 break
531 case 'equinix':
532 common.warningMsg('Forced running additional kaas deployment with Equinix provider according multiregional demo request')
533 equinixOnDemandDemo = true
534 break
535 case 'equinixmetalv2':
536 common.warningMsg('Forced running additional kaas deployment with Equinix Metal V2 provider according multiregional demo request')
537 equinixMetalV2OnDemandDemo = true
538 break
539 case 'azure':
540 common.warningMsg('Forced running additional kaas deployment with Azure provider according multiregional demo request')
541 azureOnDemandDemo = true
542 break
543 }
544
Владислав Наумовb8305e22021-02-10 17:23:12 +0100545 // CDN configuration
546 def cdnConfig = [
547 mgmt: [
Sergey Lalovf80dab52024-04-19 14:16:52 +0000548 openstack: 'internal-ci',
Sergey Lalov3ad827f2024-04-19 18:40:21 +0400549 vsphere: 'internal-eu',
Владислав Наумовb8305e22021-02-10 17:23:12 +0100550 aws: 'public-ci',
Владислав Наумовe021b022021-05-06 11:26:38 +0200551 equinix: 'public-ci',
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000552 azure: 'public-ci',
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200553 ],
Владислав Наумовb8305e22021-02-10 17:23:12 +0100554 ]
555
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400556 if (commitMsg ==~ /(?s).*\[eu-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*eu-demo.*/) {
557 openstackIMC = 'eu'
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400558 }
Sergey Lalovac6a8e72023-12-19 01:28:41 +0400559
560 if (openstackIMC == 'eu') {
slalov021171f2022-03-04 14:48:38 +0400561 // use internal-eu because on internal-ci with eu cloud image pull takes much time
Sergey Lalovf80dab52024-04-19 14:16:52 +0000562 def cdnRegion = 'internal-eu'
slalov021171f2022-03-04 14:48:38 +0400563 cdnConfig['mgmt']['openstack'] = cdnRegion
564 }
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400565
Владислав Наумов74e2d6e2020-12-30 17:05:40 +0100566 // calculate weight of current demo run to manage lockable resources
Sergey Lalov46deb442022-08-18 12:11:03 +0400567 def demoWeight = deployChild ? 2 : 1 // management = 1, child += 1
Sergey Lalov95040602023-03-07 16:42:16 +0400568 if (runUie2e || runUie2eNew) {
Sergey Lalov46deb442022-08-18 12:11:03 +0400569 demoWeight += 1
570 }
Владислав Наумов74e2d6e2020-12-30 17:05:40 +0100571
Sergey Laloveb611b22023-09-22 16:59:09 +0400572 if (commitMsg ==~ /(?s).*\[bootstrapv1-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv1-scenario\.*/) {
573 bootstrapV2Scenario = false
574 }
575
Ivan Berezovskiy29e72b72022-07-12 21:03:24 +0400576 if (commitMsg ==~ /(?s).*\[bootstrapv2-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv2-scenario\.*/) {
577 bootstrapV2Scenario = true
578 }
579
Mikhail Ivanov3088d3d2022-10-24 14:05:46 +0400580 if (commitMsg ==~ /(?s).*\[enable-fips\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*enable-fips\.*/) {
581 enableFips = true
582 }
583
Sergey Lalov00bea0f2023-08-14 16:46:33 +0400584 if (commitMsg ==~ /(?s).*\[enable-mke-debug\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*enable-mke-debug\.*/) {
585 enableMkeDebug = true
586 }
587
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100588 if (commitMsg ==~ /(?s).*\[vsphere-vvmt-obj\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-vvmt-obj\.*/) {
589 useVsphereVvmtObjects = true
590 }
591
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300592 // parse equinixmetalv2-metro trigger
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300593 def equinixMetalV2MetroMatcher = (commitMsg =~ /\[equinixmetalv2-metro(\s+.*)?\]/)
594 if (equinixMetalV2OnDemandDemo && equinixMetalV2MetroMatcher.size() > 0) {
Sergey Zhemerdeevcc785e42022-07-22 17:15:47 +0300595 equinixMetalV2Metro = equinixMetalV2MetroMatcher[0][1].trim().toLowerCase()
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300596 common.infoMsg("Forced Equnix mgmt deployment using custom metro ${equinixMetalV2Metro}")
597 }
598
vnaumov33747e12020-05-04 17:35:20 +0200599 common.infoMsg("""
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400600 OpenStack Cloud location: ${openstackIMC}
Владислав Наумовb8305e22021-02-10 17:23:12 +0100601 CDN deployment configuration: ${cdnConfig}
602 MCC offline deployment configuration: ${proxyConfig}
Владислав Наумов44c64b72020-12-04 20:22:53 +0100603 Use MacOS node as seed: ${seedMacOs}
vnaumov33747e12020-05-04 17:35:20 +0200604 Child cluster deployment scheduled: ${deployChild}
Mikhail Ivanov74504372021-05-21 17:01:06 +0400605 Custom child cluster release: ${customChildRelease}
vnaumov33747e12020-05-04 17:35:20 +0200606 Child cluster release upgrade scheduled: ${upgradeChild}
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400607 Full Child cluster release upgrade scheduled: ${fullUpgradeChild}
Mikhail Ivanov38ee4382022-01-27 16:21:51 +0400608 MOS child deploy scheduled: ${mosDeployChild}
609 MOS child upgrade scheduled: ${mosUpgradeChild}
vnaumov33747e12020-05-04 17:35:20 +0200610 Child conformance testing scheduled: ${runChildConformance}
Sergey Lalovafcc0432023-04-13 14:59:06 +0400611 Child conformance network policy testing scheduled: ${runChildConformanceNetworkPolicy}
vryzhenkinb286bd82023-04-04 07:17:52 +0400612 Child HPA testing scheduled: ${runChildHPA}
Sergey Lalov012496a2023-11-27 15:57:52 +0400613 Child Stacklight HA: ${runChildStacklightHa}
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100614 Single BYO cluster attachment scheduled: ${attachBYO}
615 Single Attached BYO cluster upgrade test scheduled: ${upgradeBYO}
616 BYO test matrix whole suite scheduled: ${runBYOMatrix}
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400617 Default BYO OS: ${defaultBYOOs}
vnaumov33747e12020-05-04 17:35:20 +0200618 Mgmt cluster release upgrade scheduled: ${upgradeMgmt}
slalov1202bba2022-04-20 22:31:07 +0400619 Mgmt cluster release auto upgrade scheduled: ${autoUpgradeMgmt}
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400620 Mgmt LMA logging enabled: ${enableLMALogging}
Sergey Lalovb2f60372022-09-20 23:58:47 +0400621 Deploy Os on child with mos release ${deployOsOnMos}
vnaumov33747e12020-05-04 17:35:20 +0200622 Mgmt conformance testing scheduled: ${runMgmtConformance}
Sergey Lalovafcc0432023-04-13 14:59:06 +0400623 Mgmt conformance network policy testing scheduled: ${runMgmtConformanceNetworkPolicy}
Владислав Наумов9cec55d2021-08-03 15:00:59 +0200624 LMA testing scheduled: ${runLMATest}
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +0200625 Mgmt user controller testing scheduled: ${runMgmtUserControllerTest}
vnaumov33747e12020-05-04 17:35:20 +0200626 Mgmt UI e2e testing scheduled: ${runUie2e}
Mikhail Ivanovf5e20af2022-03-24 15:38:06 +0400627 Mgmt UI e2e playwrite testing scheduled: ${runUie2eNew}
slalov13e579c2022-01-31 21:37:02 +0400628 Maintenance test: ${runMaintenanceTest}
slalov0a4947a2022-06-09 15:44:35 +0400629 Container Registry test: ${runContainerregistryTest}
slalov574123e2022-04-06 17:24:19 +0400630 Child proxy test: ${runProxyChildTest}
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +0300631 Graceful reboot test: ${runGracefulRebootTest}
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300632 Delete mgmt master node test: ${runMgmtDeleteMasterTest}
633 Delete rgnl master node test: ${runRgnlDeleteMasterTest}
634 Delete child master node test: ${runChildDeleteMasterTest}
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300635 Child machine deletion policy test: ${runChildMachineDeletionPolicyTest}
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400636 Custom cert test for child clusters: ${runChildCustomCertTest}
Sergey Lalov430fcd72023-03-20 17:19:44 +0400637 Custom cert test for Byo child clusters: ${runByoChildCustomCertTest}
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400638 Custom cache cert test for mgmt and child clusters: ${runMgmtCustomCacheCertTest}
Sergey Lalov48e69022023-07-25 16:08:00 +0400639 MKE custom cert test for mgmt/region: ${runMkeCustomCertTest}
Sergey Lalov62c28312023-10-18 19:23:59 +0400640 Custom hostnames for all clisuers: ${runCustomHostnames}
vryzhenkin504dfc92023-11-01 15:49:47 +0400641 Stacklight templates enchanced with latest version from artifact-metadata: ${slLatest}
Sergey Lalovd7593ab2024-01-11 13:40:13 +0400642 Disable Kubernetes API audit: ${disableKubeApiAudit}
Sergey Lalov26e24c22024-03-20 13:47:31 +0400643 Enable Auditd : ${auditd}
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200644 AWS provider deployment scheduled: ${awsOnDemandDemo}
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000645 Equinix provider deployment scheduled: ${equinixOnDemandDemo}
Владислав Наумов144956f2021-10-14 17:49:19 +0200646 EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo}
Vladislav Naumov42b71dc2021-11-22 13:09:42 +0100647 EquinixmetalV2 child deploy in a separate metro scheduled: ${equinixMetalV2ChildDiffMetro}
Sergey Zhemerdeev019c45a2022-08-13 00:09:07 +0300648 EquinixmetalV2 mgmt will be deployed on the metro: ${equinixMetalV2Metro?:'auto'}
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000649 Equinix@AWS child cluster deployment scheduled: ${equinixOnAwsDemo}
650 Azure provider deployment scheduled: ${azureOnDemandDemo}
651 Azure@AWS child cluster deployment scheduled: ${azureOnAwsDemo}
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400652 VSPHERE provider deployment scheduled: ${enableVsphereDemo}
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200653 OS provider deployment scheduled: ${enableOSDemo}
Sergey Lalovd0e20852023-08-17 19:11:19 +0400654 BM Core provider deployment scheduled: ${enablebmCoreDemo}
655 BM Core type deplyment: ${bmDeployType}
656 BM Core cleanup: ${bmCoreCleanup}
azvyagintsev1761bdc2020-09-04 17:24:12 +0300657 BM provider deployment scheduled: ${enableBMDemo}
Alexandr Lovtsov36473f32022-04-28 15:46:09 +0300658 Ubuntu on vSphere scheduled: ${enableVsphereUbuntu}
Ivan Berezovskiy30c4b122023-11-06 18:03:18 +0500659 RHEL on vSphere scheduled: ${enableVsphereRHEL}
Mikhail Ivanovbd1a9fd2022-03-29 21:36:21 +0400660 Artifacts build scheduled: ${enableArtifactsBuild}
Sergey Zhemerdeeve67fb262022-06-21 00:49:34 +0300661 Boot OS child from Ceph volumes: ${childOsBootFromVolume}
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000662 Multiregional configuration: ${multiregionalMappings}
vnaumov33747e12020-05-04 17:35:20 +0200663 Service binaries fetching scheduled: ${fetchServiceBinaries}
Владислав Наумов74e2d6e2020-12-30 17:05:40 +0100664 Current weight of the demo run: ${demoWeight} (Used to manage lockable resources)
Ivan Berezovskiy29e72b72022-07-12 21:03:24 +0400665 Bootstrap v2 scenario enabled: ${bootstrapV2Scenario}
Mikhail Ivanov3088d3d2022-10-24 14:05:46 +0400666 FIPS enabled: ${enableFips}
Sergey Lalov00bea0f2023-08-14 16:46:33 +0400667 MKE DEBUG enabled: ${enableMkeDebug}
Sergey Lalovbc68d752022-11-08 13:40:53 +0400668 Pause for debug enabled: ${pauseForDebug}
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300669 AIO cluster: ${aioCluster}
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100670 Use Vsphere VVMT Objects: ${useVsphereVvmtObjects}
vryzhenkin4fd3f242023-03-29 15:13:46 +0400671 Bootsrap v2 smoke checks enabled: ${enableBv2Smoke}
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400672 Run Cache warmup for child clusters: ${runCacheWarmup}
vryzhenkin211a4e82023-11-23 12:48:27 +0400673 CVE Scan enabled: ${cveScan}
vryzhenkina8d74e72024-02-26 14:59:37 +0400674 Keycloak+LDAP integration enabled: ${coreKeycloakLdap}
Viktor Astakhovadfcfb52024-05-16 16:56:21 +0400675 NTP update job scheduled: ${runNTPUpdateTest}
Viktor Astakhov8da448c2024-06-14 14:59:32 +0400676 MCC MariaDB Backup/Restore test enabled: ${runMCCMariaBackupRestoreTest}
Владислав Наумов81777472021-03-09 15:14:27 +0400677 Triggers: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
vnaumov33747e12020-05-04 17:35:20 +0200678 return [
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300679 osCloudLocation : openstackIMC,
680 cdnConfig : cdnConfig,
681 proxyConfig : proxyConfig,
682 useMacOsSeedNode : seedMacOs,
683 deployChildEnabled : deployChild,
684 childDeployCustomRelease : customChildRelease,
685 upgradeChildEnabled : upgradeChild,
686 fullUpgradeChildEnabled : fullUpgradeChild,
687 mosDeployChildEnabled : mosDeployChild,
688 mosUpgradeChildEnabled : mosUpgradeChild,
689 runChildConformanceEnabled : runChildConformance,
Sergey Lalovafcc0432023-04-13 14:59:06 +0400690 runChildConformanceNetworkPolicyEnabled : runChildConformanceNetworkPolicy,
vryzhenkinb286bd82023-04-04 07:17:52 +0400691 runChildHPAEnabled : runChildHPA,
Sergey Lalov012496a2023-11-27 15:57:52 +0400692 runChildStacklightHaEnabled : runChildStacklightHa,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300693 attachBYOEnabled : attachBYO,
694 upgradeBYOEnabled : upgradeBYO,
695 runBYOMatrixEnabled : runBYOMatrix,
696 defaultBYOOs : defaultBYOOs,
697 upgradeMgmtEnabled : upgradeMgmt,
698 autoUpgradeMgmtEnabled : autoUpgradeMgmt,
699 enableLMALoggingEnabled : enableLMALogging,
700 deployOsOnMosEnabled : deployOsOnMos,
701 runUie2eEnabled : runUie2e,
702 runUie2eNewEnabled : runUie2eNew,
703 runMgmtConformanceEnabled : runMgmtConformance,
Sergey Lalovafcc0432023-04-13 14:59:06 +0400704 runMgmtConformanceNetworkPolicyEnabled : runMgmtConformanceNetworkPolicy,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300705 runMaintenanceTestEnabled : runMaintenanceTest,
706 runContainerregistryTestEnabled : runContainerregistryTest,
707 runGracefulRebootTestEnabled : runGracefulRebootTest,
708 pauseForDebugEnabled : pauseForDebug,
709 runMgmtDeleteMasterTestEnabled : runMgmtDeleteMasterTest,
710 runRgnlDeleteMasterTestEnabled : runRgnlDeleteMasterTest,
711 runChildDeleteMasterTestEnabled : runChildDeleteMasterTest,
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400712 runChildCustomCertTestEnabled : runChildCustomCertTest,
Sergey Lalov7c2377e2023-12-15 23:14:45 +0400713 customSlackChannelEnabled : customSlackChannel,
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400714 runMgmtCustomCacheCertTestEnabled : runMgmtCustomCacheCertTest,
Sergey Lalov48e69022023-07-25 16:08:00 +0400715 runMkeCustomCertTestEnabled : runMkeCustomCertTest,
Sergey Lalov62c28312023-10-18 19:23:59 +0400716 runCustomHostnamesEnabled : runCustomHostnames,
vryzhenkin504dfc92023-11-01 15:49:47 +0400717 slLatestEnabled : slLatest,
Sergey Lalov430fcd72023-03-20 17:19:44 +0400718 runByoChildCustomCertTestEnabled : runByoChildCustomCertTest,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300719 runChildMachineDeletionPolicyTestEnabled : runChildMachineDeletionPolicyTest,
720 runLMATestEnabled : runLMATest,
721 runMgmtUserControllerTestEnabled : runMgmtUserControllerTest,
722 runProxyChildTestEnabled : runProxyChildTest,
723 fetchServiceBinariesEnabled : fetchServiceBinaries,
724 awsOnDemandDemoEnabled : awsOnDemandDemo,
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000725 equinixOnDemandDemoEnabled : equinixOnDemandDemo,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300726 equinixMetalV2OnDemandDemoEnabled : equinixMetalV2OnDemandDemo,
727 equinixMetalV2ChildDiffMetroEnabled : equinixMetalV2ChildDiffMetro,
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000728 equinixOnAwsDemoEnabled : equinixOnAwsDemo,
729 azureOnDemandDemoEnabled : azureOnDemandDemo,
730 azureOnAwsDemoEnabled : azureOnAwsDemo,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300731 vsphereDemoEnabled : enableVsphereDemo,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300732 bmDemoEnabled : enableBMDemo,
Sergey Lalovd0e20852023-08-17 19:11:19 +0400733 bmCoreDemoEnabled : enablebmCoreDemo,
734 bmCoreCleanup : bmCoreCleanup,
Sergey Lalov4ea2cbc2024-04-04 21:41:47 +0400735 bmDeployType : bmDeployType,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300736 osDemoEnabled : enableOSDemo,
737 vsphereUbuntuEnabled : enableVsphereUbuntu,
Ivan Berezovskiy30c4b122023-11-06 18:03:18 +0500738 vsphereRHELEnabled : enableVsphereRHEL,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300739 artifactsBuildEnabled : enableArtifactsBuild,
740 childOsBootFromVolume : childOsBootFromVolume,
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000741 multiregionalConfiguration : multiregionalMappings,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300742 demoWeight : demoWeight,
743 bootstrapV2Scenario : bootstrapV2Scenario,
744 equinixMetalV2Metro : equinixMetalV2Metro,
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300745 enableFips : enableFips,
Sergey Lalov00bea0f2023-08-14 16:46:33 +0400746 enableMkeDebugEnabled : enableMkeDebug,
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100747 aioCluster : aioCluster,
vryzhenkin4fd3f242023-03-29 15:13:46 +0400748 useVsphereVvmtObjects : useVsphereVvmtObjects,
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400749 bv2SmokeEnabled : enableBv2Smoke,
750 runCacheWarmup : runCacheWarmup,
vryzhenkin211a4e82023-11-23 12:48:27 +0400751 cveScanEnabled : cveScan,
Sergey Lalovd7593ab2024-01-11 13:40:13 +0400752 disableKubeApiAudit : disableKubeApiAudit,
Sergey Lalov26e24c22024-03-20 13:47:31 +0400753 auditdEnabled : auditd,
vryzhenkina8d74e72024-02-26 14:59:37 +0400754 coreKeycloakLdapEnabled : coreKeycloakLdap,
vryzhenkine0ff1d82024-03-18 15:08:09 +0400755 internalNTPServersEnabled : configureInternalNTP,
Viktor Astakhovadfcfb52024-05-16 16:56:21 +0400756 runNTPUpdateTestEnabled : runNTPUpdateTest,
Viktor Astakhov8da448c2024-06-14 14:59:32 +0400757 runMCCMariaBackupRestoreTestEnabled : runMCCMariaBackupRestoreTest,
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400758 ]
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200759}
760
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000761/**
762 * Determine management and regional setup for demo workflow scenario
763 *
764 *
765 * @param: keyword (string) string , represents keyword trigger, specified in gerrit commit body, like `[multiregion aws,os]`
766 or Jenkins environment string variable in form like 'aws,os'
767 * @return (map)[
768 enabled: (bool),
769 * managementLocation: (string), //aws,os
770 * regionLocation: (string), //aws,os
771 * ]
772 */
773def multiregionWorkflowParser(keyword) {
774 def common = new com.mirantis.mk.Common()
775 def supportedManagementProviders = ['os', 'aws', 'vsphere', 'equinix', 'equinixmetalv2', 'azure']
776 def supportedRegionalProviders = ['os', 'vsphere', 'equinix', 'equinixmetalv2', 'bm', 'azure', 'aws']
777
778 def clusterTypes = ''
779 if (keyword.toString().contains('multiregion')) {
780 common.infoMsg('Multiregion definition configured via gerrit keyword trigger')
781 clusterTypes = keyword[0][0].split('multiregion')[1].replaceAll('[\\[\\]]', '').trim().split(',')
782 } else {
783 common.infoMsg('Multiregion definition configured via environment variable')
784 clusterTypes = keyword.trim().split(',')
785 }
786
787 if (clusterTypes.size() != 2) {
788 error("Incorrect regions definiton, valid scheme: [multiregion ${management}, ${region}], got: ${clusterTypes}")
789 }
790
791 def desiredManagementProvider = clusterTypes[0].trim()
792 def desiredRegionalProvider = clusterTypes[1].trim()
793 if (! supportedManagementProviders.contains(desiredManagementProvider) || ! supportedRegionalProviders.contains(desiredRegionalProvider)) {
794 error("""unsupported management <-> regional bundle, available options:
795 management providers list - ${supportedManagementProviders}
796 regional providers list - ${supportedRegionalProviders}""")
797 }
798
799 return [
800 enabled: true,
801 managementLocation: desiredManagementProvider,
802 regionLocation: desiredRegionalProvider,
803 ]
804}
vnaumov33747e12020-05-04 17:35:20 +0200805
806/**
807 * Determine if custom si tests/pipelines refspec forwarded from gerrit change request
808
Владислав Наумов81777472021-03-09 15:14:27 +0400809 * 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 +0200810 * Used for components team to test component changes w/ custom SI refspecs using kaas/core deployment jobs
811 * Example scheme:
812 * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core
813 * manage refspecs through Jenkins Job Parameters
814 *
azvyagintseva12230a2020-06-05 13:24:06 +0300815 * @return (map)[* siTests: (string) final refspec for si-tests
vnaumov33747e12020-05-04 17:35:20 +0200816 * siPipelines: (string) final refspec for si-pipelines
817 * ]
818 */
819def checkCustomSIRefspec() {
vnaumovbdb90222020-05-04 18:25:50 +0200820 def common = new com.mirantis.mk.Common()
821
vnaumov33747e12020-05-04 17:35:20 +0200822 // Available triggers and its sane defaults
Владислав Наумов6c2afff2020-06-05 12:54:53 +0200823 def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master'
824 def siPipelinesRefspec = env.SI_PIPELINES_REFSPEC ?: 'master'
Владислав Наумов2db15e22020-07-14 12:29:22 +0200825 def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test'
826 def siTestsDockerImageTag = env.SI_TESTS_DOCKER_IMAGE_TAG ?: 'master'
Владислав Наумов6c2afff2020-06-05 12:54:53 +0200827 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
vnaumov33747e12020-05-04 17:35:20 +0200828
829 def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/)
830 def siPipelinesMatches = (commitMsg =~ /(\[si-pipelines-ref\s*refs\/changes\/.*?\])/)
831
832 if (siTestMatches.size() > 0) {
833 siTestsRefspec = siTestMatches[0][0].split('si-tests-ref')[1].replaceAll('[\\[\\]]', '').trim()
Владислав Наумов7f6c0882021-03-23 19:10:57 +0400834 siTestsDockerImage = "docker-review-local.docker.mirantis.net/review/kaas-si-test-${siTestsRefspec.split('/')[-2]}"
Владислав Наумов2db15e22020-07-14 12:29:22 +0200835 siTestsDockerImageTag = siTestsRefspec.split('/')[-1]
vnaumov33747e12020-05-04 17:35:20 +0200836 }
837 if (siPipelinesMatches.size() > 0) {
838 siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim()
839 }
840
841 common.infoMsg("""
842 kaas/si-pipelines will be fetched from: ${siPipelinesRefspec}
843 kaas/si-tests will be fetched from: ${siTestsRefspec}
Владислав Наумов2db15e22020-07-14 12:29:22 +0200844 kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}:${siTestsDockerImageTag}
Владислав Наумов81777472021-03-09 15:14:27 +0400845 Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
Владислав Наумов2db15e22020-07-14 12:29:22 +0200846 return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage, siTestsDockerImageTag: siTestsDockerImageTag]
vnaumov33747e12020-05-04 17:35:20 +0200847}
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200848
Владислав Наумов9080f372020-06-08 13:57:16 +0200849/**
Владислав Наумов418042b2020-07-09 18:31:10 +0200850 * Parse additional configuration for kaas component CICD repo
Владислав Наумов30a516c2020-07-09 13:15:41 +0200851 * @param configurationFile (str) path to configuration file in yaml format
852 *
853 * @return (map)[ siTestsFeatureFlags (string) dedicated feature flags that will be used in SI tests,
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300854 * siTestsFeatureFlagsStable (string) dedicated feature flags that will be used in SI tests for deploying stable release
Владислав Наумов30a516c2020-07-09 13:15:41 +0200855 * ]
856 */
857def parseKaaSComponentCIParameters(configurationFile){
858 def common = new com.mirantis.mk.Common()
859 def ciConfig = readYaml file: configurationFile
860 def ciSpec = [
861 siTestsFeatureFlags: env.SI_TESTS_FEATURE_FLAGS ?: '',
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300862 siTestsFeatureFlagsStable: env.SI_TESTS_FEATURE_FLAGS_STABLE ?: '',
Владислав Наумов30a516c2020-07-09 13:15:41 +0200863 ]
864
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300865 // If exists and not empty
866 if (ciConfig.getOrDefault('si-tests-feature-flags', [])) {
Владислав Наумов30a516c2020-07-09 13:15:41 +0200867 common.infoMsg("""SI tests feature flags customization detected,
868 results will be merged with existing flags: [${ciSpec['siTestsFeatureFlags']}] identification...""")
869
870 def ffMeta = ciSpec['siTestsFeatureFlags'].tokenize(',').collect { it.trim() }
871 ffMeta.addAll(ciConfig['si-tests-feature-flags'])
Владислав Наумов30a516c2020-07-09 13:15:41 +0200872
Владислав Наумовcb5ffca2020-07-14 15:28:36 +0200873 ciSpec['siTestsFeatureFlags'] = ffMeta.unique().join(',')
Владислав Наумов30a516c2020-07-09 13:15:41 +0200874 common.infoMsg("SI tests custom feature flags: ${ciSpec['siTestsFeatureFlags']}")
875 }
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300876 if (ciConfig.getOrDefault('si-tests-feature-flags-stable', [])) {
877 common.infoMsg("""SI tests feature flags for stable release customization detected,
878 results will be merged with existing flags: [${ciSpec['siTestsFeatureFlagsStable']}] identification...""")
879
880 def ffMeta = ciSpec['siTestsFeatureFlagsStable'].tokenize(',').collect { it.trim() }
881 ffMeta.addAll(ciConfig['si-tests-feature-flags-stable'])
882
883 ciSpec['siTestsFeatureFlagsStable'] = ffMeta.unique().join(',')
884 common.infoMsg("SI tests custom feature flags for stable release: ${ciSpec['siTestsFeatureFlagsStable']}")
885 }
Владислав Наумов30a516c2020-07-09 13:15:41 +0200886
887 common.infoMsg("""Additional ci configuration parsed successfully:
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300888 siTestsFeatureFlags: ${ciSpec['siTestsFeatureFlags']}
889 siTestsFeatureFlagsStable: ${ciSpec['siTestsFeatureFlagsStable']}""")
Владислав Наумов30a516c2020-07-09 13:15:41 +0200890 return ciSpec
891}
892
893/**
894 * Determine if custom kaas core/pipelines refspec forwarded from gerrit change request
Владислав Наумов9080f372020-06-08 13:57:16 +0200895
Владислав Наумов81777472021-03-09 15:14:27 +0400896 * 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 +0200897 * Used for components team to test component changes w/ custom Core refspecs using kaas/core deployment jobs
898 * Example scheme:
899 * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core
900 * manage refspecs through Jenkins Job Parameters
901 *
902 * @return (map)[ core: (string) final refspec for kaas/core
903 * corePipelines: (string) final refspec for pipelines in kaas/core
904 * ]
905 */
906def checkCustomCoreRefspec() {
907 def common = new com.mirantis.mk.Common()
908
909 // Available triggers and its sane defaults
910 def coreRefspec = env.KAAS_CORE_REFSPEC ?: 'master'
911 // by default using value of GERRIT_REFSPEC parameter in *kaas/core jobs*
912 def corePipelinesRefspec = env.KAAS_PIPELINE_REFSPEC ?: '\$GERRIT_REFSPEC'
913 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
914
915 def coreMatches = (commitMsg =~ /(\[core-ref\s*refs\/changes\/.*?\])/)
916 def corePipelinesMatches = (commitMsg =~ /(\[core-pipelines-ref\s*refs\/changes\/.*?\])/)
917
918 if (coreMatches.size() > 0) {
919 coreRefspec = coreMatches[0][0].split('core-ref')[1].replaceAll('[\\[\\]]', '').trim()
920 }
921 if (corePipelinesMatches.size() > 0) {
922 corePipelinesRefspec = corePipelinesMatches[0][0].split('core-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim()
923 }
924
925 common.infoMsg("""
926 kaas/core will be fetched from: ${coreRefspec}
927 kaas/core pipelines will be fetched from: ${corePipelinesRefspec}
Владислав Наумов81777472021-03-09 15:14:27 +0400928 Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
Владислав Наумов9080f372020-06-08 13:57:16 +0200929 return [core: coreRefspec, corePipelines: corePipelinesRefspec]
930}
931
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200932
933/**
Владислав Наумов92288d92020-07-13 18:36:21 +0200934 * generate Jenkins Parameter objects from from text parameter with additonal kaas core context
935 * needed to forward inside kaas core set of jobs
936 *
937 * @param context (string) Representation of the string enviroment variables needed for kaas core jobs in yaml format
938 * @return (list)[ string(name: '', value: ''),
939 * ]
940 */
941def generateKaaSVarsFromContext(context) {
942 def common = new com.mirantis.mk.Common()
943 def parameters = []
944 def config = readYaml text: context
945
946 config.each { k,v ->
947 common.infoMsg("Custom KaaS Core context parameter: ${k}=${v}")
948 parameters.add(string(name: k, value: v))
949 }
950
951 return parameters
952}
953
954/**
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200955 * 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 +0400956 * 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 +0200957 * Used for components team to test component changes w/ customized SI tests/refspecs using kaas/core deployment jobs
958 *
Владислав Наумов418042b2020-07-09 18:31:10 +0200959 * @param: component (string) component name [iam, lcm, stacklight]
960 * @param: patchSpec (string) Patch for kaas/cluster releases in json format
961 * @param: configurationFile (string) Additional file for component repo CI config in yaml format
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200962 */
Владислав Наумов92288d92020-07-13 18:36:21 +0200963def triggerPatchedComponentDemo(component, patchSpec = '', configurationFile = '.ci-parameters.yaml', coreContext = '') {
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200964 def common = new com.mirantis.mk.Common()
965 // Determine if custom trigger keywords forwarded from gerrit
966 def triggers = checkDeploymentTestSuite()
967 // Determine SI refspecs
968 def siRefspec = checkCustomSIRefspec()
Владислав Наумов9080f372020-06-08 13:57:16 +0200969 // Determine Core refspecs
970 def coreRefspec = checkCustomCoreRefspec()
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200971
Владислав Наумов418042b2020-07-09 18:31:10 +0200972 // Determine component repo ci configuration
973 def ciSpec = [:]
974 def componentFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: ''
975 if (fileExists(configurationFile)) {
976 common.infoMsg('Component CI configuration file detected, parsing...')
977 ciSpec = parseKaaSComponentCIParameters(configurationFile)
978 componentFeatureFlags = ciSpec['siTestsFeatureFlags']
979 } else {
980 common.warningMsg('''Component CI configuration file is not exists,
Владислав Наумовc17dd552020-07-29 17:07:38 +0200981 several code-management features may be unavailable,
Владислав Наумов92288d92020-07-13 18:36:21 +0200982 follow https://mirantis.jira.com/wiki/spaces/QA/pages/2310832276/SI-tests+feature+flags#%5BUpdated%5D-Using-a-feature-flag
983 to create the configuration file''')
Владислав Наумов418042b2020-07-09 18:31:10 +0200984 }
Ivan Berezovskiy91ede502021-05-13 21:05:36 +0400985
986 def platforms = []
987 if (component == 'ipam' && triggers.vsphereDemoEnabled) {
988 // Currently only vsphere demo is required for IPAM component
989 platforms.add('vsphere')
990 } else {
991 if (triggers.osDemoEnabled) {
992 platforms.add('openstack')
993 }
994 if (triggers.awsOnDemandDemoEnabled) {
995 platforms.add('aws')
996 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000997 if (triggers.equinixOnDemandDemoEnabled) {
998 platforms.add('equinix')
999 }
Владислав Наумов144956f2021-10-14 17:49:19 +02001000 if (triggers.equinixMetalV2OnDemandDemoEnabled) {
1001 platforms.add('equinixmetalv2')
1002 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001003 if (triggers.azureOnDemandDemoEnabled) {
1004 platforms.add('azure')
1005 }
Ivan Berezovskiyb0229d02021-05-17 16:55:18 +04001006 if (triggers.vsphereDemoEnabled) {
1007 platforms.add('vsphere')
1008 }
Sergey Kolekonov8e4de182024-03-05 15:07:07 +05001009 if (triggers.bmCoreDemoEnabled) {
1010 platforms.add('bm')
1011 }
Ivan Berezovskiy91ede502021-05-13 21:05:36 +04001012 }
1013
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001014 def jobs = [:]
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001015 def parameters = [
Владислав Наумов9080f372020-06-08 13:57:16 +02001016 string(name: 'GERRIT_REFSPEC', value: coreRefspec.core),
1017 string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines),
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001018 string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests),
Владислав Наумов418042b2020-07-09 18:31:10 +02001019 string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags),
Владислав Наумов2db15e22020-07-14 12:29:22 +02001020 string(name: 'SI_TESTS_DOCKER_IMAGE', value: siRefspec.siTestsDockerImage),
1021 string(name: 'SI_TESTS_DOCKER_IMAGE_TAG', value: siRefspec.siTestsDockerImageTag),
Владислав Наумов4a5c3242020-06-08 14:36:11 +02001022 string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines),
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001023 string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec),
Mikhail Ivanov74504372021-05-21 17:01:06 +04001024 string(name: 'KAAS_CHILD_CLUSTER_RELEASE_NAME', value: triggers.childDeployCustomRelease),
Mikhail Ivanovb6283f72021-11-24 18:34:57 +04001025 string(name: 'OPENSTACK_CLOUD_LOCATION', value: triggers.osCloudLocation),
Sergey Lalov7c2377e2023-12-15 23:14:45 +04001026 string(name: 'SLACK_CHANNEL_NOTIFY', value: triggers.customSlackChannelEnabled),
Sergey Lalov4ea2cbc2024-04-04 21:41:47 +04001027 string(name: 'BM_DEPLOY_TYPE', value: triggers.bmDeployType),
Владислав Наумовb8305e22021-02-10 17:23:12 +01001028 booleanParam(name: 'OFFLINE_MGMT_CLUSTER', value: triggers.proxyConfig['mgmtOffline']),
Владислав Наумовf8f23fa2021-04-01 16:57:52 +02001029 booleanParam(name: 'OFFLINE_CHILD_CLUSTER', value: triggers.proxyConfig['childOffline']),
Владислав Наумов257ea132021-04-14 14:44:13 +02001030 booleanParam(name: 'PROXY_CHILD_CLUSTER', value: triggers.proxyConfig['childProxy']),
Владислав Наумов44c64b72020-12-04 20:22:53 +01001031 booleanParam(name: 'SEED_MACOS', value: triggers.useMacOsSeedNode),
Владислав Наумов080d9412020-07-29 13:05:14 +02001032 booleanParam(name: 'UPGRADE_MGMT_CLUSTER', value: triggers.upgradeMgmtEnabled),
slalov1202bba2022-04-20 22:31:07 +04001033 booleanParam(name: 'AUTO_UPGRADE_MCC', value: triggers.autoUpgradeMgmtEnabled),
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +04001034 booleanParam(name: 'ENABLE_LMA_LOGGING', value: triggers.enableLMALoggingEnabled),
Sergey Lalovb2f60372022-09-20 23:58:47 +04001035 booleanParam(name: 'DEPLOY_OS_ON_MOS', value: triggers.deployOsOnMosEnabled),
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001036 booleanParam(name: 'RUN_UI_E2E', value: triggers.runUie2eEnabled),
Владислав Наумов080d9412020-07-29 13:05:14 +02001037 booleanParam(name: 'RUN_MGMT_CFM', value: triggers.runMgmtConformanceEnabled),
Sergey Lalovafcc0432023-04-13 14:59:06 +04001038 booleanParam(name: 'RUN_MGMT_CFM_NETWORK_POLICY', value: triggers.runMgmtConformanceNetworkPolicyEnabled),
slalov0a4947a2022-06-09 15:44:35 +04001039 booleanParam(name: 'RUN_MAINTENANCE_TEST', value: triggers.runMaintenanceTestEnabled),
1040 booleanParam(name: 'RUN_CONTAINER_REGISTRY_TEST', value: triggers.runContainerregistryTestEnabled),
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +03001041 booleanParam(name: 'RUN_GRACEFUL_REBOOT_TEST', value: triggers.runGracefulRebootTestEnabled),
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +03001042 booleanParam(name: 'RUN_MGMT_DELETE_MASTER_TEST', value: triggers.runMgmtDeleteMasterTestEnabled),
1043 booleanParam(name: 'RUN_RGNL_DELETE_MASTER_TEST', value: triggers.runRgnlDeleteMasterTestEnabled),
1044 booleanParam(name: 'RUN_CHILD_DELETE_MASTER_TEST', value: triggers.runChildDeleteMasterTestEnabled),
Sergey Lalovd5efcd52023-03-01 22:42:17 +04001045 booleanParam(name: 'RUN_CHILD_CUSTOM_CERT_TEST', value: triggers.runChildCustomCertTestEnabled),
Sergey Lalovf6fbfea2023-04-06 17:05:40 +04001046 booleanParam(name: 'RUN_MGMT_CUSTOM_CACHE_CERT_TEST', value: triggers.runMgmtCustomCacheCertTestEnabled),
Sergey Lalov48e69022023-07-25 16:08:00 +04001047 booleanParam(name: 'RUN_MKE_CUSTOM_CERT_TEST', value: triggers.runMkeCustomCertTestEnabled),
Sergey Lalov62c28312023-10-18 19:23:59 +04001048 booleanParam(name: 'RUN_CUSTOM_HOSTNAMES', value: triggers.runCustomHostnamesEnabled),
vryzhenkin504dfc92023-11-01 15:49:47 +04001049 booleanParam(name: 'SL_LATEST', value: triggers.slLatestEnabled),
Sergey Lalov430fcd72023-03-20 17:19:44 +04001050 booleanParam(name: 'RUN_BYO_CHILD_CUSTOM_CERT_TEST', value: triggers.runByoChildCustomCertTestEnabled),
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +03001051 booleanParam(name: 'RUN_CHILD_MACHINE_DELETION_POLICY_TEST', value: triggers.runChildMachineDeletionPolicyTestEnabled),
Владислав Наумов9cec55d2021-08-03 15:00:59 +02001052 booleanParam(name: 'RUN_LMA_TEST', value: triggers.runLMATestEnabled),
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +02001053 booleanParam(name: 'RUN_MGMT_USER_CONTROLLER_TEST', value: triggers.runMgmtUserControllerTestEnabled),
Владислав Наумов080d9412020-07-29 13:05:14 +02001054 booleanParam(name: 'DEPLOY_CHILD_CLUSTER', value: triggers.deployChildEnabled),
1055 booleanParam(name: 'UPGRADE_CHILD_CLUSTER', value: triggers.upgradeChildEnabled),
Sergey Lalovc1cb49f2022-09-27 01:16:25 +04001056 booleanParam(name: 'FULL_UPGRADE_CHILD_CLUSTER', value: triggers.fullUpgradeChildEnabled),
slalov574123e2022-04-06 17:24:19 +04001057 booleanParam(name: 'RUN_PROXY_CHILD_TEST', value: triggers.runProxyChildTestEnabled),
Владислав Наумов0dc99252020-11-13 13:30:48 +01001058 booleanParam(name: 'ATTACH_BYO', value: triggers.attachBYOEnabled),
Владислав Наумовcdbd84e2020-12-01 16:51:09 +01001059 booleanParam(name: 'UPGRADE_BYO', value: triggers.upgradeBYOEnabled),
Vladislav Naumov7930ab22021-11-22 18:24:24 +01001060 booleanParam(name: 'RUN_BYO_MATRIX', value: triggers.runBYOMatrixEnabled),
Владислав Наумов080d9412020-07-29 13:05:14 +02001061 booleanParam(name: 'RUN_CHILD_CFM', value: triggers.runChildConformanceEnabled),
Sergey Lalovafcc0432023-04-13 14:59:06 +04001062 booleanParam(name: 'RUN_CHILD_CFM_NETPOLICY', value: triggers.runChildConformanceNetworkPolicyEnabled),
vryzhenkinb286bd82023-04-04 07:17:52 +04001063 booleanParam(name: 'RUN_CHILD_HPA', value: triggers.runChildHPAEnabled),
Sergey Lalov012496a2023-11-27 15:57:52 +04001064 booleanParam(name: 'RUN_STACKLIGHT_CHILD_HA', value: triggers.runChildStacklightHaEnabled),
Ivan Berezovskiycbf9eeb2021-03-22 15:57:32 +04001065 booleanParam(name: 'ALLOW_AWS_ON_DEMAND', value: triggers.awsOnDemandDemoEnabled),
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001066 booleanParam(name: 'ALLOW_EQUINIX_ON_DEMAND', value: triggers.equinixOnDemandDemoEnabled),
Владислав Наумов82305e92021-10-14 20:45:20 +02001067 booleanParam(name: 'ALLOW_EQUINIXMETALV2_ON_DEMAND', value: triggers.equinixMetalV2OnDemandDemoEnabled),
Vladislav Naumov42b71dc2021-11-22 13:09:42 +01001068 booleanParam(name: 'EQUINIXMETALV2_CHILD_DIFF_METRO', value: triggers.equinixMetalV2ChildDiffMetroEnabled),
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001069 booleanParam(name: 'EQUINIX_ON_AWS_DEMO', value: triggers.equinixOnAwsDemoEnabled),
1070 booleanParam(name: 'ALLOW_AZURE_ON_DEMAND', value: triggers.azureOnDemandDemoEnabled),
1071 booleanParam(name: 'AZURE_ON_AWS_DEMO', value: triggers.azureOnAwsDemoEnabled),
Sergey Lalovc63259f2024-01-28 16:52:30 +04001072 booleanParam(name: 'ALLOW_BM_CORE_ON_DEMAND', value: triggers.bmCoreDemoEnabled),
Sergey Zhemerdeev9074f6e2022-06-07 12:03:16 +03001073 booleanParam(name: 'VSPHERE_DEPLOY_UBUNTU', value: triggers.vsphereUbuntuEnabled),
Sergey Lalovbc68d752022-11-08 13:40:53 +04001074 booleanParam(name: 'PAUSE_FOR_DEBUG', value: triggers.pauseForDebugEnabled),
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +03001075 booleanParam(name: 'ENABLE_FIPS', value: triggers.enableFips),
Sergey Lalov00bea0f2023-08-14 16:46:33 +04001076 booleanParam(name: 'ENABLE_MKE_DUBUG', value: triggers.enableMkeDebugEnabled),
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +03001077 booleanParam(name: 'AIO_CLUSTER', value: triggers.aioCluster),
Sergey Lalovd0e20852023-08-17 19:11:19 +04001078 booleanParam(name: 'BM_CORE_CLEANUP', value: triggers.bmCoreCleanup),
Sergey Lalovd7593ab2024-01-11 13:40:13 +04001079 booleanParam(name: 'DISABLE_KUBE_API_AUDIT', value: triggers.disableKubeApiAudit),
Sergey Lalovf44cbb72024-03-27 15:19:24 +04001080 booleanParam(name: "AUDITD_ENABLE", value: triggers.auditdEnabled),
vryzhenkine0ff1d82024-03-18 15:08:09 +04001081 booleanParam(name: 'CORE_KEYCLOAK_LDAP_ENABLED', value: triggers.coreKeycloakLdapEnabled),
Viktor Astakhovadfcfb52024-05-16 16:56:21 +04001082 booleanParam(name: 'CORE_KAAS_NTP_ENABLED', value: triggers.internalNTPServersEnabled),
Viktor Astakhov8da448c2024-06-14 14:59:32 +04001083 booleanParam(name: 'RUN_NTP_UPDATE_TEST', value: triggers.runNTPUpdateTestEnabled),
1084 booleanParam(name: 'RUN_MCC_MARIA_BACKUP_RESTORE_TEST', value: triggers.runMCCMariaBackupRestoreTestEnabled)
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001085 ]
Владислав Наумов92288d92020-07-13 18:36:21 +02001086
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001087 // customize multiregional demo
1088 if (triggers.multiregionalConfiguration.enabled) {
1089 parameters.add(string(name: 'MULTIREGION_SETUP',
1090 value: "${triggers.multiregionalConfiguration.managementLocation},${triggers.multiregionalConfiguration.regionLocation}"
1091 ))
1092 }
1093
Владислав Наумов92288d92020-07-13 18:36:21 +02001094 // Determine component team custom context
1095 if (coreContext != '') {
1096 common.infoMsg('Additional KaaS Core context detected, will be forwarded into kaas core cicd...')
1097 def additionalParameters = generateKaaSVarsFromContext(coreContext)
Владислав Наумовbef51a92020-10-01 17:36:51 +02001098 parameters.addAll(additionalParameters)
Владислав Наумов92288d92020-07-13 18:36:21 +02001099 }
1100
Владислав Наумовaa430612020-06-08 17:18:31 +02001101 def jobResults = []
Ivan Berezovskiy91ede502021-05-13 21:05:36 +04001102
1103 platforms.each { platform ->
1104 jobs["kaas-core-${platform}-patched-${component}"] = {
Vladislav Naumov5313a202021-04-07 17:13:39 +00001105 try {
Ivan Berezovskiy91ede502021-05-13 21:05:36 +04001106 common.infoMsg("Deploy: patched KaaS demo with ${platform} provider")
1107 def job_info = build job: "kaas-testing-core-${platform}-workflow-${component}", parameters: parameters, wait: true
1108 def build_description = job_info.getDescription()
1109 def build_result = job_info.getResult()
Vladislav Naumov5313a202021-04-07 17:13:39 +00001110 jobResults.add(build_result)
Владислав Наумовd044e842020-06-17 15:33:43 +02001111
Vladislav Naumov5313a202021-04-07 17:13:39 +00001112 if (build_description) {
1113 currentBuild.description += build_description
1114 }
1115 } finally {
Ivan Berezovskiy91ede502021-05-13 21:05:36 +04001116 common.infoMsg("Patched KaaS demo with ${platform} provider finished")
Vladislav Naumov5313a202021-04-07 17:13:39 +00001117 }
1118 }
1119 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001120
1121 common.infoMsg('Trigger KaaS demo deployments according to defined provider set')
Владислав Наумов37f7f842021-03-09 16:08:39 +04001122 if (jobs.size() == 0) {
1123 error('No demo jobs matched with keywords, execution will be aborted, at least 1 provider should be enabled')
1124 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001125 // Limit build concurency workaround examples: https://issues.jenkins-ci.org/browse/JENKINS-44085
1126 parallel jobs
Владислав Наумовaa430612020-06-08 17:18:31 +02001127
1128 if (jobResults.contains('FAILURE')) {
Владислав Наумовf86b1112020-06-09 14:04:48 +02001129 common.infoMsg('One of parallel downstream jobs is failed, mark executor job as failed')
Владислав Наумовaa430612020-06-08 17:18:31 +02001130 currentBuild.result = 'FAILURE'
1131 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001132}
Владислав Наумов30a516c2020-07-09 13:15:41 +02001133
1134
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001135/**
1136 * Function currently supported to be called from aws or vsphere demos. It gets particular demo context
Владислав Наумов33e1e812021-08-17 17:09:25 +02001137 * and generate proper lockResources data and netMap data for vsphere,equinix related clusters.
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001138 *
1139 * @param: callBackDemo (string) Demo which requested to generate lockResources [aws or vsphere]
1140 * @param: triggers (map) Custom trigger keywords forwarded from gerrit
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001141 * @param: multiregionalConfiguration (map) Multiregional configuration
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001142 * @return (map) Return aggregated map with lockResources and netMap
1143 */
1144
1145
1146def generateLockResources(callBackDemo, triggers) {
1147 def common = new com.mirantis.mk.Common()
Владислав Наумов33e1e812021-08-17 17:09:25 +02001148 def netMap = [
1149 vsphere: [:],
1150 equinix: [:],
1151 ]
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001152 // Define vsphere locklabels with initial quantity
1153 def lockLabels = [
1154 vsphere_networking_core_ci: 0,
1155 vsphere_offline_networking_core_ci: 0,
1156 ]
1157 def deployChild = triggers.deployChildEnabled
Sergey Lalov13eea422023-08-21 23:10:17 +04001158 def testUiVsphere = triggers.runUie2eEnabled || triggers.runUie2eNewEnabled
Sergey Lalov900aff42024-03-08 00:05:50 +04001159 def vsphereByo = triggers.attachBYOEnabled
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001160 def multiregionConfig = triggers.multiregionalConfiguration
1161 def runMultiregion = multiregionConfig.enabled
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001162
1163 // Generate vsphere netMap and lockLabels based on demo context
1164 switch (callBackDemo) {
1165 case 'aws':
1166 // Add aws specific lock label with quantity calculated based on single mgmt deploy or mgmt + child
1167 lockLabels['aws_core_ci_queue'] = triggers.demoWeight
Sergey Kolekonovf4c1f492022-02-03 14:44:45 +04001168 if (triggers.runBYOMatrixEnabled) { lockLabels['aws_core_ci_queue'] += 6 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001169
1170 // Define netMap for Vsphere region
1171 if (runMultiregion && multiregionConfig.managementLocation == 'aws') {
1172 if (multiregionConfig.regionLocation == 'vsphere') {
1173 if (deployChild) {
1174 addToProviderNetMap(netMap, 'vsphere', 'regional-child')
1175 }
1176 addToProviderNetMap(netMap, 'vsphere', 'region')
1177 }
1178
1179 if (multiregionConfig.regionLocation == 'azure') {
1180 lockLabels['azure_core_ci_queue'] = 1
1181 if (deployChild) {
1182 lockLabels['azure_core_ci_queue'] += 1
1183 }
1184 }
1185 }
1186 if (triggers.azureOnAwsDemoEnabled) {
1187 lockLabels['azure_core_ci_queue'] = 1
1188 }
1189
1190 if (triggers.equinixOnAwsDemoEnabled) {
1191 lockLabels['equinix_core_ci_queue'] = 1
1192 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001193 break
1194 case 'vsphere':
Владислав Наумов33e1e812021-08-17 17:09:25 +02001195 addToProviderNetMap(netMap, 'vsphere', 'mgmt')
Sergey Lalov900aff42024-03-08 00:05:50 +04001196 if (deployChild || testUiVsphere || vsphereByo) {
Владислав Наумов33e1e812021-08-17 17:09:25 +02001197 addToProviderNetMap(netMap, 'vsphere', 'child')
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001198 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001199 if (runMultiregion && multiregionConfig.managementLocation == 'vsphere' &&
1200 multiregionConfig.regionLocation == 'vsphere') {
1201 if (deployChild) {
1202 addToProviderNetMap(netMap, 'vsphere', 'regional-child')
1203 }
1204 addToProviderNetMap(netMap, 'vsphere', 'region')
1205 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001206 break
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001207 case 'azure':
1208 lockLabels['azure_core_ci_queue'] = triggers.demoWeight
1209 if (runMultiregion && multiregionConfig.managementLocation == 'azure') {
1210 if (multiregionConfig.regionLocation == 'aws') {
1211 lockLabels['aws_core_ci_queue'] = 1
1212 if (deployChild) {
1213 lockLabels['aws_core_ci_queue'] += 1
1214 }
1215 }
1216
1217 if (multiregionConfig.regionLocation == 'equinix') {
1218 lockLabels['equinix_core_ci_queue'] = 1
1219 if (deployChild) {
1220 lockLabels['equinix_core_ci_queue'] +=1
1221 }
1222 }
1223 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001224 default:
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001225 error('Supposed to be called from aws, azure or vsphere demos only')
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001226 }
1227
1228 // Checking gerrit triggers and manage lock label quantity and network types in case of Offline deployment
1229 // Vsphere labels only
Владислав Наумов33e1e812021-08-17 17:09:25 +02001230 netMap['vsphere'].each { clusterType, netConfig ->
1231 if (triggers.proxyConfig["${clusterType}Offline"] == true ||
1232 (clusterType == 'regional-child' && triggers.proxyConfig['childOffline'] == true) ||
1233 (clusterType == 'region' && triggers.proxyConfig['mgmtOffline'])) {
1234
1235 netMap['vsphere'][clusterType]['netName'] = 'offline'
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001236 lockLabels['vsphere_offline_networking_core_ci']++
1237 } else {
1238 lockLabels['vsphere_networking_core_ci']++
1239 }
1240 }
1241
1242 // generate lock metadata
1243 def lockResources = []
1244 lockLabels.each { label, quantity ->
1245 if (quantity > 0) {
1246 def res = [
1247 label: label,
1248 quantity: quantity,
1249 ]
1250 lockResources.add(res)
1251 }
1252 }
1253
1254 common.infoMsg("""Generated vsphere netMap: ${netMap}
1255 Generated lockResources: ${lockResources}""")
1256
1257 return [
1258 netMap: netMap,
1259 lockResources: lockResources,
1260 ]
1261}
1262
1263/**
1264 * Function gets vsphere netMap or empty map and adds new vsphere clusterType with default netName
1265 * and empty rangeConfig to the this map.
1266 *
Владислав Наумов33e1e812021-08-17 17:09:25 +02001267 * @param: netMap (string) vsphere, equinix netMap or empty map
1268 * @param: provider (string) provider type
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001269 * @param: clusterType (string) Vsphere cluster type
1270 */
1271
Владислав Наумов33e1e812021-08-17 17:09:25 +02001272def addToProviderNetMap (netMap, provider, clusterType) {
1273 switch (provider) {
1274 case 'equinix':
1275 netMap[provider][clusterType] = [
1276 vlanConfig: '',
1277 ]
1278 break
1279 case 'vsphere':
1280 netMap[provider][clusterType] = [
1281 netName: 'default',
1282 rangeConfig: '',
1283 ]
1284 break
1285 default:
1286 error('Net map locks supported for Equinix/Vsphere providers only')
1287 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001288}
Dmitry Teselkinfce71aa2022-03-05 19:36:52 +03001289
1290/**
1291* getCIKeywordsFromCommitMsg parses commit message and returns all gerrit keywords with their values as a list of maps.
1292* Each element (map) contains keys 'key' for keyword name and 'value' for its value.
1293* If keyword contains only 'key' part then 'value' is boolean True.
1294* This function does not perform keywords validation.
1295* First line of a commit message is ignored.
1296* To use '[' or ']' characters inside keyword prepend it with backslash '\'.
1297* TODO: Remove backslash chars from values if they prepend '[' or ']'.
1298**/
1299
1300List getCIKeywordsFromCommitMsg() {
1301 String commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
1302 List commitMsgLines = commitMsg.split('\n')
1303 List keywords = []
1304 if (commitMsgLines.size() < 2) {
1305 return keywords
1306 }
1307
1308 String commitMsgBody = commitMsgLines[1..-1].join('\n')
1309
1310 // Split commit message body to chunks using '[' or ']' as delimiter,
1311 // ignoring them if prepended by backslash (regex negative lookbehind).
1312 // Resulting list will have chunks between '[' and ']' at odd indexes.
1313 List parts = commitMsgBody.split(/(?<!\\)[\[\]]/)
1314
1315 // Iterate chunks by odd indexes only, trim values and split to
1316 // <key> / <value> pair where <key> is the part of a sting before the first
1317 // whitespace delimiter, and <value> is the rest (may include whitespaces).
1318 // If there is no whitespace in the string then this is a 'switch'
1319 // and <value> will be boolean True.
1320 for (i = 1; i < parts.size(); i += 2) {
1321 def (key, value) = (parts[i].trim().split(/\s+/, 2) + [true, ])[0..1]
1322 keywords.add(['key': key, 'value': value])
1323 }
1324
1325 return keywords
1326}
1327
1328/**
1329* getJobsParamsFromCommitMsg parses list of CI keywords and returns values of 'job-params' keyword
1330* that were specified for given job name. `job-params` keyword has the following structure
1331*
1332* [job-params <job name> <parameter name> <parameter value>]
1333*
1334* Return value is a Map that contains those parameters using the following structure:
1335*
1336* <job name>:
1337* <parameter name>: <parameter value>
1338*
1339**/
1340Map getJobsParamsFromCommitMsg() {
1341 List keywords = getCIKeywordsFromCommitMsg()
1342
1343 List jobsParamsList = []
1344 keywords.findAll{ it.key == 'job-params' }.collect(jobsParamsList) {
1345 def (name, params) = (it['value'].split(/\s+/, 2) + [null, ])[0..1]
1346 def (key, value) = params.split(/\s+/, 2)
1347 ['name': name, 'key': key, 'value': value]
1348 }
1349
1350 Map jobsParams = jobsParamsList.inject([:]) { result, it ->
1351 if (!result.containsKey(it.name)) {
1352 result[it.name] = [:]
1353 }
1354 result[it.name][it.key] = it.value
1355 result
1356 }
1357
1358 return jobsParams
1359}
1360
1361
1362/**
1363* getJobParamsFromCommitMsg returns key:value Map of parameters set for a job in commit message.
1364* It uses getJobsParamsFromCommitMsg to get all parameters from commit message and then
1365* uses only those parametes that were set to all jobs (with <job name> == '*') or to
1366* a particular job. Parameters set to a particular job have higher precedence.
1367*
1368* Return value is a Map that contains those parameters:
1369*
1370* <parameter name>: <parameter value>
1371*
1372**/
1373Map getJobParamsFromCommitMsg(String jobName) {
1374 jobsParams = getJobsParamsFromCommitMsg()
1375 jobParams = jobsParams.getOrDefault('*', [:])
1376 if (jobName) {
1377 jobParams.putAll(jobsParams.getOrDefault(jobName, [:]))
1378 }
1379 return jobParams
1380}
azvyagintsevc17d14b2022-06-06 19:06:33 +03001381
1382/** Getting test scheme from text, which should be
1383Imput example:
1384text="""
1385 DATA
1386
1387 kaas_bm_test_schemas:
1388 KAAS_RELEASES_REFSPEC: ''
1389 KEY: VAL
1390
1391 DATA
1392 """
1393
1394 Call: parseTextForTestSchemas(['text' : text,'keyLine' : 'kaas_bm_test_schemas'])
1395
1396 Return:
1397 ['KAAS_RELEASES_REFSPEC': '', 'KEY' : 'VAL']
1398 **/
1399def parseTextForTestSchemas(Map opts) {
azvyagintsevd96aac22022-06-10 14:23:26 +03001400 String text = opts.getOrDefault('text', '')
azvyagintsevc17d14b2022-06-06 19:06:33 +03001401 String keyLine = opts.getOrDefault('keyLine', '')
1402 Map testScheme = [:]
1403 if (!text || !keyLine) {
azvyagintsevd96aac22022-06-10 14:23:26 +03001404 return testScheme
azvyagintsevc17d14b2022-06-06 19:06:33 +03001405 }
1406 if (text =~ /\n$keyLine\n.*/) {
1407 def common = new com.mirantis.mk.Common()
1408 try {
1409 String regExp = '\\n' + keyLine + '\\n'
1410 // regexep block must be followed by empty line
1411 testScheme = readYaml text: "${text.split(regExp)[1].split('\n\n')[0]}"
1412 common.infoMsg("parseTextForTestSchemas result:\n" + testScheme)
1413 common.mergeEnv(env, toJson(testScheme))
1414 }
1415 catch (Exception e) {
1416 common.errorMsg("There is an error occured during parseTextForTestSchemas execution:\n${e}")
1417 throw e
1418 }
1419 }
azvyagintsevd96aac22022-06-10 14:23:26 +03001420 return testScheme
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +03001421}
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001422
1423
1424/**
eromanovab24cb232023-11-17 12:17:06 +04001425* getEquinixMetroWithCapacity returns list of Equinix metros using specified
1426* instance type (nodeType), desired count of metros (metroCount) and
1427* instances (nodeCount) in a metro using specified matal version.
1428* Function downloads metal CLI from the
1429* https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux
1430* Empty list is returned in case of no metros with specified capacity was found or any other errors.
1431* Non-empty list is shuffled.
1432*
1433* @param: metroCount (int) Desired count of metros
1434* @param: nodeCount (int) Desired count of instances
1435* @param: nodeType (string) Instance type
1436* @param: version (string) Metal version to use
1437* @return ([]string) List of selected metros
1438*
1439**/
1440def getEquinixMetroWithCapacity(metroCount = 1, nodeCount = 50, nodeType = 'c3.small.x86', version = '0.9.0') {
1441 def common = new com.mirantis.mk.Common()
1442 def metalUrl = "https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux"
1443 def metal = './metal --config metal.yaml'
1444 def metro = []
1445 def out = ''
1446 def retries = 3 // number of retries
1447 def i = 0
1448 def delay = 60 // 1 minute sleep
1449 def excludeMetro = [] // list of metros to exclude from selection
1450 try {
1451 if (excludeMetro.size() > 0) {
1452 common.infoMsg("Excluded metros: ${excludeMetros}")
1453 }
1454 sh "curl -o metal -# ${metalUrl} && chmod +x metal"
1455 withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) {
1456 sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml'
1457 }
1458 while (metro.size() < metroCount && i < retries) {
1459 common.infoMsg("Selecting ${metroCount} available Equinix metros with free ${nodeCount} ${nodeType} hosts, try ${i+1}/${retries} ...")
1460 if (i > 0) { // skip sleep on first step
1461 sleep(delay)
1462 }
1463 out = sh(script: "${metal} capacity get -m -P ${nodeType}|awk '/${nodeType}/ {print \$2}'|paste -s -d,|xargs ${metal} capacity check -P ${nodeType} -q ${nodeCount} -m|grep true|awk '{print \$2}'|paste -s -d,", returnStdout: true).trim()
1464 metro = out.tokenize(',')
1465 metro -= excludeMetro
1466 if (metro.size() < metroCount) {
1467 nodeCount -= 10
1468 // We need different metros for the [equinixmetalv2-child-diff-metro] case
1469 } else if (metro.size() == 2 && metro[0][0, 1] == metro[1][0, 1]) {
1470 nodeCount -= 10
1471 }
1472 i++
1473 }
1474 if (metro.size() > 0) {
eromanovaefbbb422023-11-24 13:54:35 +04001475 m = metro.size() > 1 ? "${metro[0]},${metro[1]}" : "${metro[0]}"
1476 sh "${metal} capacity check -P ${nodeType} -m ${m} -q ${nodeCount}"
eromanovab24cb232023-11-17 12:17:06 +04001477 }
1478 } catch (Exception e) {
1479 common.errorMsg "Exception: '${e}'"
1480 return []
1481 } finally {
1482 sh 'rm metal.yaml'
1483 }
1484 if (metro.size() > 0) {
1485 Collections.shuffle(metro)
1486 common.infoMsg("Selected metros: ${metro}")
1487 } else {
1488 common.warningMsg('No any metros have been selected !!! :(')
1489 }
1490 return metro
1491}
1492
1493
1494/**
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001495* getEquinixFacilityWithCapacity returns list of Equinix facilities using specified
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001496* instance type (nodeType), desired count of facilities (facilityCount) and
1497* instances (nodeCount) in a facility using specified matal version.
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001498* Function downloads metal CLI from the
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001499* https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux
1500* 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 +03001501* Non-empty list is shuffled.
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001502*
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001503* @param: facilityCount (int) Desired count of facilities
1504* @param: nodeCount (int) Desired count of instances
1505* @param: nodeType (string) Instance type
1506* @param: version (string) Metal version to use
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001507* @return ([]string) List of selected facilities
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001508*
1509**/
eromanovab24cb232023-11-17 12:17:06 +04001510@Deprecated
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001511def getEquinixFacilityWithCapacity(facilityCount = 1, nodeCount = 50, nodeType = 'c3.small.x86', version = '0.9.0') {
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001512 def common = new com.mirantis.mk.Common()
Sergey Lalov314daae2023-11-27 12:21:20 +04001513 common.warningMsg('You are using deprecated method getEquinixFacilityWithCapacity. Use getEquinixMetroWithCapacity instead')
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001514 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 +03001515 def metal = './metal --config metal.yaml'
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001516 def facility = []
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001517 def out = ''
Sergey Zhemerdeevbcccb912022-08-25 14:26:52 +03001518 def retries = 3 // number of retries
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001519 def i = 0
1520 def delay = 60 // 1 minute sleep
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001521 def excludeFacility = [] // list of facilities to exclude from selection
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001522 try {
Sergey Zhemerdeevb3575342022-10-04 11:02:19 +03001523 if (excludeFacility.size() > 0) {
1524 common.infoMsg("Excluded facilities: ${excludeFacility}")
1525 }
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001526 sh "curl -o metal -# ${metalUrl} && chmod +x metal"
1527 withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) {
1528 sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml'
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001529 }
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001530 while (facility.size() < facilityCount && i < retries) {
1531 common.infoMsg("Selecting ${facilityCount} available Equinix facilities with free ${nodeCount} ${nodeType} hosts, try ${i+1}/${retries} ...")
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001532 if (i > 0 ) { // skip sleep on first step
1533 sleep(delay)
1534 }
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001535 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()
1536 facility = out.tokenize(',')
Sergey Zhemerdeevb3575342022-10-04 11:02:19 +03001537 facility -= excludeFacility
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001538 if (facility.size() < facilityCount) {
1539 nodeCount -= 10
1540 // We need different metros for the [equinixmetalv2-child-diff-metro] case, facility[][0, 1] contains a metro name
1541 } else if (facility.size() == 2 && facility[0][0, 1] == facility[1][0, 1]) {
Sergey Zhemerdeevbcccb912022-08-25 14:26:52 +03001542 nodeCount -= 10
1543 }
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001544 i++
1545 }
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001546 if (facility.size() > 0) {
1547 f = facility.size() > 1 ? "${facility[0]},${facility[1]}" : "${facility[0]}"
1548 sh "${metal} capacity check -P ${nodeType} -f ${f} -q ${nodeCount}"
Sergey Zhemerdeevbcccb912022-08-25 14:26:52 +03001549 }
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001550 } catch (Exception e) {
1551 common.errorMsg "Exception: '${e}'"
1552 return []
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001553 } finally {
1554 sh 'rm metal.yaml'
1555 }
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001556 if (facility.size() > 0) {
Sergey Zhemerdeev15aa8602022-10-13 11:10:02 +03001557 Collections.shuffle(facility)
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001558 common.infoMsg("Selected facilities: ${facility}")
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001559 } else {
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001560 common.warningMsg('No any facilities have been selected !!! :(')
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001561 }
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001562 return facility
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001563}
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001564
1565
1566/**
1567 * genCommandLine prepares command line for artifactory-replication
1568 * command using legacy environment variables
1569 *
1570 * @return: (string) Prepared command line
1571 */
1572def genCommandLine() {
1573 def envToParam = [
1574 'DESTINATION_USER': '-dst-user',
1575 'ARTIFACT_FILTER': '-artifact-filter',
1576 'ARTIFACT_FILTER_PROD': '-artifact-filter-prod',
1577 'ARTIFACT_TYPE': '-artifact-type',
1578 'BINARY_CLEAN': '-bin-cleanup',
1579 'BINARY_CLEAN_KEEP_DAYS': '-bin-clean-keep-days',
1580 'BINARY_CLEAN_PREFIX': '-bin-clean-prefix',
1581 'BUILD_URL': '-slack-build-url',
1582 'CHECK_REPOS': '-check-repos',
1583 'DESTINATION_REGISTRY': '-dst-repo',
1584 'DESTINATION_REGISTRY_TYPE': '-dst-repo-type',
Ihor Hryshchenko4f703862023-12-07 14:45:50 +02001585 'SIGNED_IMAGES_PATH': '-signed-images-path',
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001586 'DOCKER_CLEAN': '-cleanup',
Ihor Hryshchenkoaa501002024-03-11 16:39:56 +02001587 'DOCKER_OLDER_THAN_DAYS': '-older-than-days',
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001588 'DOCKER_REPO_PREFIX': '-docker-repo-prefix',
1589 'DOCKER_TAG': '-docker-tag',
1590 'FORCE': '-force',
1591 'HELM_CDN_DOMAIN': '-helm-cdn-domain',
1592 'SLACK_CHANNEL': '-slack-channel',
Ihor Hryshchenko742c9012024-01-19 16:47:22 +02001593 'SLACK_CHANNELS': '-slack-channels',
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001594 'SLACK_USER': '-slack-user',
1595 'SOURCE_REGISTRY': '-src-repo',
1596 'SOURCE_REGISTRY_TYPE': '-src-repo-type',
1597 'SYNC_PATTERN': '-sync-pattern'
1598 ]
1599 def cmdParams = ''
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001600 def isCheckClean = false
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001601 for (e in envToParam) {
1602 if (env[e.key] == null) {
1603 continue
1604 }
1605 if (e.key == 'CHECK_REPOS' || e.key == 'DOCKER_CLEAN') {
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001606 // Avoid CHECK_REPOS=true and DOCKER_CLEAN=true
1607 if (env[e.key].toBoolean() && !isCheckClean) {
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001608 cmdParams += e.value + ' '
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001609 isCheckClean = true
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001610 }
1611 } else if (e.key == 'FORCE') {
1612 if (env[e.key].toBoolean()) {
1613 cmdParams += e.value + ' '
1614 }
1615 } else {
Sergey Zhemerdeeve2926cd2022-08-29 15:28:47 +03001616 cmdParams += "${e.value} '${env[e.key]}' "
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001617 }
1618 }
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001619 // No any check or clean was specified - take a default action
1620 if (!isCheckClean) {
1621 cmdParams += '-replicate'
1622 }
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001623 return cmdParams
1624}
Sergey Kolekonov0e60a942022-09-05 13:02:22 +04001625
1626/**
1627 * custom scheduling algorithm
1628 * it ensures that builds of the same job are distributed as much as possible between different nodes
1629 * @param label (string) desired node label
1630 * @return: (string) node name
1631 */
1632def schedule (label='docker') {
1633 def common = new com.mirantis.mk.Common()
1634 def freeNodes = []
1635 def nodesMap = [:]
1636
1637 // filter nodes with the specified label and at least one free executor
1638 timeout(time: 30, unit: 'MINUTES') {
1639 while (!freeNodes) {
1640 freeNodes = jenkins.model.Jenkins.instance.computers.findAll { node ->
1641 label in node.getAssignedLabels().collect { it.name } &&
Sergey Kolekonovd5887172022-11-10 12:13:22 +06001642 node.isPartiallyIdle() &&
1643 node.isOnline()
Sergey Kolekonov0e60a942022-09-05 13:02:22 +04001644 }
1645 if (!freeNodes) {
1646 echo 'No nodes available for scheduling, retrying...'
1647 sleep 30
1648 }
1649 }
1650 }
1651
1652 // generate a map of nodes matching other criteria
1653 for (node in freeNodes) {
1654 // sameJobExecutors is the number of executors running the same job as the calling one
1655 sameJobExecutors = node.getExecutors() // get all executors
1656 .collect { executor -> executor.getCurrentExecutable() } // get running "threads"
1657 .collect { thread -> thread?.displayName } // filter job names from threads
1658 .minus(null) // null = empty executors, remove them from the list
1659 .findAll { it.contains(env.JOB_NAME) } // filter the same jobs as the calling one
1660 .size()
1661
1662 // calculate busy executors, we don't want to count "sameJobExecutors" twice
1663 totalBusyExecutors = node.countBusy() - sameJobExecutors
1664 // generate the final map which contains nodes matching criteria with their load score
1665 // builds of the same jobs have x10 score, all others x1
1666 nodesMap += ["${node.getName()}" : sameJobExecutors * 10 + totalBusyExecutors]
1667 }
1668
1669 // return the least loaded node
1670 return common.SortMapByValueAsc(nodesMap).collect { it.key }[0]
1671}
Sergey Zhemerdeev78a65272023-03-23 18:05:22 +02001672
1673
1674/**
1675 * Get latest tag for test/frontend & equinix-private-infra images
1676 * @param version (str) default tag value from main workflow
1677 * @param isChanged (bool) is dependent directory files were changed
1678 * @param imageName (string) image name for information message
1679 * @return: (string) tag name
1680 */
1681def getImageTag(version, isChanged, imageName) {
1682 def common = new com.mirantis.mk.Common()
Sergey Zhemerdeev5fbf2022023-04-28 14:51:36 +03001683 def latestTag = ''
1684 if (env.GERRIT_EVENT_TYPE && !(env.GERRIT_EVENT_TYPE in ['change-merged', 'ref-updated']) && isChanged) {
Sergey Zhemerdeev78a65272023-03-23 18:05:22 +02001685 latestTag = version
Sergey Zhemerdeevebdcad22023-04-25 16:58:28 +03001686 } else {
1687 if (env.GERRIT_EVENT_TYPE == 'ref-updated') {
1688 latestTag = env.GERRIT_REFNAME.replace('refs/tags/v', '').trim()
1689 } else {
1690 latestTag = env.GERRIT_BRANCH ? env.GERRIT_BRANCH : env.GERRIT_REFSPEC ? env.GERRIT_REFSPEC : 'master'
1691 if (latestTag != 'master') {
1692 latestTag = latestTag.replaceAll('/', '_')
1693 }
1694 }
Sergey Zhemerdeev78a65272023-03-23 18:05:22 +02001695 }
1696 common.infoMsg("${imageName} image will use tag '${latestTag}'")
1697 return latestTag
1698}
Sergey Zhemerdeev1d2c03e2023-04-28 11:07:24 +03001699
Sergey Lalov78659102024-02-15 16:57:21 +04001700/**
1701 * Get actual branch version for os deployment job
1702 * @param mosChildPreviouseComplexRelease (string) kaas_previous_complex_mosk_cluster_release_version.txt
1703 * @param mosChildLatestComplexRelease (string) kaas_latest_complex_mosk_cluster_release_version.txt
1704 * @param upgradeFlag (boolean)
1705 * all parametrs get from si-test-release-sanity-check-prepare-configuration job
1706 * @return: (string) branch verison
1707 */
1708def getOpenstackbranchVersion(mosChildPreviouseComplexRelease, mosChildLatestComplexRelease, upgradeFlag) {
1709 def common = new com.mirantis.mk.Common()
1710 def regex = Pattern.compile('([a-z]+)-([0-9]+-[0-9]+-[0-9]+)-([a-z]*)-?([0-9]+-[0-9]+-?[0-9]*)')
1711
1712 def mosVersionBranch = upgradeFlag ? mosChildPreviouseComplexRelease : mosChildLatestComplexRelease
1713 def matcherComplexVersion = regex.matcher((mosVersionBranch).toString())
1714 def releaseOpenstackK8sBranch = 'master'
1715
1716 if (matcherComplexVersion.find()) {
1717 def matcherComplexVersionParts = matcherComplexVersion.group(2).split('-')
1718 releaseOpenstackK8sBranch = String.format('%s.%s.%s', matcherComplexVersionParts[0], matcherComplexVersionParts[1], '0')
1719 }
1720 common.infoMsg("Use: OPENSTACK_DEPLOY_RELEASE_DIR ${releaseOpenstackK8sBranch}")
1721 return releaseOpenstackK8sBranch
1722}
1723
1724
Sergey Zhemerdeev1d2c03e2023-04-28 11:07:24 +03001725
1726/**
1727 * Translates set of environment vars into actual replicator command line
1728 * @return: (string cmdParams, string jobDescription)
1729 * cmdParams - generated command line
1730 * jobDescription - job description
1731 */
1732def genReplicatorCommandLine() {
1733 def mainModes = ['REPLICATE', 'CLEANUP', 'CHECK_REPOS', 'BIN_CLEANUP']
Sergey Zhemerdeev9919b1b2023-04-28 17:24:21 +03001734 def parameterWithoutArgument = mainModes
Sergey Zhemerdeev1d2c03e2023-04-28 11:07:24 +03001735 def parametersList = parameterWithoutArgument + [
1736 'ARTIFACT_FILTER',
1737 'ARTIFACT_TYPE',
1738 'BIN_CLEAN_KEEP_DAYS',
1739 'BIN_CLEAN_PREFIX',
1740 'DOCKER_TAG',
1741 // DST_ will be changed to TARGET_
1742 'DST_REPO',
1743 'DST_REPO_TYPE',
1744 'DST_USER',
1745 'OLDER_THAN_DAYS',
1746 'SLACK_BUILD_URL',
1747 'SLACK_CHANNEL',
1748 'SLACK_USER',
1749 'SRC_REPO',
1750 'SRC_REPO_TYPE',
1751 'SRC_USER',
1752 'SYNC_PATTERN',
1753 'THREAD_COUNT'
1754 ]
1755 def mainModesDescriptions = [
1756 'REPLICATE': 'Replicating binaries/Docker images',
1757 'CLEANUP': 'Cleaning Docker images',
1758 'BIN_CLEANUP': 'Cleaning binaries',
1759 'CHECK_REPOS': 'Checking binaries'
1760 ]
1761
1762 def cmdParams = ''
1763 def jobDescription = ''
1764 for (e in parametersList) {
1765 if (env[e] == null || env[e] == '') {
1766 continue
1767 }
1768 if (e in mainModes) {
1769 jobDescription = mainModesDescriptions[e]
1770 }
1771 cmdParams += "-${e.replaceAll('_', '-').toLowerCase()} "
1772 if (!(e in parameterWithoutArgument)) {
1773 cmdParams += "'${env[e]}' "
1774 }
1775 }
1776 return [cmdParams, jobDescription]
1777}