blob: c0480c1499da3bf253459f29fc2e030ff5cab54b [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
Viktor Astakhov4fda2672024-08-29 16:38:25 +0400104 def runRuntimeMigrateExtendedTestMgmt = env.RUN_MGMT_RUNTIME_MIGRATE_EXTENDED_TEST ? env.RUN_MGMT_RUNTIME_MIGRATE_EXTENDED_TEST.toBoolean() : false
105 def runRuntimeMigrateQuickTestMgmt = env.RUN_MGMT_RUNTIME_MIGRATE_QUICK_TEST ? env.RUN_MGMT_RUNTIME_MIGRATE_QUICK_TEST.toBoolean() : false
106 def runRuntimeMigrateAndRollbackTestMgmt = env.RUN_MGMT_RUNTIME_MIGRATE_AND_ROLLBACK_TEST ? env.RUN_MGMT_RUNTIME_MIGRATE_AND_ROLLBACK_TEST.toBoolean() : false
107 def runRuntimeMigrateExtendedTestChild = env.RUN_CHILD_RUNTIME_MIGRATE_EXTENDED_TEST ? env.RUN_CHILD_RUNTIME_MIGRATE_EXTENDED_TEST.toBoolean() : false
108 def runRuntimeMigrateQuickTestChild = env.RUN_CHILD_RUNTIME_MIGRATE_QUICK_TEST ? env.RUN_CHILD_RUNTIME_MIGRATE_QUICK_TEST.toBoolean() : false
109 def runRuntimeMigrateAndRollbackTestChild = env.RUN_CHILD_RUNTIME_MIGRATE_AND_ROLLBACK_TEST ? env.RUN_CHILD_RUNTIME_MIGRATE_AND_ROLLBACK_TEST.toBoolean() : false
Viktor Astakhov8068bee2024-11-15 18:38:10 +0400110 def upgradeChildPlanSeq = env.UPGRADE_CHILD_PLAN_SEQ ? env.UPGRADE_CHILD_PLAN_SEQ.toBoolean() : false
111 def upgradeChildPlanBulk = env.UPGRADE_CHILD_PLAN_BULK ? env.UPGRADE_CHILD_PLAN_BULK.toBoolean() : false
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000112 // multiregion configuration from env variable: comma-separated string in form $mgmt_provider,$regional_provider
113 def multiregionalMappings = env.MULTIREGION_SETUP ? multiregionWorkflowParser(env.MULTIREGION_SETUP) : [
114 enabled: false,
115 managementLocation: '',
116 regionLocation: '',
117 ]
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200118
Владислав Наумовb8305e22021-02-10 17:23:12 +0100119 // proxy customization
120 def proxyConfig = [
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200121 mgmtOffline: env.OFFLINE_MGMT_CLUSTER ? env.OFFLINE_MGMT_CLUSTER.toBoolean() : false,
122 childOffline: env.OFFLINE_CHILD_CLUSTER ? env.OFFLINE_CHILD_CLUSTER.toBoolean() : false,
Владислав Наумов257ea132021-04-14 14:44:13 +0200123 childProxy: env.PROXY_CHILD_CLUSTER ? env.PROXY_CHILD_CLUSTER.toBoolean() : false,
Владислав Наумовb8305e22021-02-10 17:23:12 +0100124 ]
125
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200126 // optional demo deployment customization
Владислав Наумов905dd362020-06-08 16:37:01 +0200127 def awsOnDemandDemo = env.ALLOW_AWS_ON_DEMAND ? env.ALLOW_AWS_ON_DEMAND.toBoolean() : false
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000128 def equinixOnDemandDemo = env.ALLOW_EQUINIX_ON_DEMAND ? env.ALLOW_EQUINIX_ON_DEMAND.toBoolean() : false
Владислав Наумов82305e92021-10-14 20:45:20 +0200129 def equinixMetalV2OnDemandDemo = env.ALLOW_EQUINIXMETALV2_ON_DEMAND ? env.ALLOW_EQUINIXMETALV2_ON_DEMAND.toBoolean() : false
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000130 def equinixOnAwsDemo = env.EQUINIX_ON_AWS_DEMO ? env.EQUINIX_ON_AWS_DEMO.toBoolean() : false
131 def azureOnAwsDemo = env.AZURE_ON_AWS_DEMO ? env.AZURE_ON_AWS_DEMO.toBoolean() : false
132 def azureOnDemandDemo = env.ALLOW_AZURE_ON_DEMAND ? env.ALLOW_AZURE_ON_DEMAND.toBoolean() : false
Sergey Kolekonovad61fed2024-08-30 16:13:12 +0500133 def enableVsphereDemo = env.ALLOW_VSPHERE_ON_DEMAND ? env.ALLOW_VSPHERE_ON_DEMAND.toBoolean() : false
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200134 def enableOSDemo = true
azvyagintsev1761bdc2020-09-04 17:24:12 +0300135 def enableBMDemo = true
Sergey Lalovc62e9382024-01-29 15:19:15 +0400136 def enablebmCoreDemo = env.ALLOW_BM_CORE_ON_DEMAND ? env.ALLOW_BM_CORE_ON_DEMAND.toBoolean() : false
Sergey Lalovef5c9dc2024-03-20 22:30:06 +0400137 def bmCoreCleanup = env.BM_CORE_CLEANUP ? env.BM_CORE_CLEANUP.toBoolean() : true
Mikhail Ivanovbd1a9fd2022-03-29 21:36:21 +0400138 def enableArtifactsBuild = true
Sergey Lalovcad93332024-03-11 16:19:31 +0400139 def bmDeployType = env.BM_DEPLOY_TYPE ? env.BM_DEPLOY_TYPE.toString() : 'virtual'
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400140 def openstackIMC = env.OPENSTACK_CLOUD_LOCATION ? env.OPENSTACK_CLOUD_LOCATION : 'us'
Alexandr Lovtsov36473f32022-04-28 15:46:09 +0300141 def enableVsphereUbuntu = env.VSPHERE_DEPLOY_UBUNTU ? env.VSPHERE_DEPLOY_UBUNTU.toBoolean() : false
Ivan Berezovskiy30c4b122023-11-06 18:03:18 +0500142 def enableVsphereRHEL = env.VSPHERE_DEPLOY_RHEL ? env.VSPHERE_DEPLOY_RHEL.toBoolean() : false
Sergey Zhemerdeeve67fb262022-06-21 00:49:34 +0300143 def childOsBootFromVolume = env.OPENSTACK_BOOT_FROM_VOLUME ? env.OPENSTACK_BOOT_FROM_VOLUME.toBoolean() : false
Ivan Berezovskiy29e72b72022-07-12 21:03:24 +0400144 def bootstrapV2Scenario = env.BOOTSTRAP_V2_ENABLED ? env.BOOTSTRAP_V2_ENABLED.toBoolean() : false
Sergey Lalovacec3c12022-07-20 16:00:14 +0400145 def equinixMetalV2Metro = env.EQUINIX_MGMT_METRO ? env.EQUINIX_MGMT_METRO : ''
Mikhail Ivanov3088d3d2022-10-24 14:05:46 +0400146 def enableFips = env.ENABLE_FIPS ? env.ENABLE_FIPS.toBoolean() : false
Sergey Lalov00bea0f2023-08-14 16:46:33 +0400147 def enableMkeDebug = env.ENABLE_MKE_DEBUG ? env.ENABLE_MKE_DEBUG.toBoolean() : false
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300148 def aioCluster = env.AIO_CLUSTER ? env.AIO_CLUSTER.toBoolean() : false
Sergey Lalov22d05592024-10-29 17:06:50 +0400149 def dockerServicesCheckSkip = env.DOCKER_SERVICES_CHECK_SKIP ? env.DOCKER_SERVICES_CHECK_SKIP.toBoolean() : false
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100150 def useVsphereVvmtObjects = env.VSPHERE_USE_VVMT_OBJECTS ? env.VSPHERE_USE_VVMT_OBJECTS.toBoolean() : false
vryzhenkin4fd3f242023-03-29 15:13:46 +0400151 def enableBv2Smoke = true
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400152 def runCacheWarmup = env.CACHE_WARMUP_ENABLED ? env.CACHE_WARMUP_ENABLED.toBoolean() : false
vryzhenkin211a4e82023-11-23 12:48:27 +0400153 def cveScan = false
Sergey Kolekonov75148432024-07-16 13:22:36 +0500154 // Sync to public CDN is triggered automatically for corresponding scenarios
155 // This trigger is used only for on-demand cases
156 def publicCISync = false
vnaumov33747e12020-05-04 17:35:20 +0200157
Владислав Наумов6c2afff2020-06-05 12:54:53 +0200158 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
Владислав Наумовb8305e22021-02-10 17:23:12 +0100159 if (commitMsg ==~ /(?s).*\[mgmt-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-proxy.*/) {
160 proxyConfig['mgmtOffline'] = true
Владислав Наумов70c02422021-04-19 14:29:41 +0200161 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 +0100162 }
Sergey Kolekonov5995dfd2023-07-06 16:09:43 +0600163 if (commitMsg ==~ /(?s).*\[mgmt-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-upgrade.*/) {
164 upgradeMgmt = true
165 }
166 if (commitMsg ==~ /(?s).*\[auto-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*auto-upgrade.*/) {
167 autoUpgradeMgmt = true
168 }
Владислав Наумов44c64b72020-12-04 20:22:53 +0100169 if (commitMsg ==~ /(?s).*\[seed-macos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*seed-macos.*/) {
170 seedMacOs = true
171 }
Sergey Lalovafcc0432023-04-13 14:59:06 +0400172 if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ ||
173 upgradeChild || runChildConformance || runProxyChildTest || runChildHPA || runChildConformanceNetworkPolicy) {
vnaumov33747e12020-05-04 17:35:20 +0200174 deployChild = true
175 }
176 if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) {
177 deployChild = true
178 upgradeChild = true
179 }
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400180 if (commitMsg ==~ /(?s).*\[child-upgrade-full\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade-full.*/) {
181 deployChild = true
182 upgradeChild = true
Sergey Lalova048df92023-06-19 19:36:41 +0400183 common.warningMsg("2-step child updates are not testing (PRODX-33510)")
184 //TODO: revert after start testing the two-step upgrade again (PRODX-33510)
185 //fullUpgradeChild = true
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400186 }
Viktor Astakhov8068bee2024-11-15 18:38:10 +0400187 if (commitMsg ==~ /(?s).*\[child-upgrade-plan-sequental\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade-plan-sequental.*/) {
188 deployChild = true
189 upgradeChild = true
190 upgradeChildPlanSeq = true
191 }
192 if (commitMsg ==~ /(?s).*\[child-upgrade-plan-bulk\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade-plan-bulk.*/) {
193 deployChild = true
194 upgradeChild = true
195 upgradeChildPlanBulk = true
196 }
Sergey Kolekonov5995dfd2023-07-06 16:09:43 +0600197 if ((upgradeMgmt || autoUpgradeMgmt) && deployChild) {
198 upgradeChild = true
199 common.warningMsg('child upgrade is automatically enabled as mgmt upgrade and child deploy are enabled')
200 }
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400201 def childDeployMatches = (commitMsg =~ /(\[child-deploy\s*(\w|\-)+?\])/)
202 if (childDeployMatches.size() > 0) {
Mikhail Ivanov74504372021-05-21 17:01:06 +0400203 // override child version when it set explicitly
204 deployChild = true
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400205 customChildRelease = childDeployMatches[0][0].split('child-deploy')[1].replaceAll('[\\[\\]]', '').trim()
Mikhail Ivanov74504372021-05-21 17:01:06 +0400206 common.warningMsg("Forced child deployment using custom release version ${customChildRelease}")
207 }
Mikhail Ivanov38ee4382022-01-27 16:21:51 +0400208 if (commitMsg ==~ /(?s).*\[mos-child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-deploy.*/) {
209 mosDeployChild = true
210 }
211 if (commitMsg ==~ /(?s).*\[mos-child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-upgrade.*/) {
212 mosDeployChild = true
213 mosUpgradeChild = true
214 }
Sergey Kolekonov5995dfd2023-07-06 16:09:43 +0600215 if ((upgradeMgmt || autoUpgradeMgmt) && mosDeployChild) {
216 mosUpgradeChild = true
217 common.warningMsg('MOSK child upgrade is automatically enabled as mgmt upgrade and MOSK child deploy are enabled')
218 }
Владислав Наумов0dc99252020-11-13 13:30:48 +0100219 if (commitMsg ==~ /(?s).*\[byo-attach\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-attach.*/) {
220 attachBYO = true
221 }
Владислав Наумовcdbd84e2020-12-01 16:51:09 +0100222 if (commitMsg ==~ /(?s).*\[byo-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-upgrade.*/) {
223 attachBYO = true
224 upgradeBYO = true
225 }
Sergey Lalovacec3c12022-07-20 16:00:14 +0400226 if (commitMsg ==~ /(?s).*\[ui-test-on-all-providers\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-test-on-all-providers.*/) {
227 enableVsphereDemo = true
228 enableOSDemo = true
229 awsOnDemandDemo = true
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000230 azureOnDemandDemo = true
231 equinixOnDemandDemo = true
Sergey Lalovacec3c12022-07-20 16:00:14 +0400232 equinixMetalV2OnDemandDemo = true
233 runUie2e = true
Sergey Lalovacec3c12022-07-20 16:00:14 +0400234 // Edit after fix PRODX-3961
235 enableBMDemo = false
236 }
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400237 def byoDeployMatches = (commitMsg =~ /(\[run-byo-matrix\s*(ubuntu|centos)\])/)
238 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 +0100239 runBYOMatrix = true
240
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400241 if (byoDeployMatches.size() > 0) {
242 defaultBYOOs = byoDeployMatches[0][2]
243 common.warningMsg("Custom BYO OS detected, using ${defaultBYOOs}")
244 }
245
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100246 common.warningMsg('Forced byo matrix test via run-byo-matrix, all other byo triggers will be skipped')
247 attachBYO = false
248 upgradeBYO = false
249 }
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400250 if (commitMsg ==~ /(?s).*\[lma-logging\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-logging.*/) {
251 enableLMALogging = true
252 }
Sergey Lalovb2f60372022-09-20 23:58:47 +0400253 if (commitMsg ==~ /(?s).*\[deploy-os-on-mos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*deploy-os-on-mos.*/) {
254 deployOsOnMos = true
255 mosDeployChild = true
Sergey Lalovb2f60372022-09-20 23:58:47 +0400256 }
Sergey Lalovd0e20852023-08-17 19:11:19 +0400257
258 if (commitMsg ==~ /(?s).*\[half-virtual\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*half-virtual.*/ || upgradeMgmt) {
259 bmDeployType = 'half-virtual'
Sergey Lalovd0e20852023-08-17 19:11:19 +0400260 }
261
Sergey Lalov95040602023-03-07 16:42:16 +0400262 if (commitMsg ==~ /(?s).*\[ui-e2e-nw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-nw.*/) {
vnaumov33747e12020-05-04 17:35:20 +0200263 runUie2e = true
264 }
Sergey Lalov95040602023-03-07 16:42:16 +0400265 if (commitMsg ==~ /(?s).*\[ui-e2e-pw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-pw.*/) {
Mikhail Ivanovf5e20af2022-03-24 15:38:06 +0400266 runUie2eNew = true
267 }
vnaumov33747e12020-05-04 17:35:20 +0200268 if (commitMsg ==~ /(?s).*\[mgmt-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm.*/) {
269 runMgmtConformance = true
270 }
Sergey Lalovafcc0432023-04-13 14:59:06 +0400271 if (commitMsg ==~ /(?s).*\[mgmt-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm-netpolicy.*/) {
272 runMgmtConformanceNetworkPolicy = true
273 }
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +0200274 if (commitMsg ==~ /(?s).*\[test-user-controller\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-user-controller.*/) {
275 runMgmtUserControllerTest = true
276 }
slalov574123e2022-04-06 17:24:19 +0400277 if (commitMsg ==~ /(?s).*\[test-proxy-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-proxy-child.*/) {
278 runProxyChildTest = true
279 deployChild = true
280 common.infoMsg('Child cluster deployment will be enabled since proxy child test suite will be executed')
281 }
vnaumov33747e12020-05-04 17:35:20 +0200282 if (commitMsg ==~ /(?s).*\[child-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm.*/) {
283 runChildConformance = true
284 deployChild = true
285 }
Sergey Lalovafcc0432023-04-13 14:59:06 +0400286 if (commitMsg ==~ /(?s).*\[child-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm-netpolicy.*/) {
287 runChildConformanceNetworkPolicy = true
288 deployChild = true
289 }
vryzhenkinb286bd82023-04-04 07:17:52 +0400290 if (commitMsg ==~ /(?s).*\[child-hpa\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-hpa.*/) {
291 runChildHPA = true
292 deployChild = true
293 }
Sergey Lalov012496a2023-11-27 15:57:52 +0400294 if (commitMsg ==~ /(?s).*\[child-sl-ha\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-sl-ha.*/) {
295 runChildStacklightHa = true
296 deployChild = true
297 }
Владислав Наумов9cec55d2021-08-03 15:00:59 +0200298 if (commitMsg ==~ /(?s).*\[lma-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-test.*/) {
299 runLMATest = true
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400300 enableLMALogging = true
301 common.infoMsg('LMA logging will be enabled since LMA test suite will be executed')
Victor Ryzhenkin15206592021-06-21 17:38:23 +0400302 }
slalov13e579c2022-01-31 21:37:02 +0400303 if (commitMsg ==~ /(?s).*\[maintenance-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*maintenance-test.*/) {
304 runMaintenanceTest = true
305 }
slalov0a4947a2022-06-09 15:44:35 +0400306 if (commitMsg ==~ /(?s).*\[container-registry-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*container-registry-test.*/) {
307 runContainerregistryTest = true
308 }
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300309 if (commitMsg ==~ /(?s).*\[mgmt-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-delete-master-test.*/) {
310 runMgmtDeleteMasterTest = true
311 }
312 if (commitMsg ==~ /(?s).*\[rgnl-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*rgnl-delete-master-test.*/) {
313 runRgnlDeleteMasterTest = true
314 }
315 if (commitMsg ==~ /(?s).*\[child-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-delete-master-test.*/) {
Sergey Lalov47e21592023-07-18 23:36:32 +0400316 if (!mosDeployChild) {
317 deployChild = true
318 }
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300319 runChildDeleteMasterTest = true
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300320 common.infoMsg('Child cluster deployment will be enabled since delete child master node test suite will be executed')
321 }
322 if (commitMsg ==~ /(?s).*\[child-machine-deletion-policy-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-machine-deletion-policy-test.*/) {
323 runChildMachineDeletionPolicyTest = true
324 deployChild = true
325 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 +0300326 }
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +0300327 if (commitMsg ==~ /(?s).*\[graceful-reboot-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*graceful-reboot-test.*/) {
328 runGracefulRebootTest = true
329 }
Sergey Lalovbc68d752022-11-08 13:40:53 +0400330 if (commitMsg ==~ /(?s).*\[pause-for-debug\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*pause-for-debug.*/) {
331 pauseForDebug = true
332 }
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200333 if (commitMsg ==~ /(?s).*\[child-offline\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-offline.*/) {
334 proxyConfig['childOffline'] = true
335 deployChild = true
336 }
Владислав Наумов257ea132021-04-14 14:44:13 +0200337 if (commitMsg ==~ /(?s).*\[child-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-proxy.*/) {
338 proxyConfig['childOffline'] = true
339 proxyConfig['childProxy'] = true
340 deployChild = true
341 }
vnaumov33747e12020-05-04 17:35:20 +0200342 if (commitMsg ==~ /(?s).*\[fetch.*binaries\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*fetch.*binaries.*/) {
343 fetchServiceBinaries = true
344 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000345 if (commitMsg ==~ /(?s).*\[equinix-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-on-aws.*/) {
346 equinixOnAwsDemo = true
347 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]\' ')
348 }
349 if (commitMsg ==~ /(?s).*\[azure-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-on-aws.*/) {
350 azureOnAwsDemo = true
351 common.warningMsg('Forced running child cluster deployment on Azure provider based on AWS management cluster, triggered on patchset using custom keyword: \'[azure-on-aws]\' ')
352 }
Владислав Наумов2d3db332021-06-15 15:19:19 +0200353 if (commitMsg ==~ /(?s).*\[aws-demo\].*/ ||
354 env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aws-demo.*/ ||
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100355 runBYOMatrix ||
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000356 seedMacOs ||
357 equinixOnAwsDemo ||
358 azureOnAwsDemo) {
Владислав Наумов2d3db332021-06-15 15:19:19 +0200359
vnaumov33747e12020-05-04 17:35:20 +0200360 awsOnDemandDemo = true
Владислав Наумов2d3db332021-06-15 15:19:19 +0200361 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 +0200362 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000363 if (commitMsg ==~ /(?s).*\[equinix-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-demo\.*/) {
364 equinixOnDemandDemo = true
365 }
Владислав Наумов82305e92021-10-14 20:45:20 +0200366 if (commitMsg ==~ /(?s).*\[equinixmetalv2-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-demo\.*/) {
Владислав Наумов144956f2021-10-14 17:49:19 +0200367 equinixMetalV2OnDemandDemo = true
368 }
Vladislav Naumov42b71dc2021-11-22 13:09:42 +0100369 if (commitMsg ==~ /(?s).*\[equinixmetalv2-child-diff-metro\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-child-diff-metro\.*/) {
370 equinixMetalV2OnDemandDemo = true
371 equinixMetalV2ChildDiffMetro = true
372 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000373 if (commitMsg ==~ /(?s).*\[azure-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-demo\.*/) {
374 azureOnDemandDemo = true
375 }
Sergey Lalov10cb3502023-03-27 22:13:49 +0400376 if (commitMsg ==~ /(?s).*\[disable-all-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-all-demo\.*/) {
377 enableVsphereDemo = false
378 enableOSDemo = false
379 enableBMDemo = false
Sergey Lalov781fccc2023-10-12 21:55:17 +0400380 enableBv2Smoke = false
381 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 +0400382 }
383
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200384 if (commitMsg ==~ /(?s).*\[disable-os-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-os-demo\.*/) {
385 enableOSDemo = false
386 common.errorMsg('Openstack demo deployment will be aborted, VF -1 will be set')
vnaumov33747e12020-05-04 17:35:20 +0200387 }
388
azvyagintsev1761bdc2020-09-04 17:24:12 +0300389 if (commitMsg ==~ /(?s).*\[disable-bm-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-demo\.*/) {
390 enableBMDemo = false
391 common.errorMsg('BM demo deployment will be aborted, VF -1 will be set')
392 }
393
Sergey Lalovd0e20852023-08-17 19:11:19 +0400394 if (commitMsg ==~ /(?s).*\[bm-core-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bm-core-demo\\.*/) {
395 enablebmCoreDemo = true
396 enableBMDemo = false
397 }
398
Sergey Lalov22d05592024-10-29 17:06:50 +0400399 if (bmDeployType == 'half-virtual' && enablebmCoreDemo) {
400 common.infoMsg('Half-virtual will be deployed by default on upgrade case')
401 }
402
Sergey Lalovd0e20852023-08-17 19:11:19 +0400403 if (commitMsg ==~ /(?s).*\[disable-bm-core-cleanup\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-core-cleanup\\.*/) {
404 bmCoreCleanup = false
405 }
406
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400407 if (commitMsg ==~ /(?s).*\[disable-vsphere-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-vsphere-demo\.*/) {
408 enableVsphereDemo = false
409 common.errorMsg('vSphere demo deployment will be aborted, VF -1 will be set')
410 }
Alexandr Lovtsov36473f32022-04-28 15:46:09 +0300411 if (commitMsg ==~ /(?s).*\[vsphere-ubuntu\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-ubuntu\.*/) {
412 enableVsphereUbuntu = true
413 common.warningMsg('Ubuntu will be used to deploy vsphere machines')
414 }
Ivan Berezovskiy30c4b122023-11-06 18:03:18 +0500415 if (commitMsg ==~ /(?s).*\[vsphere-rhel\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-rhel\.*/) {
416 enableVsphereRHEL = true
417 common.warningMsg('RHEL will be used to deploy vsphere machines')
418 }
vryzhenkin4fd3f242023-03-29 15:13:46 +0400419 if (commitMsg ==~ /(?s).*\[disable-bv2-smoke\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bv2-smoke\.*/) {
420 enableBv2Smoke = false
421 common.errorMsg('Bootstrap v2 smoke checks will be aborted, WF -1 will be set')
422 }
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400423
vryzhenkin211a4e82023-11-23 12:48:27 +0400424 if (commitMsg ==~ /(?s).*\[cve-scan\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*cve-scan\.*/) {
425 cveScan = true
426 common.errorMsg('CVE Scan job enabled')
427 }
428
Sergey Kolekonov75148432024-07-16 13:22:36 +0500429 if (commitMsg ==~ /(?s).*\[public-ci-sync\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*public-ci-sync\.*/) {
430 publicCISync = true
431 common.errorMsg('Sync to public-ci CDN is enabled')
432 }
433
Sergey Lalov7c2377e2023-12-15 23:14:45 +0400434 def slackChannelMatches = (commitMsg =~ /(\[slack-channel\s*[#@](\S+)])/)
435 if (slackChannelMatches.size() > 0) {
436 // override chanenel notify when it set explicitly
437 customSlackChannel = slackChannelMatches[0][0].split("slack-channel")[1].replaceAll('[\\[\\]]', '').trim()
438 common.warningMsg("Forced send notify to ${customSlackChannel} channel")
439 }
440
Mikhail Ivanovbd1a9fd2022-03-29 21:36:21 +0400441 if (commitMsg ==~ /(?s).*\[disable-artifacts-build\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-artifacts-build\.*/) {
442 enableArtifactsBuild = false
443 common.errorMsg('artifacts build will be aborted, VF -1 will be set')
444 }
445
Sergey Zhemerdeeve67fb262022-06-21 00:49:34 +0300446 if (commitMsg ==~ /(?s).*\[child-os-boot-from-volume\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-os-boot-from-volume\.*/) {
447 childOsBootFromVolume = true
448 common.warningMsg('OS will be booted from Ceph volumes')
449 }
450
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400451 if (commitMsg ==~ /(?s).*\[child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-custom-cert-test\.*/) {
452 runChildCustomCertTest = true
453 deployChild = true
454 common.warningMsg('Child cluster deployment will be enabled since custom cert child test suite will be executed')
455 }
456
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400457 if (commitMsg ==~ /(?s).*\[mgmt-custom-cache-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-custom-cache-cert-test\.*/) {
458 runMgmtCustomCacheCertTest = true
459 deployChild = true
460 common.warningMsg('Child cluster deployment will be enabled as the test replaces the mgmt and cluster childcertificates')
461 }
462
Sergey Lalov48e69022023-07-25 16:08:00 +0400463 if (commitMsg ==~ /(?s).*\[mke-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mke-custom-cert-test\.*/) {
464 runMkeCustomCertTest = true
465 }
466
Sergey Lalov62c28312023-10-18 19:23:59 +0400467 if (commitMsg ==~ /(?s).*\[custom-hostnames\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*custom-hostnames\.*/) {
468 runCustomHostnames = true
469 common.warningMsg('All clusters will be deployed with Custom Hostnames')
470 }
471
vryzhenkin504dfc92023-11-01 15:49:47 +0400472 if (commitMsg ==~ /(?s).*\[sl-latest\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*sl-latest\.*/) {
473 slLatest = true
474 common.warningMsg('All clusters will be deployed with Stacklight version from artifact-metadata')
475 }
476
vryzhenkina8d74e72024-02-26 14:59:37 +0400477 if (commitMsg ==~ /(?s).*\[keycloak-ldap\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*keycloak-ldap\.*/) {
478 coreKeycloakLdap = true
479 common.warningMsg('Management cluster will be deployed with LDAP integration enabled and after-deployment checks will be executed')
480 }
481
Viktor Astakhovadfcfb52024-05-16 16:56:21 +0400482 if (commitMsg ==~ /(?s).*\[ntp-update\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ntp-update\.*/) {
483 runNTPUpdateTest = true
484 common.warningMsg('After deployment of mgmt job with NTP update will be executed')
485 }
486
Viktor Astakhov8da448c2024-06-14 14:59:32 +0400487 if (commitMsg ==~ /(?s).*\[mcc-maria-backup-restore\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mcc-maria-backup-restore\.*/) {
488 runMCCMariaBackupRestoreTest = true
489 common.warningMsg('MCC Maria Backup/Restore test will be executed as part of mgmt test suite')
490 }
491
Viktor Astakhov4fda2672024-08-29 16:38:25 +0400492 if (commitMsg ==~ /(?s).*\[runtime-migrate-extended-mgmt\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-extended-mgmt\.*/) {
493 runRuntimeMigrateExtendedTestMgmt = true
494 common.warningMsg('Runtime migration with semi-reverts (extended test) scheduled as part of mgmt test suite')
495 }
496
497 if (commitMsg ==~ /(?s).*\[runtime-migrate-quick-mgmt\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-quick-mgmt\.*/) {
498 runRuntimeMigrateQuickTestMgmt = true
499 common.warningMsg('Runtime migration of all nodes in one action (quick test) scheduled as part of mgmt test suite')
500 }
501
502 if (commitMsg ==~ /(?s).*\[runtime-migrate-and-rollback-mgmt\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-and-rollback-mgmt\.*/) {
503 runRuntimeMigrateAndRollbackTestMgmt = true
504 common.warningMsg('Runtime migration with semi-reverts (extended test) and runtime rollback scheduled as part of mgmt test suite')
505 }
506
507 if (commitMsg ==~ /(?s).*\[runtime-migrate-extended-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-extended-child\.*/) {
508 runRuntimeMigrateExtendedTestChild = true
509 common.warningMsg('Runtime migration with semi-reverts (extended test) scheduled as part of child test suite')
510 }
511
512 if (commitMsg ==~ /(?s).*\[runtime-migrate-quick-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-quick-child\.*/) {
513 runRuntimeMigrateQuickTestChild = true
514 common.warningMsg('Runtime migration of all nodes in one action (quick test) scheduled as part of child test suite')
515 }
516
517 if (commitMsg ==~ /(?s).*\[runtime-migrate-and-rollback-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-and-rollback-child\.*/) {
518 runRuntimeMigrateAndRollbackTestChild = true
519 common.warningMsg('Runtime migration with semi-reverts (extended test) and runtime rollback scheduled as part of child test suite')
520 }
521
vryzhenkine0ff1d82024-03-18 15:08:09 +0400522 if (commitMsg ==~ /(?s).*\[internal-ntp\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*internal-ntp\.*/ || proxyConfig['mgmtOffline'] || proxyConfig['childOffline']) {
523 configureInternalNTP = true
Sergey Lalov348f9452024-04-18 10:34:04 +0000524 openstackIMC = 'eu'
525 common.warningMsg('Internal NTP servers will be used. Forced deployment for an offline case in eu cloud')
vryzhenkine0ff1d82024-03-18 15:08:09 +0400526 }
527
Sergey Lalovd7593ab2024-01-11 13:40:13 +0400528 if (commitMsg ==~ /(?s).*\[disable-kube-api-audit\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-kube-api-audit\.*/) {
529 disableKubeApiAudit = true
530 common.warningMsg('Disable KUBE API audit for mgmt cluster')
531 }
532
Sergey Lalov26e24c22024-03-20 13:47:31 +0400533 if (commitMsg ==~ /(?s).*\[auditd\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-kube-api-audit\.*/) {
534 auditd = true
535 }
536
Sergey Lalov430fcd72023-03-20 17:19:44 +0400537 if (commitMsg ==~ /(?s).*\[byo-child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-child-custom-cert-test\.*/) {
538 runByoChildCustomCertTest = true
539 attachBYO = true
540 common.warningMsg('Byo child cluster deployment will be enabled since custom cert child test suite will be executed')
541 }
542
vnaumov33747e12020-05-04 17:35:20 +0200543 // TODO (vnaumov) remove below condition after moving all releases to UCP
544 def ucpChildMatches = (commitMsg =~ /(\[child-ucp\s*ucp-.*?\])/)
545 if (ucpChildMatches.size() > 0) {
546 deployChild = true
547 common.warningMsg('Forced UCP based child deployment triggered on patchset using custom keyword: \'[child-ucp ucp-5-1-0-3-3-0-example]\' ')
548
549 // TODO(vnaumov) delete after ucp upgrades support
550 common.errorMsg('Child upgrade test will be skipped, UCP upgrades temporally disabled')
551 upgradeChild = false
552 }
553
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300554 if (commitMsg ==~ /(?s).*\[aio-cluster\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aio-cluster.*/) {
555 aioCluster = true
556 }
557
Sergey Lalov22d05592024-10-29 17:06:50 +0400558 if (commitMsg ==~ /(?s).*\[enable-docker-services-check\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aio-cluster.*/) {
559 dockerServicesCheckSkip = false
560 common.warningMsg('Forced enable docker service check for all job on WF')
561 }
562
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400563 if (commitMsg ==~ /(?s).*\[cache-warmup\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*cache-warmup.*/) {
564 runCacheWarmup = true
565 }
566
567 if (runCacheWarmup && (!deployChild && !mosDeployChild)) {
568 runCacheWarmup = false
569 common.errorMsg('Child cluster deployment is not enabled, skipping Cache Warmup')
570 }
571
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000572 // multiregional tests
573 def multiRegionalMatches = (commitMsg =~ /(\[multiregion\s*.*?\])/)
574 if (multiRegionalMatches.size() > 0) {
575 multiregionalMappings = multiregionWorkflowParser(multiRegionalMatches)
576 }
577 switch (multiregionalMappings['managementLocation']) {
578 case 'aws':
579 common.warningMsg('Forced running additional kaas deployment with AWS provider according multiregional demo request')
580 awsOnDemandDemo = true
581
582 if (multiregionalMappings['regionLocation'] != 'aws' && seedMacOs) { // macstadium seed node has access only to *public* providers
583 error('incompatible triggers: [seed-macos] and multiregional deployment based on *private* regional provider cannot be applied simultaneously')
584 }
585 break
586 case 'os':
587 if (enableOSDemo == false) {
588 error('incompatible triggers: [disable-os-demo] and multiregional deployment based on OSt management region cannot be applied simultaneously')
589 }
590 break
591 case 'vsphere':
592 if (enableVsphereDemo == false) {
593 error('incompatible triggers: [disable-vsphere-demo] and multiregional deployment based on Vsphere management region cannot be applied simultaneously')
594 }
595 break
596 case 'equinix':
597 common.warningMsg('Forced running additional kaas deployment with Equinix provider according multiregional demo request')
598 equinixOnDemandDemo = true
599 break
600 case 'equinixmetalv2':
601 common.warningMsg('Forced running additional kaas deployment with Equinix Metal V2 provider according multiregional demo request')
602 equinixMetalV2OnDemandDemo = true
603 break
604 case 'azure':
605 common.warningMsg('Forced running additional kaas deployment with Azure provider according multiregional demo request')
606 azureOnDemandDemo = true
607 break
608 }
609
Владислав Наумовb8305e22021-02-10 17:23:12 +0100610 // CDN configuration
611 def cdnConfig = [
612 mgmt: [
Sergey Lalovf80dab52024-04-19 14:16:52 +0000613 openstack: 'internal-ci',
Sergey Lalov3ad827f2024-04-19 18:40:21 +0400614 vsphere: 'internal-eu',
Владислав Наумовb8305e22021-02-10 17:23:12 +0100615 aws: 'public-ci',
Владислав Наумовe021b022021-05-06 11:26:38 +0200616 equinix: 'public-ci',
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000617 azure: 'public-ci',
Владислав Наумовf8f23fa2021-04-01 16:57:52 +0200618 ],
Владислав Наумовb8305e22021-02-10 17:23:12 +0100619 ]
620
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400621 if (commitMsg ==~ /(?s).*\[eu-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*eu-demo.*/) {
622 openstackIMC = 'eu'
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400623 }
Sergey Lalovac6a8e72023-12-19 01:28:41 +0400624
625 if (openstackIMC == 'eu') {
slalov021171f2022-03-04 14:48:38 +0400626 // use internal-eu because on internal-ci with eu cloud image pull takes much time
Sergey Lalovf80dab52024-04-19 14:16:52 +0000627 def cdnRegion = 'internal-eu'
slalov021171f2022-03-04 14:48:38 +0400628 cdnConfig['mgmt']['openstack'] = cdnRegion
629 }
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400630
Владислав Наумов74e2d6e2020-12-30 17:05:40 +0100631 // calculate weight of current demo run to manage lockable resources
Sergey Lalov46deb442022-08-18 12:11:03 +0400632 def demoWeight = deployChild ? 2 : 1 // management = 1, child += 1
Sergey Lalov95040602023-03-07 16:42:16 +0400633 if (runUie2e || runUie2eNew) {
Sergey Lalov46deb442022-08-18 12:11:03 +0400634 demoWeight += 1
635 }
Владислав Наумов74e2d6e2020-12-30 17:05:40 +0100636
Sergey Laloveb611b22023-09-22 16:59:09 +0400637 if (commitMsg ==~ /(?s).*\[bootstrapv1-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv1-scenario\.*/) {
638 bootstrapV2Scenario = false
639 }
640
Ivan Berezovskiy29e72b72022-07-12 21:03:24 +0400641 if (commitMsg ==~ /(?s).*\[bootstrapv2-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv2-scenario\.*/) {
642 bootstrapV2Scenario = true
643 }
644
Mikhail Ivanov3088d3d2022-10-24 14:05:46 +0400645 if (commitMsg ==~ /(?s).*\[enable-fips\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*enable-fips\.*/) {
646 enableFips = true
647 }
648
Sergey Lalov00bea0f2023-08-14 16:46:33 +0400649 if (commitMsg ==~ /(?s).*\[enable-mke-debug\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*enable-mke-debug\.*/) {
650 enableMkeDebug = true
651 }
652
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100653 if (commitMsg ==~ /(?s).*\[vsphere-vvmt-obj\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-vvmt-obj\.*/) {
654 useVsphereVvmtObjects = true
655 }
656
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300657 // parse equinixmetalv2-metro trigger
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300658 def equinixMetalV2MetroMatcher = (commitMsg =~ /\[equinixmetalv2-metro(\s+.*)?\]/)
659 if (equinixMetalV2OnDemandDemo && equinixMetalV2MetroMatcher.size() > 0) {
Sergey Zhemerdeevcc785e42022-07-22 17:15:47 +0300660 equinixMetalV2Metro = equinixMetalV2MetroMatcher[0][1].trim().toLowerCase()
Sergey Zhemerdeevdd31ce92022-07-19 14:15:22 +0300661 common.infoMsg("Forced Equnix mgmt deployment using custom metro ${equinixMetalV2Metro}")
662 }
663
vnaumov33747e12020-05-04 17:35:20 +0200664 common.infoMsg("""
Mikhail Ivanovb6283f72021-11-24 18:34:57 +0400665 OpenStack Cloud location: ${openstackIMC}
Владислав Наумовb8305e22021-02-10 17:23:12 +0100666 CDN deployment configuration: ${cdnConfig}
667 MCC offline deployment configuration: ${proxyConfig}
Владислав Наумов44c64b72020-12-04 20:22:53 +0100668 Use MacOS node as seed: ${seedMacOs}
vnaumov33747e12020-05-04 17:35:20 +0200669 Child cluster deployment scheduled: ${deployChild}
Mikhail Ivanov74504372021-05-21 17:01:06 +0400670 Custom child cluster release: ${customChildRelease}
vnaumov33747e12020-05-04 17:35:20 +0200671 Child cluster release upgrade scheduled: ${upgradeChild}
Sergey Lalovc1cb49f2022-09-27 01:16:25 +0400672 Full Child cluster release upgrade scheduled: ${fullUpgradeChild}
Mikhail Ivanov38ee4382022-01-27 16:21:51 +0400673 MOS child deploy scheduled: ${mosDeployChild}
674 MOS child upgrade scheduled: ${mosUpgradeChild}
vnaumov33747e12020-05-04 17:35:20 +0200675 Child conformance testing scheduled: ${runChildConformance}
Sergey Lalovafcc0432023-04-13 14:59:06 +0400676 Child conformance network policy testing scheduled: ${runChildConformanceNetworkPolicy}
vryzhenkinb286bd82023-04-04 07:17:52 +0400677 Child HPA testing scheduled: ${runChildHPA}
Sergey Lalov012496a2023-11-27 15:57:52 +0400678 Child Stacklight HA: ${runChildStacklightHa}
Vladislav Naumov7930ab22021-11-22 18:24:24 +0100679 Single BYO cluster attachment scheduled: ${attachBYO}
680 Single Attached BYO cluster upgrade test scheduled: ${upgradeBYO}
681 BYO test matrix whole suite scheduled: ${runBYOMatrix}
Mikhail Ivanoveabc9d92021-12-30 16:40:14 +0400682 Default BYO OS: ${defaultBYOOs}
vnaumov33747e12020-05-04 17:35:20 +0200683 Mgmt cluster release upgrade scheduled: ${upgradeMgmt}
slalov1202bba2022-04-20 22:31:07 +0400684 Mgmt cluster release auto upgrade scheduled: ${autoUpgradeMgmt}
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +0400685 Mgmt LMA logging enabled: ${enableLMALogging}
Sergey Lalovb2f60372022-09-20 23:58:47 +0400686 Deploy Os on child with mos release ${deployOsOnMos}
vnaumov33747e12020-05-04 17:35:20 +0200687 Mgmt conformance testing scheduled: ${runMgmtConformance}
Sergey Lalovafcc0432023-04-13 14:59:06 +0400688 Mgmt conformance network policy testing scheduled: ${runMgmtConformanceNetworkPolicy}
Владислав Наумов9cec55d2021-08-03 15:00:59 +0200689 LMA testing scheduled: ${runLMATest}
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +0200690 Mgmt user controller testing scheduled: ${runMgmtUserControllerTest}
vnaumov33747e12020-05-04 17:35:20 +0200691 Mgmt UI e2e testing scheduled: ${runUie2e}
Mikhail Ivanovf5e20af2022-03-24 15:38:06 +0400692 Mgmt UI e2e playwrite testing scheduled: ${runUie2eNew}
slalov13e579c2022-01-31 21:37:02 +0400693 Maintenance test: ${runMaintenanceTest}
slalov0a4947a2022-06-09 15:44:35 +0400694 Container Registry test: ${runContainerregistryTest}
slalov574123e2022-04-06 17:24:19 +0400695 Child proxy test: ${runProxyChildTest}
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +0300696 Graceful reboot test: ${runGracefulRebootTest}
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +0300697 Delete mgmt master node test: ${runMgmtDeleteMasterTest}
698 Delete rgnl master node test: ${runRgnlDeleteMasterTest}
699 Delete child master node test: ${runChildDeleteMasterTest}
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300700 Child machine deletion policy test: ${runChildMachineDeletionPolicyTest}
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400701 Custom cert test for child clusters: ${runChildCustomCertTest}
Sergey Lalov430fcd72023-03-20 17:19:44 +0400702 Custom cert test for Byo child clusters: ${runByoChildCustomCertTest}
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400703 Custom cache cert test for mgmt and child clusters: ${runMgmtCustomCacheCertTest}
Sergey Lalov48e69022023-07-25 16:08:00 +0400704 MKE custom cert test for mgmt/region: ${runMkeCustomCertTest}
Sergey Lalov62c28312023-10-18 19:23:59 +0400705 Custom hostnames for all clisuers: ${runCustomHostnames}
vryzhenkin504dfc92023-11-01 15:49:47 +0400706 Stacklight templates enchanced with latest version from artifact-metadata: ${slLatest}
Sergey Lalovd7593ab2024-01-11 13:40:13 +0400707 Disable Kubernetes API audit: ${disableKubeApiAudit}
Sergey Lalov26e24c22024-03-20 13:47:31 +0400708 Enable Auditd : ${auditd}
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200709 AWS provider deployment scheduled: ${awsOnDemandDemo}
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000710 Equinix provider deployment scheduled: ${equinixOnDemandDemo}
Владислав Наумов144956f2021-10-14 17:49:19 +0200711 EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo}
Vladislav Naumov42b71dc2021-11-22 13:09:42 +0100712 EquinixmetalV2 child deploy in a separate metro scheduled: ${equinixMetalV2ChildDiffMetro}
Sergey Zhemerdeev019c45a2022-08-13 00:09:07 +0300713 EquinixmetalV2 mgmt will be deployed on the metro: ${equinixMetalV2Metro?:'auto'}
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000714 Equinix@AWS child cluster deployment scheduled: ${equinixOnAwsDemo}
715 Azure provider deployment scheduled: ${azureOnDemandDemo}
716 Azure@AWS child cluster deployment scheduled: ${azureOnAwsDemo}
Ivan Berezovskiyf9bcfd62021-03-18 18:41:38 +0400717 VSPHERE provider deployment scheduled: ${enableVsphereDemo}
Владислав Наумов4eb1da32020-08-31 14:45:16 +0200718 OS provider deployment scheduled: ${enableOSDemo}
Sergey Lalovd0e20852023-08-17 19:11:19 +0400719 BM Core provider deployment scheduled: ${enablebmCoreDemo}
720 BM Core type deplyment: ${bmDeployType}
721 BM Core cleanup: ${bmCoreCleanup}
azvyagintsev1761bdc2020-09-04 17:24:12 +0300722 BM provider deployment scheduled: ${enableBMDemo}
Alexandr Lovtsov36473f32022-04-28 15:46:09 +0300723 Ubuntu on vSphere scheduled: ${enableVsphereUbuntu}
Ivan Berezovskiy30c4b122023-11-06 18:03:18 +0500724 RHEL on vSphere scheduled: ${enableVsphereRHEL}
Mikhail Ivanovbd1a9fd2022-03-29 21:36:21 +0400725 Artifacts build scheduled: ${enableArtifactsBuild}
Sergey Zhemerdeeve67fb262022-06-21 00:49:34 +0300726 Boot OS child from Ceph volumes: ${childOsBootFromVolume}
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000727 Multiregional configuration: ${multiregionalMappings}
vnaumov33747e12020-05-04 17:35:20 +0200728 Service binaries fetching scheduled: ${fetchServiceBinaries}
Владислав Наумов74e2d6e2020-12-30 17:05:40 +0100729 Current weight of the demo run: ${demoWeight} (Used to manage lockable resources)
Ivan Berezovskiy29e72b72022-07-12 21:03:24 +0400730 Bootstrap v2 scenario enabled: ${bootstrapV2Scenario}
Mikhail Ivanov3088d3d2022-10-24 14:05:46 +0400731 FIPS enabled: ${enableFips}
Sergey Lalov00bea0f2023-08-14 16:46:33 +0400732 MKE DEBUG enabled: ${enableMkeDebug}
Sergey Lalovbc68d752022-11-08 13:40:53 +0400733 Pause for debug enabled: ${pauseForDebug}
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300734 AIO cluster: ${aioCluster}
Sergey Lalov22d05592024-10-29 17:06:50 +0400735 Docker services check skip: ${dockerServicesCheckSkip}
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100736 Use Vsphere VVMT Objects: ${useVsphereVvmtObjects}
vryzhenkin4fd3f242023-03-29 15:13:46 +0400737 Bootsrap v2 smoke checks enabled: ${enableBv2Smoke}
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400738 Run Cache warmup for child clusters: ${runCacheWarmup}
vryzhenkin211a4e82023-11-23 12:48:27 +0400739 CVE Scan enabled: ${cveScan}
vryzhenkina8d74e72024-02-26 14:59:37 +0400740 Keycloak+LDAP integration enabled: ${coreKeycloakLdap}
Viktor Astakhovadfcfb52024-05-16 16:56:21 +0400741 NTP update job scheduled: ${runNTPUpdateTest}
Viktor Astakhov8da448c2024-06-14 14:59:32 +0400742 MCC MariaDB Backup/Restore test enabled: ${runMCCMariaBackupRestoreTest}
Sergey Kolekonov75148432024-07-16 13:22:36 +0500743 Sync to public-ci CDN enabled: ${publicCISync}
Viktor Astakhov4fda2672024-08-29 16:38:25 +0400744 Mgmt runtime migration (extended) enabled: ${runRuntimeMigrateExtendedTestMgmt}
745 Mgmt runtime migration (quick) enabled: ${runRuntimeMigrateQuickTestMgmt}
746 Mgmt runtime migration (extended) with rollback enabled: ${runRuntimeMigrateAndRollbackTestMgmt}
747 Child runtime migration (extended) enabled: ${runRuntimeMigrateExtendedTestChild}
748 Child runtime migration (quick) enabled: ${runRuntimeMigrateQuickTestChild}
749 Child runtime migration (extended) with rollback enabled: ${runRuntimeMigrateAndRollbackTestChild}
Viktor Astakhov8068bee2024-11-15 18:38:10 +0400750 Child Upgrade via update plan with sequental steps enabled: ${upgradeChildPlanSeq}
751 Child Upgrade via update plan with bulk steps enabled: ${upgradeChildPlanBulk}
Владислав Наумов81777472021-03-09 15:14:27 +0400752 Triggers: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
vnaumov33747e12020-05-04 17:35:20 +0200753 return [
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300754 osCloudLocation : openstackIMC,
755 cdnConfig : cdnConfig,
756 proxyConfig : proxyConfig,
757 useMacOsSeedNode : seedMacOs,
758 deployChildEnabled : deployChild,
759 childDeployCustomRelease : customChildRelease,
760 upgradeChildEnabled : upgradeChild,
761 fullUpgradeChildEnabled : fullUpgradeChild,
762 mosDeployChildEnabled : mosDeployChild,
763 mosUpgradeChildEnabled : mosUpgradeChild,
764 runChildConformanceEnabled : runChildConformance,
Sergey Lalovafcc0432023-04-13 14:59:06 +0400765 runChildConformanceNetworkPolicyEnabled : runChildConformanceNetworkPolicy,
vryzhenkinb286bd82023-04-04 07:17:52 +0400766 runChildHPAEnabled : runChildHPA,
Sergey Lalov012496a2023-11-27 15:57:52 +0400767 runChildStacklightHaEnabled : runChildStacklightHa,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300768 attachBYOEnabled : attachBYO,
769 upgradeBYOEnabled : upgradeBYO,
770 runBYOMatrixEnabled : runBYOMatrix,
771 defaultBYOOs : defaultBYOOs,
772 upgradeMgmtEnabled : upgradeMgmt,
773 autoUpgradeMgmtEnabled : autoUpgradeMgmt,
774 enableLMALoggingEnabled : enableLMALogging,
775 deployOsOnMosEnabled : deployOsOnMos,
776 runUie2eEnabled : runUie2e,
777 runUie2eNewEnabled : runUie2eNew,
778 runMgmtConformanceEnabled : runMgmtConformance,
Sergey Lalovafcc0432023-04-13 14:59:06 +0400779 runMgmtConformanceNetworkPolicyEnabled : runMgmtConformanceNetworkPolicy,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300780 runMaintenanceTestEnabled : runMaintenanceTest,
781 runContainerregistryTestEnabled : runContainerregistryTest,
782 runGracefulRebootTestEnabled : runGracefulRebootTest,
783 pauseForDebugEnabled : pauseForDebug,
784 runMgmtDeleteMasterTestEnabled : runMgmtDeleteMasterTest,
785 runRgnlDeleteMasterTestEnabled : runRgnlDeleteMasterTest,
786 runChildDeleteMasterTestEnabled : runChildDeleteMasterTest,
Sergey Lalovd5efcd52023-03-01 22:42:17 +0400787 runChildCustomCertTestEnabled : runChildCustomCertTest,
Sergey Lalov7c2377e2023-12-15 23:14:45 +0400788 customSlackChannelEnabled : customSlackChannel,
Sergey Lalovf6fbfea2023-04-06 17:05:40 +0400789 runMgmtCustomCacheCertTestEnabled : runMgmtCustomCacheCertTest,
Sergey Lalov48e69022023-07-25 16:08:00 +0400790 runMkeCustomCertTestEnabled : runMkeCustomCertTest,
Sergey Lalov62c28312023-10-18 19:23:59 +0400791 runCustomHostnamesEnabled : runCustomHostnames,
vryzhenkin504dfc92023-11-01 15:49:47 +0400792 slLatestEnabled : slLatest,
Sergey Lalov430fcd72023-03-20 17:19:44 +0400793 runByoChildCustomCertTestEnabled : runByoChildCustomCertTest,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300794 runChildMachineDeletionPolicyTestEnabled : runChildMachineDeletionPolicyTest,
795 runLMATestEnabled : runLMATest,
796 runMgmtUserControllerTestEnabled : runMgmtUserControllerTest,
797 runProxyChildTestEnabled : runProxyChildTest,
798 fetchServiceBinariesEnabled : fetchServiceBinaries,
799 awsOnDemandDemoEnabled : awsOnDemandDemo,
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000800 equinixOnDemandDemoEnabled : equinixOnDemandDemo,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300801 equinixMetalV2OnDemandDemoEnabled : equinixMetalV2OnDemandDemo,
802 equinixMetalV2ChildDiffMetroEnabled : equinixMetalV2ChildDiffMetro,
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000803 equinixOnAwsDemoEnabled : equinixOnAwsDemo,
804 azureOnDemandDemoEnabled : azureOnDemandDemo,
805 azureOnAwsDemoEnabled : azureOnAwsDemo,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300806 vsphereDemoEnabled : enableVsphereDemo,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300807 bmDemoEnabled : enableBMDemo,
Sergey Lalovd0e20852023-08-17 19:11:19 +0400808 bmCoreDemoEnabled : enablebmCoreDemo,
809 bmCoreCleanup : bmCoreCleanup,
Sergey Lalov4ea2cbc2024-04-04 21:41:47 +0400810 bmDeployType : bmDeployType,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300811 osDemoEnabled : enableOSDemo,
812 vsphereUbuntuEnabled : enableVsphereUbuntu,
Ivan Berezovskiy30c4b122023-11-06 18:03:18 +0500813 vsphereRHELEnabled : enableVsphereRHEL,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300814 artifactsBuildEnabled : enableArtifactsBuild,
815 childOsBootFromVolume : childOsBootFromVolume,
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000816 multiregionalConfiguration : multiregionalMappings,
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +0300817 demoWeight : demoWeight,
818 bootstrapV2Scenario : bootstrapV2Scenario,
819 equinixMetalV2Metro : equinixMetalV2Metro,
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +0300820 enableFips : enableFips,
Sergey Lalov00bea0f2023-08-14 16:46:33 +0400821 enableMkeDebugEnabled : enableMkeDebug,
Mikhail Morgoev58855c12023-02-10 14:57:31 +0100822 aioCluster : aioCluster,
Sergey Lalov22d05592024-10-29 17:06:50 +0400823 dockerServicesCheckSkip : dockerServicesCheckSkip,
vryzhenkin4fd3f242023-03-29 15:13:46 +0400824 useVsphereVvmtObjects : useVsphereVvmtObjects,
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400825 bv2SmokeEnabled : enableBv2Smoke,
826 runCacheWarmup : runCacheWarmup,
vryzhenkin211a4e82023-11-23 12:48:27 +0400827 cveScanEnabled : cveScan,
Sergey Lalovd7593ab2024-01-11 13:40:13 +0400828 disableKubeApiAudit : disableKubeApiAudit,
Sergey Lalov26e24c22024-03-20 13:47:31 +0400829 auditdEnabled : auditd,
vryzhenkina8d74e72024-02-26 14:59:37 +0400830 coreKeycloakLdapEnabled : coreKeycloakLdap,
vryzhenkine0ff1d82024-03-18 15:08:09 +0400831 internalNTPServersEnabled : configureInternalNTP,
Viktor Astakhovadfcfb52024-05-16 16:56:21 +0400832 runNTPUpdateTestEnabled : runNTPUpdateTest,
Viktor Astakhov8da448c2024-06-14 14:59:32 +0400833 runMCCMariaBackupRestoreTestEnabled : runMCCMariaBackupRestoreTest,
Sergey Kolekonov75148432024-07-16 13:22:36 +0500834 publicCISyncEnabled : publicCISync,
Viktor Astakhov4fda2672024-08-29 16:38:25 +0400835 runtimeMigrateExtendedMgmtEnabled : runRuntimeMigrateExtendedTestMgmt,
836 runtimeMigrateQuickMgmtEnabled : runRuntimeMigrateQuickTestMgmt,
837 runtimeMigrateMgmtAndRollbackEnabled : runRuntimeMigrateAndRollbackTestMgmt,
838 runtimeMigrateExtendedChildEnabled : runRuntimeMigrateExtendedTestChild,
839 runtimeMigrateQuickChildEnabled : runRuntimeMigrateQuickTestChild,
840 runtimeMigrateChildAndRollbackEnabled : runRuntimeMigrateAndRollbackTestChild,
Viktor Astakhov8068bee2024-11-15 18:38:10 +0400841 upgradeChildPlanSeqEnabled : upgradeChildPlanSeq,
842 upgradeChildPlanBulkEnabled : upgradeChildPlanBulk,
Ivan Berezovskiy02baa982023-06-06 12:46:27 +0400843 ]
Владислав Наумов765f3bd2020-09-07 18:09:24 +0200844}
845
Sergey Kolekonovd6a17392024-02-06 15:57:53 +0000846/**
847 * Determine management and regional setup for demo workflow scenario
848 *
849 *
850 * @param: keyword (string) string , represents keyword trigger, specified in gerrit commit body, like `[multiregion aws,os]`
851 or Jenkins environment string variable in form like 'aws,os'
852 * @return (map)[
853 enabled: (bool),
854 * managementLocation: (string), //aws,os
855 * regionLocation: (string), //aws,os
856 * ]
857 */
858def multiregionWorkflowParser(keyword) {
859 def common = new com.mirantis.mk.Common()
860 def supportedManagementProviders = ['os', 'aws', 'vsphere', 'equinix', 'equinixmetalv2', 'azure']
861 def supportedRegionalProviders = ['os', 'vsphere', 'equinix', 'equinixmetalv2', 'bm', 'azure', 'aws']
862
863 def clusterTypes = ''
864 if (keyword.toString().contains('multiregion')) {
865 common.infoMsg('Multiregion definition configured via gerrit keyword trigger')
866 clusterTypes = keyword[0][0].split('multiregion')[1].replaceAll('[\\[\\]]', '').trim().split(',')
867 } else {
868 common.infoMsg('Multiregion definition configured via environment variable')
869 clusterTypes = keyword.trim().split(',')
870 }
871
872 if (clusterTypes.size() != 2) {
873 error("Incorrect regions definiton, valid scheme: [multiregion ${management}, ${region}], got: ${clusterTypes}")
874 }
875
876 def desiredManagementProvider = clusterTypes[0].trim()
877 def desiredRegionalProvider = clusterTypes[1].trim()
878 if (! supportedManagementProviders.contains(desiredManagementProvider) || ! supportedRegionalProviders.contains(desiredRegionalProvider)) {
879 error("""unsupported management <-> regional bundle, available options:
880 management providers list - ${supportedManagementProviders}
881 regional providers list - ${supportedRegionalProviders}""")
882 }
883
884 return [
885 enabled: true,
886 managementLocation: desiredManagementProvider,
887 regionLocation: desiredRegionalProvider,
888 ]
889}
vnaumov33747e12020-05-04 17:35:20 +0200890
891/**
892 * Determine if custom si tests/pipelines refspec forwarded from gerrit change request
893
Владислав Наумов81777472021-03-09 15:14:27 +0400894 * 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 +0200895 * Used for components team to test component changes w/ custom SI refspecs using kaas/core deployment jobs
896 * Example scheme:
897 * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core
898 * manage refspecs through Jenkins Job Parameters
899 *
azvyagintseva12230a2020-06-05 13:24:06 +0300900 * @return (map)[* siTests: (string) final refspec for si-tests
vnaumov33747e12020-05-04 17:35:20 +0200901 * siPipelines: (string) final refspec for si-pipelines
902 * ]
903 */
904def checkCustomSIRefspec() {
vnaumovbdb90222020-05-04 18:25:50 +0200905 def common = new com.mirantis.mk.Common()
906
vnaumov33747e12020-05-04 17:35:20 +0200907 // Available triggers and its sane defaults
Владислав Наумов6c2afff2020-06-05 12:54:53 +0200908 def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master'
909 def siPipelinesRefspec = env.SI_PIPELINES_REFSPEC ?: 'master'
Владислав Наумов2db15e22020-07-14 12:29:22 +0200910 def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test'
911 def siTestsDockerImageTag = env.SI_TESTS_DOCKER_IMAGE_TAG ?: 'master'
Владислав Наумов6c2afff2020-06-05 12:54:53 +0200912 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
vnaumov33747e12020-05-04 17:35:20 +0200913
914 def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/)
915 def siPipelinesMatches = (commitMsg =~ /(\[si-pipelines-ref\s*refs\/changes\/.*?\])/)
916
917 if (siTestMatches.size() > 0) {
918 siTestsRefspec = siTestMatches[0][0].split('si-tests-ref')[1].replaceAll('[\\[\\]]', '').trim()
Владислав Наумов7f6c0882021-03-23 19:10:57 +0400919 siTestsDockerImage = "docker-review-local.docker.mirantis.net/review/kaas-si-test-${siTestsRefspec.split('/')[-2]}"
Владислав Наумов2db15e22020-07-14 12:29:22 +0200920 siTestsDockerImageTag = siTestsRefspec.split('/')[-1]
vnaumov33747e12020-05-04 17:35:20 +0200921 }
922 if (siPipelinesMatches.size() > 0) {
923 siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim()
924 }
925
926 common.infoMsg("""
927 kaas/si-pipelines will be fetched from: ${siPipelinesRefspec}
928 kaas/si-tests will be fetched from: ${siTestsRefspec}
Владислав Наумов2db15e22020-07-14 12:29:22 +0200929 kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}:${siTestsDockerImageTag}
Владислав Наумов81777472021-03-09 15:14:27 +0400930 Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
Владислав Наумов2db15e22020-07-14 12:29:22 +0200931 return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage, siTestsDockerImageTag: siTestsDockerImageTag]
vnaumov33747e12020-05-04 17:35:20 +0200932}
Владислав Наумов2a982ff2020-06-02 19:06:46 +0200933
Владислав Наумов9080f372020-06-08 13:57:16 +0200934/**
Владислав Наумов418042b2020-07-09 18:31:10 +0200935 * Parse additional configuration for kaas component CICD repo
Владислав Наумов30a516c2020-07-09 13:15:41 +0200936 * @param configurationFile (str) path to configuration file in yaml format
937 *
938 * @return (map)[ siTestsFeatureFlags (string) dedicated feature flags that will be used in SI tests,
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300939 * siTestsFeatureFlagsStable (string) dedicated feature flags that will be used in SI tests for deploying stable release
Владислав Наумов30a516c2020-07-09 13:15:41 +0200940 * ]
941 */
942def parseKaaSComponentCIParameters(configurationFile){
943 def common = new com.mirantis.mk.Common()
944 def ciConfig = readYaml file: configurationFile
945 def ciSpec = [
946 siTestsFeatureFlags: env.SI_TESTS_FEATURE_FLAGS ?: '',
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300947 siTestsFeatureFlagsStable: env.SI_TESTS_FEATURE_FLAGS_STABLE ?: '',
Владислав Наумов30a516c2020-07-09 13:15:41 +0200948 ]
949
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300950 // If exists and not empty
951 if (ciConfig.getOrDefault('si-tests-feature-flags', [])) {
Владислав Наумов30a516c2020-07-09 13:15:41 +0200952 common.infoMsg("""SI tests feature flags customization detected,
953 results will be merged with existing flags: [${ciSpec['siTestsFeatureFlags']}] identification...""")
954
955 def ffMeta = ciSpec['siTestsFeatureFlags'].tokenize(',').collect { it.trim() }
956 ffMeta.addAll(ciConfig['si-tests-feature-flags'])
Владислав Наумов30a516c2020-07-09 13:15:41 +0200957
Владислав Наумовcb5ffca2020-07-14 15:28:36 +0200958 ciSpec['siTestsFeatureFlags'] = ffMeta.unique().join(',')
Владислав Наумов30a516c2020-07-09 13:15:41 +0200959 common.infoMsg("SI tests custom feature flags: ${ciSpec['siTestsFeatureFlags']}")
960 }
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300961 if (ciConfig.getOrDefault('si-tests-feature-flags-stable', [])) {
962 common.infoMsg("""SI tests feature flags for stable release customization detected,
963 results will be merged with existing flags: [${ciSpec['siTestsFeatureFlagsStable']}] identification...""")
964
965 def ffMeta = ciSpec['siTestsFeatureFlagsStable'].tokenize(',').collect { it.trim() }
966 ffMeta.addAll(ciConfig['si-tests-feature-flags-stable'])
967
968 ciSpec['siTestsFeatureFlagsStable'] = ffMeta.unique().join(',')
969 common.infoMsg("SI tests custom feature flags for stable release: ${ciSpec['siTestsFeatureFlagsStable']}")
970 }
Владислав Наумов30a516c2020-07-09 13:15:41 +0200971
972 common.infoMsg("""Additional ci configuration parsed successfully:
Alexandr Lovtsov1c78e452022-08-29 20:57:51 +0300973 siTestsFeatureFlags: ${ciSpec['siTestsFeatureFlags']}
974 siTestsFeatureFlagsStable: ${ciSpec['siTestsFeatureFlagsStable']}""")
Владислав Наумов30a516c2020-07-09 13:15:41 +0200975 return ciSpec
976}
977
978/**
979 * Determine if custom kaas core/pipelines refspec forwarded from gerrit change request
Владислав Наумов9080f372020-06-08 13:57:16 +0200980
Владислав Наумов81777472021-03-09 15:14:27 +0400981 * 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 +0200982 * Used for components team to test component changes w/ custom Core refspecs using kaas/core deployment jobs
983 * Example scheme:
984 * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core
985 * manage refspecs through Jenkins Job Parameters
986 *
987 * @return (map)[ core: (string) final refspec for kaas/core
988 * corePipelines: (string) final refspec for pipelines in kaas/core
989 * ]
990 */
991def checkCustomCoreRefspec() {
992 def common = new com.mirantis.mk.Common()
993
994 // Available triggers and its sane defaults
995 def coreRefspec = env.KAAS_CORE_REFSPEC ?: 'master'
996 // by default using value of GERRIT_REFSPEC parameter in *kaas/core jobs*
997 def corePipelinesRefspec = env.KAAS_PIPELINE_REFSPEC ?: '\$GERRIT_REFSPEC'
998 def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
999
1000 def coreMatches = (commitMsg =~ /(\[core-ref\s*refs\/changes\/.*?\])/)
1001 def corePipelinesMatches = (commitMsg =~ /(\[core-pipelines-ref\s*refs\/changes\/.*?\])/)
1002
1003 if (coreMatches.size() > 0) {
1004 coreRefspec = coreMatches[0][0].split('core-ref')[1].replaceAll('[\\[\\]]', '').trim()
1005 }
1006 if (corePipelinesMatches.size() > 0) {
1007 corePipelinesRefspec = corePipelinesMatches[0][0].split('core-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim()
1008 }
1009
1010 common.infoMsg("""
1011 kaas/core will be fetched from: ${coreRefspec}
1012 kaas/core pipelines will be fetched from: ${corePipelinesRefspec}
Владислав Наумов81777472021-03-09 15:14:27 +04001013 Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
Владислав Наумов9080f372020-06-08 13:57:16 +02001014 return [core: coreRefspec, corePipelines: corePipelinesRefspec]
1015}
1016
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001017
1018/**
Владислав Наумов92288d92020-07-13 18:36:21 +02001019 * generate Jenkins Parameter objects from from text parameter with additonal kaas core context
1020 * needed to forward inside kaas core set of jobs
1021 *
1022 * @param context (string) Representation of the string enviroment variables needed for kaas core jobs in yaml format
1023 * @return (list)[ string(name: '', value: ''),
1024 * ]
1025 */
1026def generateKaaSVarsFromContext(context) {
1027 def common = new com.mirantis.mk.Common()
1028 def parameters = []
1029 def config = readYaml text: context
1030
1031 config.each { k,v ->
1032 common.infoMsg("Custom KaaS Core context parameter: ${k}=${v}")
1033 parameters.add(string(name: k, value: v))
1034 }
1035
1036 return parameters
1037}
1038
1039/**
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001040 * 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 +04001041 * 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 +02001042 * Used for components team to test component changes w/ customized SI tests/refspecs using kaas/core deployment jobs
1043 *
Владислав Наумов418042b2020-07-09 18:31:10 +02001044 * @param: component (string) component name [iam, lcm, stacklight]
1045 * @param: patchSpec (string) Patch for kaas/cluster releases in json format
1046 * @param: configurationFile (string) Additional file for component repo CI config in yaml format
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001047 */
Владислав Наумов92288d92020-07-13 18:36:21 +02001048def triggerPatchedComponentDemo(component, patchSpec = '', configurationFile = '.ci-parameters.yaml', coreContext = '') {
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001049 def common = new com.mirantis.mk.Common()
1050 // Determine if custom trigger keywords forwarded from gerrit
1051 def triggers = checkDeploymentTestSuite()
1052 // Determine SI refspecs
1053 def siRefspec = checkCustomSIRefspec()
Владислав Наумов9080f372020-06-08 13:57:16 +02001054 // Determine Core refspecs
1055 def coreRefspec = checkCustomCoreRefspec()
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001056
Владислав Наумов418042b2020-07-09 18:31:10 +02001057 // Determine component repo ci configuration
1058 def ciSpec = [:]
1059 def componentFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: ''
1060 if (fileExists(configurationFile)) {
1061 common.infoMsg('Component CI configuration file detected, parsing...')
1062 ciSpec = parseKaaSComponentCIParameters(configurationFile)
1063 componentFeatureFlags = ciSpec['siTestsFeatureFlags']
1064 } else {
1065 common.warningMsg('''Component CI configuration file is not exists,
Владислав Наумовc17dd552020-07-29 17:07:38 +02001066 several code-management features may be unavailable,
Владислав Наумов92288d92020-07-13 18:36:21 +02001067 follow https://mirantis.jira.com/wiki/spaces/QA/pages/2310832276/SI-tests+feature+flags#%5BUpdated%5D-Using-a-feature-flag
1068 to create the configuration file''')
Владислав Наумов418042b2020-07-09 18:31:10 +02001069 }
Ivan Berezovskiy91ede502021-05-13 21:05:36 +04001070
1071 def platforms = []
1072 if (component == 'ipam' && triggers.vsphereDemoEnabled) {
1073 // Currently only vsphere demo is required for IPAM component
1074 platforms.add('vsphere')
1075 } else {
1076 if (triggers.osDemoEnabled) {
1077 platforms.add('openstack')
1078 }
1079 if (triggers.awsOnDemandDemoEnabled) {
1080 platforms.add('aws')
1081 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001082 if (triggers.equinixOnDemandDemoEnabled) {
1083 platforms.add('equinix')
1084 }
Владислав Наумов144956f2021-10-14 17:49:19 +02001085 if (triggers.equinixMetalV2OnDemandDemoEnabled) {
1086 platforms.add('equinixmetalv2')
1087 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001088 if (triggers.azureOnDemandDemoEnabled) {
1089 platforms.add('azure')
1090 }
Ivan Berezovskiyb0229d02021-05-17 16:55:18 +04001091 if (triggers.vsphereDemoEnabled) {
1092 platforms.add('vsphere')
1093 }
Sergey Kolekonov8e4de182024-03-05 15:07:07 +05001094 if (triggers.bmCoreDemoEnabled) {
1095 platforms.add('bm')
1096 }
Ivan Berezovskiy91ede502021-05-13 21:05:36 +04001097 }
1098
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001099 def jobs = [:]
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001100 def parameters = [
Владислав Наумов9080f372020-06-08 13:57:16 +02001101 string(name: 'GERRIT_REFSPEC', value: coreRefspec.core),
1102 string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines),
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001103 string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests),
Владислав Наумов418042b2020-07-09 18:31:10 +02001104 string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags),
Владислав Наумов2db15e22020-07-14 12:29:22 +02001105 string(name: 'SI_TESTS_DOCKER_IMAGE', value: siRefspec.siTestsDockerImage),
1106 string(name: 'SI_TESTS_DOCKER_IMAGE_TAG', value: siRefspec.siTestsDockerImageTag),
Владислав Наумов4a5c3242020-06-08 14:36:11 +02001107 string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines),
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001108 string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec),
Mikhail Ivanov74504372021-05-21 17:01:06 +04001109 string(name: 'KAAS_CHILD_CLUSTER_RELEASE_NAME', value: triggers.childDeployCustomRelease),
Mikhail Ivanovb6283f72021-11-24 18:34:57 +04001110 string(name: 'OPENSTACK_CLOUD_LOCATION', value: triggers.osCloudLocation),
Sergey Lalov7c2377e2023-12-15 23:14:45 +04001111 string(name: 'SLACK_CHANNEL_NOTIFY', value: triggers.customSlackChannelEnabled),
Sergey Lalov4ea2cbc2024-04-04 21:41:47 +04001112 string(name: 'BM_DEPLOY_TYPE', value: triggers.bmDeployType),
Владислав Наумовb8305e22021-02-10 17:23:12 +01001113 booleanParam(name: 'OFFLINE_MGMT_CLUSTER', value: triggers.proxyConfig['mgmtOffline']),
Владислав Наумовf8f23fa2021-04-01 16:57:52 +02001114 booleanParam(name: 'OFFLINE_CHILD_CLUSTER', value: triggers.proxyConfig['childOffline']),
Владислав Наумов257ea132021-04-14 14:44:13 +02001115 booleanParam(name: 'PROXY_CHILD_CLUSTER', value: triggers.proxyConfig['childProxy']),
Владислав Наумов44c64b72020-12-04 20:22:53 +01001116 booleanParam(name: 'SEED_MACOS', value: triggers.useMacOsSeedNode),
Владислав Наумов080d9412020-07-29 13:05:14 +02001117 booleanParam(name: 'UPGRADE_MGMT_CLUSTER', value: triggers.upgradeMgmtEnabled),
slalov1202bba2022-04-20 22:31:07 +04001118 booleanParam(name: 'AUTO_UPGRADE_MCC', value: triggers.autoUpgradeMgmtEnabled),
Victor Ryzhenkind2b7b662021-08-23 14:18:38 +04001119 booleanParam(name: 'ENABLE_LMA_LOGGING', value: triggers.enableLMALoggingEnabled),
Sergey Kolekonov75861642024-10-28 18:38:15 +05001120 booleanParam(name: 'DEPLOY_MOS_CHILD_CLUSTER', value: triggers.mosDeployChildEnabled),
Sergey Lalovb2f60372022-09-20 23:58:47 +04001121 booleanParam(name: 'DEPLOY_OS_ON_MOS', value: triggers.deployOsOnMosEnabled),
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001122 booleanParam(name: 'RUN_UI_E2E', value: triggers.runUie2eEnabled),
Владислав Наумов080d9412020-07-29 13:05:14 +02001123 booleanParam(name: 'RUN_MGMT_CFM', value: triggers.runMgmtConformanceEnabled),
Sergey Lalovafcc0432023-04-13 14:59:06 +04001124 booleanParam(name: 'RUN_MGMT_CFM_NETWORK_POLICY', value: triggers.runMgmtConformanceNetworkPolicyEnabled),
slalov0a4947a2022-06-09 15:44:35 +04001125 booleanParam(name: 'RUN_MAINTENANCE_TEST', value: triggers.runMaintenanceTestEnabled),
1126 booleanParam(name: 'RUN_CONTAINER_REGISTRY_TEST', value: triggers.runContainerregistryTestEnabled),
Mikhail Nikolaenko7e632cd2022-10-24 16:20:31 +03001127 booleanParam(name: 'RUN_GRACEFUL_REBOOT_TEST', value: triggers.runGracefulRebootTestEnabled),
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +03001128 booleanParam(name: 'RUN_MGMT_DELETE_MASTER_TEST', value: triggers.runMgmtDeleteMasterTestEnabled),
1129 booleanParam(name: 'RUN_RGNL_DELETE_MASTER_TEST', value: triggers.runRgnlDeleteMasterTestEnabled),
1130 booleanParam(name: 'RUN_CHILD_DELETE_MASTER_TEST', value: triggers.runChildDeleteMasterTestEnabled),
Sergey Lalovd5efcd52023-03-01 22:42:17 +04001131 booleanParam(name: 'RUN_CHILD_CUSTOM_CERT_TEST', value: triggers.runChildCustomCertTestEnabled),
Sergey Lalovf6fbfea2023-04-06 17:05:40 +04001132 booleanParam(name: 'RUN_MGMT_CUSTOM_CACHE_CERT_TEST', value: triggers.runMgmtCustomCacheCertTestEnabled),
Sergey Lalov48e69022023-07-25 16:08:00 +04001133 booleanParam(name: 'RUN_MKE_CUSTOM_CERT_TEST', value: triggers.runMkeCustomCertTestEnabled),
Sergey Lalov62c28312023-10-18 19:23:59 +04001134 booleanParam(name: 'RUN_CUSTOM_HOSTNAMES', value: triggers.runCustomHostnamesEnabled),
vryzhenkin504dfc92023-11-01 15:49:47 +04001135 booleanParam(name: 'SL_LATEST', value: triggers.slLatestEnabled),
Sergey Lalov430fcd72023-03-20 17:19:44 +04001136 booleanParam(name: 'RUN_BYO_CHILD_CUSTOM_CERT_TEST', value: triggers.runByoChildCustomCertTestEnabled),
Dmitriy Kasyanov43cb06e2022-08-17 14:35:39 +03001137 booleanParam(name: 'RUN_CHILD_MACHINE_DELETION_POLICY_TEST', value: triggers.runChildMachineDeletionPolicyTestEnabled),
Владислав Наумов9cec55d2021-08-03 15:00:59 +02001138 booleanParam(name: 'RUN_LMA_TEST', value: triggers.runLMATestEnabled),
Vladyslav Drokc4f9c1b2021-07-22 15:34:24 +02001139 booleanParam(name: 'RUN_MGMT_USER_CONTROLLER_TEST', value: triggers.runMgmtUserControllerTestEnabled),
Владислав Наумов080d9412020-07-29 13:05:14 +02001140 booleanParam(name: 'DEPLOY_CHILD_CLUSTER', value: triggers.deployChildEnabled),
1141 booleanParam(name: 'UPGRADE_CHILD_CLUSTER', value: triggers.upgradeChildEnabled),
Sergey Lalovc1cb49f2022-09-27 01:16:25 +04001142 booleanParam(name: 'FULL_UPGRADE_CHILD_CLUSTER', value: triggers.fullUpgradeChildEnabled),
slalov574123e2022-04-06 17:24:19 +04001143 booleanParam(name: 'RUN_PROXY_CHILD_TEST', value: triggers.runProxyChildTestEnabled),
Владислав Наумов0dc99252020-11-13 13:30:48 +01001144 booleanParam(name: 'ATTACH_BYO', value: triggers.attachBYOEnabled),
Владислав Наумовcdbd84e2020-12-01 16:51:09 +01001145 booleanParam(name: 'UPGRADE_BYO', value: triggers.upgradeBYOEnabled),
Vladislav Naumov7930ab22021-11-22 18:24:24 +01001146 booleanParam(name: 'RUN_BYO_MATRIX', value: triggers.runBYOMatrixEnabled),
Владислав Наумов080d9412020-07-29 13:05:14 +02001147 booleanParam(name: 'RUN_CHILD_CFM', value: triggers.runChildConformanceEnabled),
Sergey Lalovafcc0432023-04-13 14:59:06 +04001148 booleanParam(name: 'RUN_CHILD_CFM_NETPOLICY', value: triggers.runChildConformanceNetworkPolicyEnabled),
vryzhenkinb286bd82023-04-04 07:17:52 +04001149 booleanParam(name: 'RUN_CHILD_HPA', value: triggers.runChildHPAEnabled),
Sergey Lalov012496a2023-11-27 15:57:52 +04001150 booleanParam(name: 'RUN_STACKLIGHT_CHILD_HA', value: triggers.runChildStacklightHaEnabled),
Ivan Berezovskiycbf9eeb2021-03-22 15:57:32 +04001151 booleanParam(name: 'ALLOW_AWS_ON_DEMAND', value: triggers.awsOnDemandDemoEnabled),
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001152 booleanParam(name: 'ALLOW_EQUINIX_ON_DEMAND', value: triggers.equinixOnDemandDemoEnabled),
Владислав Наумов82305e92021-10-14 20:45:20 +02001153 booleanParam(name: 'ALLOW_EQUINIXMETALV2_ON_DEMAND', value: triggers.equinixMetalV2OnDemandDemoEnabled),
Vladislav Naumov42b71dc2021-11-22 13:09:42 +01001154 booleanParam(name: 'EQUINIXMETALV2_CHILD_DIFF_METRO', value: triggers.equinixMetalV2ChildDiffMetroEnabled),
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001155 booleanParam(name: 'EQUINIX_ON_AWS_DEMO', value: triggers.equinixOnAwsDemoEnabled),
1156 booleanParam(name: 'ALLOW_AZURE_ON_DEMAND', value: triggers.azureOnDemandDemoEnabled),
1157 booleanParam(name: 'AZURE_ON_AWS_DEMO', value: triggers.azureOnAwsDemoEnabled),
Sergey Lalovc63259f2024-01-28 16:52:30 +04001158 booleanParam(name: 'ALLOW_BM_CORE_ON_DEMAND', value: triggers.bmCoreDemoEnabled),
Sergey Zhemerdeev9074f6e2022-06-07 12:03:16 +03001159 booleanParam(name: 'VSPHERE_DEPLOY_UBUNTU', value: triggers.vsphereUbuntuEnabled),
Sergey Lalovbc68d752022-11-08 13:40:53 +04001160 booleanParam(name: 'PAUSE_FOR_DEBUG', value: triggers.pauseForDebugEnabled),
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +03001161 booleanParam(name: 'ENABLE_FIPS', value: triggers.enableFips),
Sergey Lalov00bea0f2023-08-14 16:46:33 +04001162 booleanParam(name: 'ENABLE_MKE_DUBUG', value: triggers.enableMkeDebugEnabled),
Mikhail Nikolaenkoc36dea92022-12-12 02:40:40 +03001163 booleanParam(name: 'AIO_CLUSTER', value: triggers.aioCluster),
Sergey Lalov22d05592024-10-29 17:06:50 +04001164 booleanParam(name: 'DOCKER_SERVICES_CHECK_SKIP', value: triggers.dockerServicesCheckSkip),
Sergey Lalovd0e20852023-08-17 19:11:19 +04001165 booleanParam(name: 'BM_CORE_CLEANUP', value: triggers.bmCoreCleanup),
Sergey Lalovd7593ab2024-01-11 13:40:13 +04001166 booleanParam(name: 'DISABLE_KUBE_API_AUDIT', value: triggers.disableKubeApiAudit),
Sergey Lalovf44cbb72024-03-27 15:19:24 +04001167 booleanParam(name: "AUDITD_ENABLE", value: triggers.auditdEnabled),
vryzhenkine0ff1d82024-03-18 15:08:09 +04001168 booleanParam(name: 'CORE_KEYCLOAK_LDAP_ENABLED', value: triggers.coreKeycloakLdapEnabled),
Viktor Astakhovadfcfb52024-05-16 16:56:21 +04001169 booleanParam(name: 'CORE_KAAS_NTP_ENABLED', value: triggers.internalNTPServersEnabled),
Viktor Astakhov8da448c2024-06-14 14:59:32 +04001170 booleanParam(name: 'RUN_NTP_UPDATE_TEST', value: triggers.runNTPUpdateTestEnabled),
Viktor Astakhov4fda2672024-08-29 16:38:25 +04001171 booleanParam(name: 'RUN_MCC_MARIA_BACKUP_RESTORE_TEST', value: triggers.runMCCMariaBackupRestoreTestEnabled),
1172 booleanParam(name: 'RUN_MGMT_RUNTIME_MIGRATE_EXTENDED_TEST', value: triggers.runtimeMigrateExtendedMgmtEnabled),
1173 booleanParam(name: 'RUN_MGMT_RUNTIME_MIGRATE_QUICK_TEST', value: triggers.runtimeMigrateQuickMgmtEnabled),
1174 booleanParam(name: 'RUN_MGMT_RUNTIME_MIGRATE_AND_ROLLBACK_TEST', value: triggers.runtimeMigrateMgmtAndRollbackEnabled),
1175 booleanParam(name: 'RUN_CHILD_RUNTIME_MIGRATE_EXTENDED_TEST', value: triggers.runtimeMigrateExtendedChildEnabled),
1176 booleanParam(name: 'RUN_CHILD_RUNTIME_MIGRATE_QUICK_TEST', value: triggers.runtimeMigrateQuickChildEnabled),
1177 booleanParam(name: 'RUN_CHILD_RUNTIME_MIGRATE_AND_ROLLBACK_TEST', value: triggers.runtimeMigrateChildAndRollbackEnabled),
Viktor Astakhov8068bee2024-11-15 18:38:10 +04001178 booleanParam(name: 'UPGRADE_CHILD_PLAN_SEQ', value: triggers.upgradeChildPlanSeqEnabled),
1179 booleanParam(name: 'UPGRADE_CHILD_PLAN_BULK', value: triggers.upgradeChildPlanBulkEnabled),
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001180 ]
Владислав Наумов92288d92020-07-13 18:36:21 +02001181
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001182 // customize multiregional demo
1183 if (triggers.multiregionalConfiguration.enabled) {
1184 parameters.add(string(name: 'MULTIREGION_SETUP',
1185 value: "${triggers.multiregionalConfiguration.managementLocation},${triggers.multiregionalConfiguration.regionLocation}"
1186 ))
1187 }
1188
Владислав Наумов92288d92020-07-13 18:36:21 +02001189 // Determine component team custom context
1190 if (coreContext != '') {
1191 common.infoMsg('Additional KaaS Core context detected, will be forwarded into kaas core cicd...')
1192 def additionalParameters = generateKaaSVarsFromContext(coreContext)
Владислав Наумовbef51a92020-10-01 17:36:51 +02001193 parameters.addAll(additionalParameters)
Владислав Наумов92288d92020-07-13 18:36:21 +02001194 }
1195
Владислав Наумовaa430612020-06-08 17:18:31 +02001196 def jobResults = []
Ivan Berezovskiy91ede502021-05-13 21:05:36 +04001197
1198 platforms.each { platform ->
1199 jobs["kaas-core-${platform}-patched-${component}"] = {
Vladislav Naumov5313a202021-04-07 17:13:39 +00001200 try {
Ivan Berezovskiy91ede502021-05-13 21:05:36 +04001201 common.infoMsg("Deploy: patched KaaS demo with ${platform} provider")
1202 def job_info = build job: "kaas-testing-core-${platform}-workflow-${component}", parameters: parameters, wait: true
1203 def build_description = job_info.getDescription()
1204 def build_result = job_info.getResult()
Vladislav Naumov5313a202021-04-07 17:13:39 +00001205 jobResults.add(build_result)
Владислав Наумовd044e842020-06-17 15:33:43 +02001206
Vladislav Naumov5313a202021-04-07 17:13:39 +00001207 if (build_description) {
1208 currentBuild.description += build_description
1209 }
1210 } finally {
Ivan Berezovskiy91ede502021-05-13 21:05:36 +04001211 common.infoMsg("Patched KaaS demo with ${platform} provider finished")
Vladislav Naumov5313a202021-04-07 17:13:39 +00001212 }
1213 }
1214 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001215
1216 common.infoMsg('Trigger KaaS demo deployments according to defined provider set')
Владислав Наумов37f7f842021-03-09 16:08:39 +04001217 if (jobs.size() == 0) {
1218 error('No demo jobs matched with keywords, execution will be aborted, at least 1 provider should be enabled')
1219 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001220 // Limit build concurency workaround examples: https://issues.jenkins-ci.org/browse/JENKINS-44085
1221 parallel jobs
Владислав Наумовaa430612020-06-08 17:18:31 +02001222
1223 if (jobResults.contains('FAILURE')) {
Владислав Наумовf86b1112020-06-09 14:04:48 +02001224 common.infoMsg('One of parallel downstream jobs is failed, mark executor job as failed')
Владислав Наумовaa430612020-06-08 17:18:31 +02001225 currentBuild.result = 'FAILURE'
1226 }
Владислав Наумов2a982ff2020-06-02 19:06:46 +02001227}
Владислав Наумов30a516c2020-07-09 13:15:41 +02001228
1229
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001230/**
1231 * Function currently supported to be called from aws or vsphere demos. It gets particular demo context
Владислав Наумов33e1e812021-08-17 17:09:25 +02001232 * and generate proper lockResources data and netMap data for vsphere,equinix related clusters.
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001233 *
1234 * @param: callBackDemo (string) Demo which requested to generate lockResources [aws or vsphere]
1235 * @param: triggers (map) Custom trigger keywords forwarded from gerrit
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001236 * @param: multiregionalConfiguration (map) Multiregional configuration
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001237 * @return (map) Return aggregated map with lockResources and netMap
1238 */
1239
1240
1241def generateLockResources(callBackDemo, triggers) {
1242 def common = new com.mirantis.mk.Common()
Владислав Наумов33e1e812021-08-17 17:09:25 +02001243 def netMap = [
1244 vsphere: [:],
1245 equinix: [:],
1246 ]
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001247 // Define vsphere locklabels with initial quantity
1248 def lockLabels = [
1249 vsphere_networking_core_ci: 0,
1250 vsphere_offline_networking_core_ci: 0,
1251 ]
1252 def deployChild = triggers.deployChildEnabled
Sergey Lalov13eea422023-08-21 23:10:17 +04001253 def testUiVsphere = triggers.runUie2eEnabled || triggers.runUie2eNewEnabled
Sergey Lalov900aff42024-03-08 00:05:50 +04001254 def vsphereByo = triggers.attachBYOEnabled
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001255 def multiregionConfig = triggers.multiregionalConfiguration
1256 def runMultiregion = multiregionConfig.enabled
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001257
1258 // Generate vsphere netMap and lockLabels based on demo context
1259 switch (callBackDemo) {
1260 case 'aws':
1261 // Add aws specific lock label with quantity calculated based on single mgmt deploy or mgmt + child
1262 lockLabels['aws_core_ci_queue'] = triggers.demoWeight
Sergey Kolekonovf4c1f492022-02-03 14:44:45 +04001263 if (triggers.runBYOMatrixEnabled) { lockLabels['aws_core_ci_queue'] += 6 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001264
1265 // Define netMap for Vsphere region
1266 if (runMultiregion && multiregionConfig.managementLocation == 'aws') {
1267 if (multiregionConfig.regionLocation == 'vsphere') {
1268 if (deployChild) {
1269 addToProviderNetMap(netMap, 'vsphere', 'regional-child')
1270 }
1271 addToProviderNetMap(netMap, 'vsphere', 'region')
1272 }
1273
1274 if (multiregionConfig.regionLocation == 'azure') {
1275 lockLabels['azure_core_ci_queue'] = 1
1276 if (deployChild) {
1277 lockLabels['azure_core_ci_queue'] += 1
1278 }
1279 }
1280 }
1281 if (triggers.azureOnAwsDemoEnabled) {
1282 lockLabels['azure_core_ci_queue'] = 1
1283 }
1284
1285 if (triggers.equinixOnAwsDemoEnabled) {
1286 lockLabels['equinix_core_ci_queue'] = 1
1287 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001288 break
1289 case 'vsphere':
Владислав Наумов33e1e812021-08-17 17:09:25 +02001290 addToProviderNetMap(netMap, 'vsphere', 'mgmt')
Sergey Lalov900aff42024-03-08 00:05:50 +04001291 if (deployChild || testUiVsphere || vsphereByo) {
Владислав Наумов33e1e812021-08-17 17:09:25 +02001292 addToProviderNetMap(netMap, 'vsphere', 'child')
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001293 }
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001294 if (runMultiregion && multiregionConfig.managementLocation == 'vsphere' &&
1295 multiregionConfig.regionLocation == 'vsphere') {
1296 if (deployChild) {
1297 addToProviderNetMap(netMap, 'vsphere', 'regional-child')
1298 }
1299 addToProviderNetMap(netMap, 'vsphere', 'region')
1300 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001301 break
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001302 case 'azure':
1303 lockLabels['azure_core_ci_queue'] = triggers.demoWeight
1304 if (runMultiregion && multiregionConfig.managementLocation == 'azure') {
1305 if (multiregionConfig.regionLocation == 'aws') {
1306 lockLabels['aws_core_ci_queue'] = 1
1307 if (deployChild) {
1308 lockLabels['aws_core_ci_queue'] += 1
1309 }
1310 }
1311
1312 if (multiregionConfig.regionLocation == 'equinix') {
1313 lockLabels['equinix_core_ci_queue'] = 1
1314 if (deployChild) {
1315 lockLabels['equinix_core_ci_queue'] +=1
1316 }
1317 }
1318 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001319 default:
Sergey Kolekonovd6a17392024-02-06 15:57:53 +00001320 error('Supposed to be called from aws, azure or vsphere demos only')
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001321 }
1322
1323 // Checking gerrit triggers and manage lock label quantity and network types in case of Offline deployment
1324 // Vsphere labels only
Владислав Наумов33e1e812021-08-17 17:09:25 +02001325 netMap['vsphere'].each { clusterType, netConfig ->
1326 if (triggers.proxyConfig["${clusterType}Offline"] == true ||
1327 (clusterType == 'regional-child' && triggers.proxyConfig['childOffline'] == true) ||
1328 (clusterType == 'region' && triggers.proxyConfig['mgmtOffline'])) {
1329
1330 netMap['vsphere'][clusterType]['netName'] = 'offline'
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001331 lockLabels['vsphere_offline_networking_core_ci']++
1332 } else {
1333 lockLabels['vsphere_networking_core_ci']++
1334 }
1335 }
1336
1337 // generate lock metadata
1338 def lockResources = []
1339 lockLabels.each { label, quantity ->
1340 if (quantity > 0) {
1341 def res = [
1342 label: label,
1343 quantity: quantity,
1344 ]
1345 lockResources.add(res)
1346 }
1347 }
1348
1349 common.infoMsg("""Generated vsphere netMap: ${netMap}
1350 Generated lockResources: ${lockResources}""")
1351
1352 return [
1353 netMap: netMap,
1354 lockResources: lockResources,
1355 ]
1356}
1357
1358/**
1359 * Function gets vsphere netMap or empty map and adds new vsphere clusterType with default netName
1360 * and empty rangeConfig to the this map.
1361 *
Владислав Наумов33e1e812021-08-17 17:09:25 +02001362 * @param: netMap (string) vsphere, equinix netMap or empty map
1363 * @param: provider (string) provider type
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001364 * @param: clusterType (string) Vsphere cluster type
1365 */
1366
Владислав Наумов33e1e812021-08-17 17:09:25 +02001367def addToProviderNetMap (netMap, provider, clusterType) {
1368 switch (provider) {
1369 case 'equinix':
1370 netMap[provider][clusterType] = [
1371 vlanConfig: '',
1372 ]
1373 break
1374 case 'vsphere':
1375 netMap[provider][clusterType] = [
1376 netName: 'default',
1377 rangeConfig: '',
1378 ]
1379 break
1380 default:
1381 error('Net map locks supported for Equinix/Vsphere providers only')
1382 }
Stanislav Riazanov78fa7df2021-05-28 20:28:59 +04001383}
Dmitry Teselkinfce71aa2022-03-05 19:36:52 +03001384
1385/**
1386* getCIKeywordsFromCommitMsg parses commit message and returns all gerrit keywords with their values as a list of maps.
1387* Each element (map) contains keys 'key' for keyword name and 'value' for its value.
1388* If keyword contains only 'key' part then 'value' is boolean True.
1389* This function does not perform keywords validation.
1390* First line of a commit message is ignored.
1391* To use '[' or ']' characters inside keyword prepend it with backslash '\'.
1392* TODO: Remove backslash chars from values if they prepend '[' or ']'.
1393**/
1394
1395List getCIKeywordsFromCommitMsg() {
1396 String commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : ''
1397 List commitMsgLines = commitMsg.split('\n')
1398 List keywords = []
1399 if (commitMsgLines.size() < 2) {
1400 return keywords
1401 }
1402
1403 String commitMsgBody = commitMsgLines[1..-1].join('\n')
1404
1405 // Split commit message body to chunks using '[' or ']' as delimiter,
1406 // ignoring them if prepended by backslash (regex negative lookbehind).
1407 // Resulting list will have chunks between '[' and ']' at odd indexes.
1408 List parts = commitMsgBody.split(/(?<!\\)[\[\]]/)
1409
1410 // Iterate chunks by odd indexes only, trim values and split to
1411 // <key> / <value> pair where <key> is the part of a sting before the first
1412 // whitespace delimiter, and <value> is the rest (may include whitespaces).
1413 // If there is no whitespace in the string then this is a 'switch'
1414 // and <value> will be boolean True.
1415 for (i = 1; i < parts.size(); i += 2) {
1416 def (key, value) = (parts[i].trim().split(/\s+/, 2) + [true, ])[0..1]
1417 keywords.add(['key': key, 'value': value])
1418 }
1419
1420 return keywords
1421}
1422
1423/**
1424* getJobsParamsFromCommitMsg parses list of CI keywords and returns values of 'job-params' keyword
1425* that were specified for given job name. `job-params` keyword has the following structure
1426*
1427* [job-params <job name> <parameter name> <parameter value>]
1428*
1429* Return value is a Map that contains those parameters using the following structure:
1430*
1431* <job name>:
1432* <parameter name>: <parameter value>
1433*
1434**/
1435Map getJobsParamsFromCommitMsg() {
1436 List keywords = getCIKeywordsFromCommitMsg()
1437
1438 List jobsParamsList = []
1439 keywords.findAll{ it.key == 'job-params' }.collect(jobsParamsList) {
1440 def (name, params) = (it['value'].split(/\s+/, 2) + [null, ])[0..1]
1441 def (key, value) = params.split(/\s+/, 2)
1442 ['name': name, 'key': key, 'value': value]
1443 }
1444
1445 Map jobsParams = jobsParamsList.inject([:]) { result, it ->
1446 if (!result.containsKey(it.name)) {
1447 result[it.name] = [:]
1448 }
1449 result[it.name][it.key] = it.value
1450 result
1451 }
1452
1453 return jobsParams
1454}
1455
1456
1457/**
1458* getJobParamsFromCommitMsg returns key:value Map of parameters set for a job in commit message.
1459* It uses getJobsParamsFromCommitMsg to get all parameters from commit message and then
1460* uses only those parametes that were set to all jobs (with <job name> == '*') or to
1461* a particular job. Parameters set to a particular job have higher precedence.
1462*
1463* Return value is a Map that contains those parameters:
1464*
1465* <parameter name>: <parameter value>
1466*
1467**/
1468Map getJobParamsFromCommitMsg(String jobName) {
1469 jobsParams = getJobsParamsFromCommitMsg()
1470 jobParams = jobsParams.getOrDefault('*', [:])
1471 if (jobName) {
1472 jobParams.putAll(jobsParams.getOrDefault(jobName, [:]))
1473 }
1474 return jobParams
1475}
azvyagintsevc17d14b2022-06-06 19:06:33 +03001476
1477/** Getting test scheme from text, which should be
1478Imput example:
1479text="""
1480 DATA
1481
1482 kaas_bm_test_schemas:
1483 KAAS_RELEASES_REFSPEC: ''
1484 KEY: VAL
1485
1486 DATA
1487 """
1488
1489 Call: parseTextForTestSchemas(['text' : text,'keyLine' : 'kaas_bm_test_schemas'])
1490
1491 Return:
1492 ['KAAS_RELEASES_REFSPEC': '', 'KEY' : 'VAL']
1493 **/
1494def parseTextForTestSchemas(Map opts) {
azvyagintsevd96aac22022-06-10 14:23:26 +03001495 String text = opts.getOrDefault('text', '')
azvyagintsevc17d14b2022-06-06 19:06:33 +03001496 String keyLine = opts.getOrDefault('keyLine', '')
1497 Map testScheme = [:]
1498 if (!text || !keyLine) {
azvyagintsevd96aac22022-06-10 14:23:26 +03001499 return testScheme
azvyagintsevc17d14b2022-06-06 19:06:33 +03001500 }
1501 if (text =~ /\n$keyLine\n.*/) {
1502 def common = new com.mirantis.mk.Common()
1503 try {
1504 String regExp = '\\n' + keyLine + '\\n'
1505 // regexep block must be followed by empty line
1506 testScheme = readYaml text: "${text.split(regExp)[1].split('\n\n')[0]}"
1507 common.infoMsg("parseTextForTestSchemas result:\n" + testScheme)
1508 common.mergeEnv(env, toJson(testScheme))
1509 }
1510 catch (Exception e) {
1511 common.errorMsg("There is an error occured during parseTextForTestSchemas execution:\n${e}")
1512 throw e
1513 }
1514 }
azvyagintsevd96aac22022-06-10 14:23:26 +03001515 return testScheme
Dmitriy Kasyanov5f910e62022-02-11 14:57:05 +03001516}
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001517
1518
1519/**
eromanovab24cb232023-11-17 12:17:06 +04001520* getEquinixMetroWithCapacity returns list of Equinix metros using specified
1521* instance type (nodeType), desired count of metros (metroCount) and
1522* instances (nodeCount) in a metro using specified matal version.
1523* Function downloads metal CLI from the
1524* https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux
1525* Empty list is returned in case of no metros with specified capacity was found or any other errors.
1526* Non-empty list is shuffled.
1527*
1528* @param: metroCount (int) Desired count of metros
1529* @param: nodeCount (int) Desired count of instances
1530* @param: nodeType (string) Instance type
1531* @param: version (string) Metal version to use
1532* @return ([]string) List of selected metros
1533*
1534**/
1535def getEquinixMetroWithCapacity(metroCount = 1, nodeCount = 50, nodeType = 'c3.small.x86', version = '0.9.0') {
1536 def common = new com.mirantis.mk.Common()
1537 def metalUrl = "https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux"
1538 def metal = './metal --config metal.yaml'
1539 def metro = []
1540 def out = ''
1541 def retries = 3 // number of retries
1542 def i = 0
1543 def delay = 60 // 1 minute sleep
1544 def excludeMetro = [] // list of metros to exclude from selection
1545 try {
1546 if (excludeMetro.size() > 0) {
1547 common.infoMsg("Excluded metros: ${excludeMetros}")
1548 }
1549 sh "curl -o metal -# ${metalUrl} && chmod +x metal"
1550 withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) {
1551 sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml'
1552 }
1553 while (metro.size() < metroCount && i < retries) {
1554 common.infoMsg("Selecting ${metroCount} available Equinix metros with free ${nodeCount} ${nodeType} hosts, try ${i+1}/${retries} ...")
1555 if (i > 0) { // skip sleep on first step
1556 sleep(delay)
1557 }
1558 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()
1559 metro = out.tokenize(',')
1560 metro -= excludeMetro
1561 if (metro.size() < metroCount) {
1562 nodeCount -= 10
1563 // We need different metros for the [equinixmetalv2-child-diff-metro] case
1564 } else if (metro.size() == 2 && metro[0][0, 1] == metro[1][0, 1]) {
1565 nodeCount -= 10
1566 }
1567 i++
1568 }
1569 if (metro.size() > 0) {
eromanovaefbbb422023-11-24 13:54:35 +04001570 m = metro.size() > 1 ? "${metro[0]},${metro[1]}" : "${metro[0]}"
1571 sh "${metal} capacity check -P ${nodeType} -m ${m} -q ${nodeCount}"
eromanovab24cb232023-11-17 12:17:06 +04001572 }
1573 } catch (Exception e) {
1574 common.errorMsg "Exception: '${e}'"
1575 return []
1576 } finally {
1577 sh 'rm metal.yaml'
1578 }
1579 if (metro.size() > 0) {
1580 Collections.shuffle(metro)
1581 common.infoMsg("Selected metros: ${metro}")
1582 } else {
1583 common.warningMsg('No any metros have been selected !!! :(')
1584 }
1585 return metro
1586}
1587
1588
1589/**
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001590* getEquinixFacilityWithCapacity returns list of Equinix facilities using specified
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001591* instance type (nodeType), desired count of facilities (facilityCount) and
1592* instances (nodeCount) in a facility using specified matal version.
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001593* Function downloads metal CLI from the
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001594* https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux
1595* 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 +03001596* Non-empty list is shuffled.
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001597*
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001598* @param: facilityCount (int) Desired count of facilities
1599* @param: nodeCount (int) Desired count of instances
1600* @param: nodeType (string) Instance type
1601* @param: version (string) Metal version to use
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001602* @return ([]string) List of selected facilities
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001603*
1604**/
eromanovab24cb232023-11-17 12:17:06 +04001605@Deprecated
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001606def getEquinixFacilityWithCapacity(facilityCount = 1, nodeCount = 50, nodeType = 'c3.small.x86', version = '0.9.0') {
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001607 def common = new com.mirantis.mk.Common()
Sergey Lalov314daae2023-11-27 12:21:20 +04001608 common.warningMsg('You are using deprecated method getEquinixFacilityWithCapacity. Use getEquinixMetroWithCapacity instead')
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001609 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 +03001610 def metal = './metal --config metal.yaml'
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001611 def facility = []
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001612 def out = ''
Sergey Zhemerdeevbcccb912022-08-25 14:26:52 +03001613 def retries = 3 // number of retries
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001614 def i = 0
1615 def delay = 60 // 1 minute sleep
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001616 def excludeFacility = [] // list of facilities to exclude from selection
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001617 try {
Sergey Zhemerdeevb3575342022-10-04 11:02:19 +03001618 if (excludeFacility.size() > 0) {
1619 common.infoMsg("Excluded facilities: ${excludeFacility}")
1620 }
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001621 sh "curl -o metal -# ${metalUrl} && chmod +x metal"
1622 withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) {
1623 sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml'
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001624 }
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001625 while (facility.size() < facilityCount && i < retries) {
1626 common.infoMsg("Selecting ${facilityCount} available Equinix facilities with free ${nodeCount} ${nodeType} hosts, try ${i+1}/${retries} ...")
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001627 if (i > 0 ) { // skip sleep on first step
1628 sleep(delay)
1629 }
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001630 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()
1631 facility = out.tokenize(',')
Sergey Zhemerdeevb3575342022-10-04 11:02:19 +03001632 facility -= excludeFacility
Sergey Zhemerdeev46080fa2022-10-06 12:34:12 +03001633 if (facility.size() < facilityCount) {
1634 nodeCount -= 10
1635 // We need different metros for the [equinixmetalv2-child-diff-metro] case, facility[][0, 1] contains a metro name
1636 } else if (facility.size() == 2 && facility[0][0, 1] == facility[1][0, 1]) {
Sergey Zhemerdeevbcccb912022-08-25 14:26:52 +03001637 nodeCount -= 10
1638 }
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001639 i++
1640 }
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001641 if (facility.size() > 0) {
1642 f = facility.size() > 1 ? "${facility[0]},${facility[1]}" : "${facility[0]}"
1643 sh "${metal} capacity check -P ${nodeType} -f ${f} -q ${nodeCount}"
Sergey Zhemerdeevbcccb912022-08-25 14:26:52 +03001644 }
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001645 } catch (Exception e) {
1646 common.errorMsg "Exception: '${e}'"
1647 return []
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001648 } finally {
1649 sh 'rm metal.yaml'
1650 }
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001651 if (facility.size() > 0) {
Sergey Zhemerdeev15aa8602022-10-13 11:10:02 +03001652 Collections.shuffle(facility)
Sergey Zhemerdeevb68bf612022-09-12 13:12:32 +03001653 common.infoMsg("Selected facilities: ${facility}")
Sergey Zhemerdeev495ba582022-08-16 16:31:43 +03001654 } else {
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001655 common.warningMsg('No any facilities have been selected !!! :(')
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001656 }
Sergey Zhemerdeevde949bf2022-09-14 15:44:33 +03001657 return facility
Sergey Zhemerdeev31569082022-08-10 10:13:19 +03001658}
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001659
1660
1661/**
1662 * genCommandLine prepares command line for artifactory-replication
1663 * command using legacy environment variables
1664 *
1665 * @return: (string) Prepared command line
1666 */
1667def genCommandLine() {
1668 def envToParam = [
1669 'DESTINATION_USER': '-dst-user',
1670 'ARTIFACT_FILTER': '-artifact-filter',
1671 'ARTIFACT_FILTER_PROD': '-artifact-filter-prod',
1672 'ARTIFACT_TYPE': '-artifact-type',
1673 'BINARY_CLEAN': '-bin-cleanup',
1674 'BINARY_CLEAN_KEEP_DAYS': '-bin-clean-keep-days',
1675 'BINARY_CLEAN_PREFIX': '-bin-clean-prefix',
1676 'BUILD_URL': '-slack-build-url',
1677 'CHECK_REPOS': '-check-repos',
1678 'DESTINATION_REGISTRY': '-dst-repo',
1679 'DESTINATION_REGISTRY_TYPE': '-dst-repo-type',
Ihor Hryshchenko4f703862023-12-07 14:45:50 +02001680 'SIGNED_IMAGES_PATH': '-signed-images-path',
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001681 'DOCKER_CLEAN': '-cleanup',
Ihor Hryshchenkoaa501002024-03-11 16:39:56 +02001682 'DOCKER_OLDER_THAN_DAYS': '-older-than-days',
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001683 'DOCKER_REPO_PREFIX': '-docker-repo-prefix',
1684 'DOCKER_TAG': '-docker-tag',
1685 'FORCE': '-force',
1686 'HELM_CDN_DOMAIN': '-helm-cdn-domain',
1687 'SLACK_CHANNEL': '-slack-channel',
Ihor Hryshchenko742c9012024-01-19 16:47:22 +02001688 'SLACK_CHANNELS': '-slack-channels',
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001689 'SLACK_USER': '-slack-user',
1690 'SOURCE_REGISTRY': '-src-repo',
1691 'SOURCE_REGISTRY_TYPE': '-src-repo-type',
1692 'SYNC_PATTERN': '-sync-pattern'
1693 ]
1694 def cmdParams = ''
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001695 def isCheckClean = false
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001696 for (e in envToParam) {
1697 if (env[e.key] == null) {
1698 continue
1699 }
Ihor Hryshchenko88bda4f2024-11-26 15:13:27 +02001700 if (e.key == 'CHECK_REPOS' || e.key == 'DOCKER_CLEAN' || e.key == 'BINARY_CLEAN') {
1701 // Avoid assigning values to boolean options
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001702 if (env[e.key].toBoolean() && !isCheckClean) {
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001703 cmdParams += e.value + ' '
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001704 isCheckClean = true
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001705 }
1706 } else if (e.key == 'FORCE') {
1707 if (env[e.key].toBoolean()) {
1708 cmdParams += e.value + ' '
1709 }
1710 } else {
Sergey Zhemerdeeve2926cd2022-08-29 15:28:47 +03001711 cmdParams += "${e.value} '${env[e.key]}' "
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001712 }
1713 }
Sergey Zhemerdeev88d1c3d2022-08-31 16:37:48 +03001714 // No any check or clean was specified - take a default action
1715 if (!isCheckClean) {
1716 cmdParams += '-replicate'
1717 }
Sergey Zhemerdeev2a273342022-08-18 12:06:11 +03001718 return cmdParams
1719}
Sergey Kolekonov0e60a942022-09-05 13:02:22 +04001720
1721/**
1722 * custom scheduling algorithm
1723 * it ensures that builds of the same job are distributed as much as possible between different nodes
1724 * @param label (string) desired node label
1725 * @return: (string) node name
1726 */
1727def schedule (label='docker') {
1728 def common = new com.mirantis.mk.Common()
1729 def freeNodes = []
1730 def nodesMap = [:]
1731
1732 // filter nodes with the specified label and at least one free executor
1733 timeout(time: 30, unit: 'MINUTES') {
1734 while (!freeNodes) {
1735 freeNodes = jenkins.model.Jenkins.instance.computers.findAll { node ->
1736 label in node.getAssignedLabels().collect { it.name } &&
Sergey Kolekonovd5887172022-11-10 12:13:22 +06001737 node.isPartiallyIdle() &&
1738 node.isOnline()
Sergey Kolekonov0e60a942022-09-05 13:02:22 +04001739 }
1740 if (!freeNodes) {
1741 echo 'No nodes available for scheduling, retrying...'
1742 sleep 30
1743 }
1744 }
1745 }
1746
1747 // generate a map of nodes matching other criteria
1748 for (node in freeNodes) {
1749 // sameJobExecutors is the number of executors running the same job as the calling one
1750 sameJobExecutors = node.getExecutors() // get all executors
1751 .collect { executor -> executor.getCurrentExecutable() } // get running "threads"
1752 .collect { thread -> thread?.displayName } // filter job names from threads
1753 .minus(null) // null = empty executors, remove them from the list
1754 .findAll { it.contains(env.JOB_NAME) } // filter the same jobs as the calling one
1755 .size()
1756
1757 // calculate busy executors, we don't want to count "sameJobExecutors" twice
1758 totalBusyExecutors = node.countBusy() - sameJobExecutors
1759 // generate the final map which contains nodes matching criteria with their load score
1760 // builds of the same jobs have x10 score, all others x1
1761 nodesMap += ["${node.getName()}" : sameJobExecutors * 10 + totalBusyExecutors]
1762 }
1763
1764 // return the least loaded node
1765 return common.SortMapByValueAsc(nodesMap).collect { it.key }[0]
1766}
Sergey Zhemerdeev78a65272023-03-23 18:05:22 +02001767
1768
1769/**
1770 * Get latest tag for test/frontend & equinix-private-infra images
1771 * @param version (str) default tag value from main workflow
1772 * @param isChanged (bool) is dependent directory files were changed
1773 * @param imageName (string) image name for information message
1774 * @return: (string) tag name
1775 */
1776def getImageTag(version, isChanged, imageName) {
1777 def common = new com.mirantis.mk.Common()
Sergey Zhemerdeev5fbf2022023-04-28 14:51:36 +03001778 def latestTag = ''
1779 if (env.GERRIT_EVENT_TYPE && !(env.GERRIT_EVENT_TYPE in ['change-merged', 'ref-updated']) && isChanged) {
Sergey Zhemerdeev78a65272023-03-23 18:05:22 +02001780 latestTag = version
Sergey Zhemerdeevebdcad22023-04-25 16:58:28 +03001781 } else {
1782 if (env.GERRIT_EVENT_TYPE == 'ref-updated') {
1783 latestTag = env.GERRIT_REFNAME.replace('refs/tags/v', '').trim()
1784 } else {
1785 latestTag = env.GERRIT_BRANCH ? env.GERRIT_BRANCH : env.GERRIT_REFSPEC ? env.GERRIT_REFSPEC : 'master'
1786 if (latestTag != 'master') {
1787 latestTag = latestTag.replaceAll('/', '_')
1788 }
1789 }
Sergey Zhemerdeev78a65272023-03-23 18:05:22 +02001790 }
1791 common.infoMsg("${imageName} image will use tag '${latestTag}'")
1792 return latestTag
1793}
Sergey Zhemerdeev1d2c03e2023-04-28 11:07:24 +03001794
Sergey Lalov78659102024-02-15 16:57:21 +04001795/**
1796 * Get actual branch version for os deployment job
1797 * @param mosChildPreviouseComplexRelease (string) kaas_previous_complex_mosk_cluster_release_version.txt
1798 * @param mosChildLatestComplexRelease (string) kaas_latest_complex_mosk_cluster_release_version.txt
1799 * @param upgradeFlag (boolean)
1800 * all parametrs get from si-test-release-sanity-check-prepare-configuration job
1801 * @return: (string) branch verison
1802 */
1803def getOpenstackbranchVersion(mosChildPreviouseComplexRelease, mosChildLatestComplexRelease, upgradeFlag) {
1804 def common = new com.mirantis.mk.Common()
1805 def regex = Pattern.compile('([a-z]+)-([0-9]+-[0-9]+-[0-9]+)-([a-z]*)-?([0-9]+-[0-9]+-?[0-9]*)')
1806
1807 def mosVersionBranch = upgradeFlag ? mosChildPreviouseComplexRelease : mosChildLatestComplexRelease
1808 def matcherComplexVersion = regex.matcher((mosVersionBranch).toString())
1809 def releaseOpenstackK8sBranch = 'master'
1810
1811 if (matcherComplexVersion.find()) {
1812 def matcherComplexVersionParts = matcherComplexVersion.group(2).split('-')
1813 releaseOpenstackK8sBranch = String.format('%s.%s.%s', matcherComplexVersionParts[0], matcherComplexVersionParts[1], '0')
1814 }
1815 common.infoMsg("Use: OPENSTACK_DEPLOY_RELEASE_DIR ${releaseOpenstackK8sBranch}")
1816 return releaseOpenstackK8sBranch
1817}
1818
1819
Sergey Zhemerdeev1d2c03e2023-04-28 11:07:24 +03001820
1821/**
1822 * Translates set of environment vars into actual replicator command line
1823 * @return: (string cmdParams, string jobDescription)
1824 * cmdParams - generated command line
1825 * jobDescription - job description
1826 */
1827def genReplicatorCommandLine() {
1828 def mainModes = ['REPLICATE', 'CLEANUP', 'CHECK_REPOS', 'BIN_CLEANUP']
Sergey Zhemerdeev9919b1b2023-04-28 17:24:21 +03001829 def parameterWithoutArgument = mainModes
Sergey Zhemerdeev1d2c03e2023-04-28 11:07:24 +03001830 def parametersList = parameterWithoutArgument + [
1831 'ARTIFACT_FILTER',
1832 'ARTIFACT_TYPE',
1833 'BIN_CLEAN_KEEP_DAYS',
1834 'BIN_CLEAN_PREFIX',
1835 'DOCKER_TAG',
1836 // DST_ will be changed to TARGET_
1837 'DST_REPO',
1838 'DST_REPO_TYPE',
1839 'DST_USER',
1840 'OLDER_THAN_DAYS',
1841 'SLACK_BUILD_URL',
1842 'SLACK_CHANNEL',
1843 'SLACK_USER',
1844 'SRC_REPO',
1845 'SRC_REPO_TYPE',
1846 'SRC_USER',
1847 'SYNC_PATTERN',
1848 'THREAD_COUNT'
1849 ]
1850 def mainModesDescriptions = [
1851 'REPLICATE': 'Replicating binaries/Docker images',
1852 'CLEANUP': 'Cleaning Docker images',
1853 'BIN_CLEANUP': 'Cleaning binaries',
1854 'CHECK_REPOS': 'Checking binaries'
1855 ]
1856
1857 def cmdParams = ''
1858 def jobDescription = ''
1859 for (e in parametersList) {
1860 if (env[e] == null || env[e] == '') {
1861 continue
1862 }
1863 if (e in mainModes) {
1864 jobDescription = mainModesDescriptions[e]
1865 }
1866 cmdParams += "-${e.replaceAll('_', '-').toLowerCase()} "
1867 if (!(e in parameterWithoutArgument)) {
1868 cmdParams += "'${env[e]}' "
1869 }
1870 }
1871 return [cmdParams, jobDescription]
1872}