vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 1 | package com.mirantis.mk |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 2 | |
azvyagintsev | c17d14b | 2022-06-06 19:06:33 +0300 | [diff] [blame] | 3 | import static groovy.json.JsonOutput.toJson |
Sergey Lalov | 7865910 | 2024-02-15 16:57:21 +0400 | [diff] [blame] | 4 | import java.util.regex.Pattern |
azvyagintsev | c17d14b | 2022-06-06 19:06:33 +0300 | [diff] [blame] | 5 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 6 | /** |
| 7 | * |
| 8 | * KaaS Component Testing Utilities |
| 9 | * |
| 10 | */ |
| 11 | |
Владислав Наумов | e534581 | 2020-08-12 16:30:20 +0200 | [diff] [blame] | 12 | /** |
| 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 | */ |
| 21 | def 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 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 35 | |
| 36 | /** |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 37 | * Determine scope of test suite against per-commit KaaS deployment based on keywords |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 38 | * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 39 | * |
| 40 | * Used for components team to combine test-suites and forward desired parameters to kaas/core deployment jobs |
| 41 | * Example scheme: |
Владислав Наумов | e534581 | 2020-08-12 16:30:20 +0200 | [diff] [blame] | 42 | * New CR pushed in kubernetes/lcm-ansible -> parsing it'cs commit body and combine test-suite -> trigger deployment jobs from kaas/core |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 43 | * manage test-suite through Jenkins Job Parameters |
| 44 | * |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 45 | * @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 |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 48 | * ] |
| 49 | */ |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 50 | def checkDeploymentTestSuite() { |
vnaumov | bdb9022 | 2020-05-04 18:25:50 +0200 | [diff] [blame] | 51 | def common = new com.mirantis.mk.Common() |
| 52 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 53 | // Available triggers and its sane defaults |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 54 | def seedMacOs = env.SEED_MACOS ? env.SEED_MACOS.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 55 | 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 Lalov | c1cb49f | 2022-09-27 01:16:25 +0400 | [diff] [blame] | 57 | def fullUpgradeChild = env.FULL_UPGRADE_CHILD_CLUSTER ? env.FULL_UPGRADE_CHILD_CLUSTER.toBoolean() : false |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 58 | 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 Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 60 | def customChildRelease = env.KAAS_CHILD_CLUSTER_RELEASE_NAME ? env.KAAS_CHILD_CLUSTER_RELEASE_NAME : '' |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame] | 61 | def mosTfDeploy = env.MOS_TF_DEPLOY ? env.MOS_TF_DEPLOY.toBoolean() : false |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 62 | def attachBYO = env.ATTACH_BYO ? env.ATTACH_BYO.toBoolean() : false |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 63 | def upgradeBYO = env.UPGRADE_BYO ? env.UPGRADE_BYO.toBoolean() : false |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 64 | def runBYOMatrix = env.RUN_BYO_MATRIX ? env.RUN_BYO_MATRIX.toBoolean() : false |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 65 | def defaultBYOOs = env.DEFAULT_BYO_OS ? env.DEFAULT_BYO_OS.toString() : 'ubuntu' |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 66 | def upgradeMgmt = env.UPGRADE_MGMT_CLUSTER ? env.UPGRADE_MGMT_CLUSTER.toBoolean() : false |
slalov | 1202bba | 2022-04-20 22:31:07 +0400 | [diff] [blame] | 67 | def autoUpgradeMgmt = env.AUTO_UPGRADE_MCC ? env.AUTO_UPGRADE_MCC.toBoolean() : false |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 68 | def enableLMALogging = env.ENABLE_LMA_LOGGING ? env.ENABLE_LMA_LOGGING.toBoolean(): false |
Sergey Lalov | b2f6037 | 2022-09-20 23:58:47 +0400 | [diff] [blame] | 69 | def deployOsOnMos = env.DEPLOY_OS_ON_MOS? env.DEPLOY_OS_ON_MOS.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 70 | def runUie2e = env.RUN_UI_E2E ? env.RUN_UI_E2E.toBoolean() : false |
Mikhail Ivanov | f5e20af | 2022-03-24 15:38:06 +0400 | [diff] [blame] | 71 | def runUie2eNew = env.RUN_UI_E2E_NEW ? env.RUN_UI_E2E_NEW.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 72 | def runMgmtConformance = env.RUN_MGMT_CFM ? env.RUN_MGMT_CFM.toBoolean() : false |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 73 | def runMgmtConformanceNetworkPolicy = env.RUN_MGMT_CFM_NETWORK_POLICY ? env.RUN_MGMT_CFM_NETWORK_POLICY.toBoolean() : false |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 74 | def runLMATest = env.RUN_LMA_TEST ? env.RUN_LMA_TEST.toBoolean() : false |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 75 | def runMgmtUserControllerTest = env.RUN_MGMT_USER_CONTROLLER_TEST ? env.RUN_MGMT_USER_CONTROLLER_TEST.toBoolean() : false |
Mikhail Ivanov | 2907e4d | 2022-04-25 16:41:21 +0400 | [diff] [blame] | 76 | def runProxyChildTest = env.RUN_PROXY_CHILD_TEST ? env.RUN_PROXY_CHILD_TEST.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 77 | def runChildConformance = env.RUN_CHILD_CFM ? env.RUN_CHILD_CFM.toBoolean() : false |
Sergey Lalov | 012496a | 2023-11-27 15:57:52 +0400 | [diff] [blame] | 78 | def runChildStacklightHa = env.RUN_STACKLIGHT_CHILD_HA ? env.RUN_STACKLIGHT_CHILD_HA.toBoolean() : false |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 79 | def runChildConformanceNetworkPolicy = env.RUN_CHILD_CFM_NETWORK_POLICY ? env.RUN_CHILD_CFM_NETWORK_POLICY.toBoolean() : false |
vryzhenkin | b286bd8 | 2023-04-04 07:17:52 +0400 | [diff] [blame] | 80 | def runChildHPA = env.RUN_CHILD_HPA ? env.RUN_CHILD_HPA.toBoolean() : false |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 81 | def fetchServiceBinaries = env.FETCH_BINARIES_FROM_UPSTREAM ? env.FETCH_BINARIES_FROM_UPSTREAM.toBoolean() : false |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 82 | def equinixMetalV2ChildDiffMetro = env.EQUINIXMETALV2_CHILD_DIFF_METRO ? env.EQUINIXMETALV2_CHILD_DIFF_METRO.toBoolean() : false |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 83 | def runMaintenanceTest = env.RUN_MAINTENANCE_TEST ? env.RUN_MAINTENANCE_TEST.toBoolean() : false |
slalov | 0a4947a | 2022-06-09 15:44:35 +0400 | [diff] [blame] | 84 | def runContainerregistryTest = env.RUN_CONTAINER_REGISTRY_TEST ? env.RUN_CONTAINER_REGISTRY_TEST.toBoolean() : false |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 85 | 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 Nikolaenko | 7e632cd | 2022-10-24 16:20:31 +0300 | [diff] [blame] | 88 | def runGracefulRebootTest = env.RUN_GRACEFUL_REBOOT_TEST ? env.RUN_GRACEFUL_REBOOT_TEST.toBoolean() : false |
Sergey Lalov | bc68d75 | 2022-11-08 13:40:53 +0400 | [diff] [blame] | 89 | def pauseForDebug = env.PAUSE_FOR_DEBUG ? env.PAUSE_FOR_DEBUG.toBoolean() : false |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 90 | def runChildMachineDeletionPolicyTest = env.RUN_CHILD_MACHINE_DELETION_POLICY_TEST ? env.RUN_CHILD_MACHINE_DELETION_POLICY_TEST.toBoolean() : false |
Sergey Lalov | d3e030e | 2023-03-16 14:32:47 +0400 | [diff] [blame] | 91 | def runChildCustomCertTest = env.RUN_CHILD_CUSTOM_CERT_TEST ? env.RUN_CHILD_CUSTOM_CERT_TEST.toBoolean() : false |
Sergey Lalov | 430fcd7 | 2023-03-20 17:19:44 +0400 | [diff] [blame] | 92 | def runByoChildCustomCertTest = env.RUN_BYO_CHILD_CUSTOM_CERT_TEST ? env.RUN_BYO_CHILD_CUSTOM_CERT_TEST.toBoolean() : false |
Sergey Lalov | f6fbfea | 2023-04-06 17:05:40 +0400 | [diff] [blame] | 93 | def runMgmtCustomCacheCertTest = env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST ? env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST.toBoolean() : false |
Sergey Lalov | 48e6902 | 2023-07-25 16:08:00 +0400 | [diff] [blame] | 94 | def runMkeCustomCertTest = env.RUN_MKE_CUSTOM_CERT_TEST ? env.RUN_MKE_CUSTOM_CERT_TEST.toBoolean() : false |
Sergey Lalov | 62c2831 | 2023-10-18 19:23:59 +0400 | [diff] [blame] | 95 | def runCustomHostnames = env.RUN_CUSTOM_HOSTNAMES ? env.RUN_CUSTOM_HOSTNAMES.toBoolean() : false |
vryzhenkin | 504dfc9 | 2023-11-01 15:49:47 +0400 | [diff] [blame] | 96 | def slLatest = env.SL_LATEST ? env.SL_LATEST.toBoolean() : false |
vryzhenkin | a8d74e7 | 2024-02-26 14:59:37 +0400 | [diff] [blame] | 97 | def coreKeycloakLdap = env.CORE_KEYCLOAK_LDAP_ENABLED ? env.CORE_KEYCLOAK_LDAP_ENABLED.toBoolean() : false |
vryzhenkin | e0ff1d8 | 2024-03-18 15:08:09 +0400 | [diff] [blame] | 98 | def configureInternalNTP = env.CORE_KAAS_NTP_ENABLED ? env.CORE_KAAS_NTP_ENABLED.toBoolean() : false |
Sergey Lalov | d7593ab | 2024-01-11 13:40:13 +0400 | [diff] [blame] | 99 | def disableKubeApiAudit = env.DISABLE_KUBE_API_AUDIT ? env.DISABLE_KUBE_API_AUDIT.toBoolean() : false |
Sergey Lalov | f44cbb7 | 2024-03-27 15:19:24 +0400 | [diff] [blame] | 100 | def auditd = env.AUDITD_ENABLE ? env.AUDITD_ENABLE.toBoolean() : false |
Sergey Lalov | 7c2377e | 2023-12-15 23:14:45 +0400 | [diff] [blame] | 101 | def customSlackChannel = env.SLACK_CHANNEL_NOTIFY ? env.SLACK_CHANNEL_NOTIFY : '' |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 102 | // multiregion configuration from env variable: comma-separated string in form $mgmt_provider,$regional_provider |
| 103 | def multiregionalMappings = env.MULTIREGION_SETUP ? multiregionWorkflowParser(env.MULTIREGION_SETUP) : [ |
| 104 | enabled: false, |
| 105 | managementLocation: '', |
| 106 | regionLocation: '', |
| 107 | ] |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 108 | |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 109 | // proxy customization |
| 110 | def proxyConfig = [ |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 111 | mgmtOffline: env.OFFLINE_MGMT_CLUSTER ? env.OFFLINE_MGMT_CLUSTER.toBoolean() : false, |
| 112 | childOffline: env.OFFLINE_CHILD_CLUSTER ? env.OFFLINE_CHILD_CLUSTER.toBoolean() : false, |
Владислав Наумов | 257ea13 | 2021-04-14 14:44:13 +0200 | [diff] [blame] | 113 | childProxy: env.PROXY_CHILD_CLUSTER ? env.PROXY_CHILD_CLUSTER.toBoolean() : false, |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 114 | ] |
| 115 | |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 116 | // optional demo deployment customization |
Владислав Наумов | 905dd36 | 2020-06-08 16:37:01 +0200 | [diff] [blame] | 117 | def awsOnDemandDemo = env.ALLOW_AWS_ON_DEMAND ? env.ALLOW_AWS_ON_DEMAND.toBoolean() : false |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 118 | def equinixOnDemandDemo = env.ALLOW_EQUINIX_ON_DEMAND ? env.ALLOW_EQUINIX_ON_DEMAND.toBoolean() : false |
Владислав Наумов | 82305e9 | 2021-10-14 20:45:20 +0200 | [diff] [blame] | 119 | def equinixMetalV2OnDemandDemo = env.ALLOW_EQUINIXMETALV2_ON_DEMAND ? env.ALLOW_EQUINIXMETALV2_ON_DEMAND.toBoolean() : false |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 120 | def equinixOnAwsDemo = env.EQUINIX_ON_AWS_DEMO ? env.EQUINIX_ON_AWS_DEMO.toBoolean() : false |
| 121 | def azureOnAwsDemo = env.AZURE_ON_AWS_DEMO ? env.AZURE_ON_AWS_DEMO.toBoolean() : false |
| 122 | def azureOnDemandDemo = env.ALLOW_AZURE_ON_DEMAND ? env.ALLOW_AZURE_ON_DEMAND.toBoolean() : false |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 123 | def enableVsphereDemo = true |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 124 | def enableOSDemo = true |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 125 | def enableBMDemo = true |
Sergey Lalov | c62e938 | 2024-01-29 15:19:15 +0400 | [diff] [blame] | 126 | def enablebmCoreDemo = env.ALLOW_BM_CORE_ON_DEMAND ? env.ALLOW_BM_CORE_ON_DEMAND.toBoolean() : false |
Sergey Lalov | ef5c9dc | 2024-03-20 22:30:06 +0400 | [diff] [blame] | 127 | def bmCoreCleanup = env.BM_CORE_CLEANUP ? env.BM_CORE_CLEANUP.toBoolean() : true |
Mikhail Ivanov | bd1a9fd | 2022-03-29 21:36:21 +0400 | [diff] [blame] | 128 | def enableArtifactsBuild = true |
Sergey Lalov | cad9333 | 2024-03-11 16:19:31 +0400 | [diff] [blame] | 129 | def bmDeployType = env.BM_DEPLOY_TYPE ? env.BM_DEPLOY_TYPE.toString() : 'virtual' |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 130 | def openstackIMC = env.OPENSTACK_CLOUD_LOCATION ? env.OPENSTACK_CLOUD_LOCATION : 'us' |
Alexandr Lovtsov | 36473f3 | 2022-04-28 15:46:09 +0300 | [diff] [blame] | 131 | def enableVsphereUbuntu = env.VSPHERE_DEPLOY_UBUNTU ? env.VSPHERE_DEPLOY_UBUNTU.toBoolean() : false |
Ivan Berezovskiy | 30c4b12 | 2023-11-06 18:03:18 +0500 | [diff] [blame] | 132 | def enableVsphereRHEL = env.VSPHERE_DEPLOY_RHEL ? env.VSPHERE_DEPLOY_RHEL.toBoolean() : false |
Sergey Zhemerdeev | e67fb26 | 2022-06-21 00:49:34 +0300 | [diff] [blame] | 133 | def childOsBootFromVolume = env.OPENSTACK_BOOT_FROM_VOLUME ? env.OPENSTACK_BOOT_FROM_VOLUME.toBoolean() : false |
Ivan Berezovskiy | 29e72b7 | 2022-07-12 21:03:24 +0400 | [diff] [blame] | 134 | def bootstrapV2Scenario = env.BOOTSTRAP_V2_ENABLED ? env.BOOTSTRAP_V2_ENABLED.toBoolean() : false |
Sergey Lalov | acec3c1 | 2022-07-20 16:00:14 +0400 | [diff] [blame] | 135 | def equinixMetalV2Metro = env.EQUINIX_MGMT_METRO ? env.EQUINIX_MGMT_METRO : '' |
Mikhail Ivanov | 3088d3d | 2022-10-24 14:05:46 +0400 | [diff] [blame] | 136 | def enableFips = env.ENABLE_FIPS ? env.ENABLE_FIPS.toBoolean() : false |
Sergey Lalov | 00bea0f | 2023-08-14 16:46:33 +0400 | [diff] [blame] | 137 | def enableMkeDebug = env.ENABLE_MKE_DEBUG ? env.ENABLE_MKE_DEBUG.toBoolean() : false |
Mikhail Nikolaenko | c36dea9 | 2022-12-12 02:40:40 +0300 | [diff] [blame] | 138 | def aioCluster = env.AIO_CLUSTER ? env.AIO_CLUSTER.toBoolean() : false |
Mikhail Morgoev | 58855c1 | 2023-02-10 14:57:31 +0100 | [diff] [blame] | 139 | def useVsphereVvmtObjects = env.VSPHERE_USE_VVMT_OBJECTS ? env.VSPHERE_USE_VVMT_OBJECTS.toBoolean() : false |
vryzhenkin | 4fd3f24 | 2023-03-29 15:13:46 +0400 | [diff] [blame] | 140 | def enableBv2Smoke = true |
Ivan Berezovskiy | 02baa98 | 2023-06-06 12:46:27 +0400 | [diff] [blame] | 141 | def runCacheWarmup = env.CACHE_WARMUP_ENABLED ? env.CACHE_WARMUP_ENABLED.toBoolean() : false |
vryzhenkin | 211a4e8 | 2023-11-23 12:48:27 +0400 | [diff] [blame] | 142 | def cveScan = false |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 143 | |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 144 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 145 | if (commitMsg ==~ /(?s).*\[mgmt-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-proxy.*/) { |
| 146 | proxyConfig['mgmtOffline'] = true |
Владислав Наумов | 70c0242 | 2021-04-19 14:29:41 +0200 | [diff] [blame] | 147 | common.warningMsg('Forced running offline mgmt deployment, some provider CDN regions for mgmt deployment may be set to *public-ci* to verify proxy configuration') |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 148 | } |
Sergey Kolekonov | 5995dfd | 2023-07-06 16:09:43 +0600 | [diff] [blame] | 149 | if (commitMsg ==~ /(?s).*\[mgmt-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-upgrade.*/) { |
| 150 | upgradeMgmt = true |
| 151 | } |
| 152 | if (commitMsg ==~ /(?s).*\[auto-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*auto-upgrade.*/) { |
| 153 | autoUpgradeMgmt = true |
| 154 | } |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 155 | if (commitMsg ==~ /(?s).*\[seed-macos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*seed-macos.*/) { |
| 156 | seedMacOs = true |
| 157 | } |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 158 | if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ || |
| 159 | upgradeChild || runChildConformance || runProxyChildTest || runChildHPA || runChildConformanceNetworkPolicy) { |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 160 | deployChild = true |
| 161 | } |
| 162 | if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) { |
| 163 | deployChild = true |
| 164 | upgradeChild = true |
| 165 | } |
Sergey Lalov | c1cb49f | 2022-09-27 01:16:25 +0400 | [diff] [blame] | 166 | if (commitMsg ==~ /(?s).*\[child-upgrade-full\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade-full.*/) { |
| 167 | deployChild = true |
| 168 | upgradeChild = true |
Sergey Lalov | a048df9 | 2023-06-19 19:36:41 +0400 | [diff] [blame] | 169 | common.warningMsg("2-step child updates are not testing (PRODX-33510)") |
| 170 | //TODO: revert after start testing the two-step upgrade again (PRODX-33510) |
| 171 | //fullUpgradeChild = true |
Sergey Lalov | c1cb49f | 2022-09-27 01:16:25 +0400 | [diff] [blame] | 172 | } |
Sergey Kolekonov | 5995dfd | 2023-07-06 16:09:43 +0600 | [diff] [blame] | 173 | if ((upgradeMgmt || autoUpgradeMgmt) && deployChild) { |
| 174 | upgradeChild = true |
| 175 | common.warningMsg('child upgrade is automatically enabled as mgmt upgrade and child deploy are enabled') |
| 176 | } |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 177 | def childDeployMatches = (commitMsg =~ /(\[child-deploy\s*(\w|\-)+?\])/) |
| 178 | if (childDeployMatches.size() > 0) { |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 179 | // override child version when it set explicitly |
| 180 | deployChild = true |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 181 | customChildRelease = childDeployMatches[0][0].split('child-deploy')[1].replaceAll('[\\[\\]]', '').trim() |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 182 | common.warningMsg("Forced child deployment using custom release version ${customChildRelease}") |
| 183 | } |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 184 | if (commitMsg ==~ /(?s).*\[mos-child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-deploy.*/) { |
| 185 | mosDeployChild = true |
| 186 | } |
| 187 | if (commitMsg ==~ /(?s).*\[mos-child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-upgrade.*/) { |
| 188 | mosDeployChild = true |
| 189 | mosUpgradeChild = true |
| 190 | } |
Sergey Kolekonov | 5995dfd | 2023-07-06 16:09:43 +0600 | [diff] [blame] | 191 | if ((upgradeMgmt || autoUpgradeMgmt) && mosDeployChild) { |
| 192 | mosUpgradeChild = true |
| 193 | common.warningMsg('MOSK child upgrade is automatically enabled as mgmt upgrade and MOSK child deploy are enabled') |
| 194 | } |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 195 | if (commitMsg ==~ /(?s).*\[byo-attach\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-attach.*/) { |
| 196 | attachBYO = true |
| 197 | } |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 198 | if (commitMsg ==~ /(?s).*\[byo-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-upgrade.*/) { |
| 199 | attachBYO = true |
| 200 | upgradeBYO = true |
| 201 | } |
Sergey Lalov | acec3c1 | 2022-07-20 16:00:14 +0400 | [diff] [blame] | 202 | if (commitMsg ==~ /(?s).*\[ui-test-on-all-providers\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-test-on-all-providers.*/) { |
| 203 | enableVsphereDemo = true |
| 204 | enableOSDemo = true |
| 205 | awsOnDemandDemo = true |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 206 | azureOnDemandDemo = true |
| 207 | equinixOnDemandDemo = true |
Sergey Lalov | acec3c1 | 2022-07-20 16:00:14 +0400 | [diff] [blame] | 208 | equinixMetalV2OnDemandDemo = true |
| 209 | runUie2e = true |
Sergey Lalov | acec3c1 | 2022-07-20 16:00:14 +0400 | [diff] [blame] | 210 | // Edit after fix PRODX-3961 |
| 211 | enableBMDemo = false |
| 212 | } |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 213 | def byoDeployMatches = (commitMsg =~ /(\[run-byo-matrix\s*(ubuntu|centos)\])/) |
| 214 | if (commitMsg ==~ /(?s).*\[run-byo-matrix\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*run-byo-matrix\.*/ || byoDeployMatches.size() > 0) { |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 215 | runBYOMatrix = true |
| 216 | |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 217 | if (byoDeployMatches.size() > 0) { |
| 218 | defaultBYOOs = byoDeployMatches[0][2] |
| 219 | common.warningMsg("Custom BYO OS detected, using ${defaultBYOOs}") |
| 220 | } |
| 221 | |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 222 | common.warningMsg('Forced byo matrix test via run-byo-matrix, all other byo triggers will be skipped') |
| 223 | attachBYO = false |
| 224 | upgradeBYO = false |
| 225 | } |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 226 | if (commitMsg ==~ /(?s).*\[lma-logging\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-logging.*/) { |
| 227 | enableLMALogging = true |
| 228 | } |
Sergey Lalov | b2f6037 | 2022-09-20 23:58:47 +0400 | [diff] [blame] | 229 | if (commitMsg ==~ /(?s).*\[deploy-os-on-mos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*deploy-os-on-mos.*/) { |
| 230 | deployOsOnMos = true |
| 231 | mosDeployChild = true |
Sergey Lalov | b2f6037 | 2022-09-20 23:58:47 +0400 | [diff] [blame] | 232 | } |
Sergey Lalov | d0e2085 | 2023-08-17 19:11:19 +0400 | [diff] [blame] | 233 | |
| 234 | if (commitMsg ==~ /(?s).*\[half-virtual\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*half-virtual.*/ || upgradeMgmt) { |
| 235 | bmDeployType = 'half-virtual' |
| 236 | common.infoMsg('Half-virtual will be deployed by default on upgrade case') |
| 237 | } |
| 238 | |
Sergey Lalov | 9504060 | 2023-03-07 16:42:16 +0400 | [diff] [blame] | 239 | if (commitMsg ==~ /(?s).*\[ui-e2e-nw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-nw.*/) { |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 240 | runUie2e = true |
| 241 | } |
Sergey Lalov | 9504060 | 2023-03-07 16:42:16 +0400 | [diff] [blame] | 242 | if (commitMsg ==~ /(?s).*\[ui-e2e-pw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-pw.*/) { |
Mikhail Ivanov | f5e20af | 2022-03-24 15:38:06 +0400 | [diff] [blame] | 243 | runUie2eNew = true |
| 244 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 245 | if (commitMsg ==~ /(?s).*\[mgmt-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm.*/) { |
| 246 | runMgmtConformance = true |
| 247 | } |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 248 | if (commitMsg ==~ /(?s).*\[mgmt-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm-netpolicy.*/) { |
| 249 | runMgmtConformanceNetworkPolicy = true |
| 250 | } |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 251 | if (commitMsg ==~ /(?s).*\[test-user-controller\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-user-controller.*/) { |
| 252 | runMgmtUserControllerTest = true |
| 253 | } |
slalov | 574123e | 2022-04-06 17:24:19 +0400 | [diff] [blame] | 254 | if (commitMsg ==~ /(?s).*\[test-proxy-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-proxy-child.*/) { |
| 255 | runProxyChildTest = true |
| 256 | deployChild = true |
| 257 | common.infoMsg('Child cluster deployment will be enabled since proxy child test suite will be executed') |
| 258 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 259 | if (commitMsg ==~ /(?s).*\[child-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm.*/) { |
| 260 | runChildConformance = true |
| 261 | deployChild = true |
| 262 | } |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 263 | if (commitMsg ==~ /(?s).*\[child-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm-netpolicy.*/) { |
| 264 | runChildConformanceNetworkPolicy = true |
| 265 | deployChild = true |
| 266 | } |
vryzhenkin | b286bd8 | 2023-04-04 07:17:52 +0400 | [diff] [blame] | 267 | if (commitMsg ==~ /(?s).*\[child-hpa\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-hpa.*/) { |
| 268 | runChildHPA = true |
| 269 | deployChild = true |
| 270 | } |
Sergey Lalov | 012496a | 2023-11-27 15:57:52 +0400 | [diff] [blame] | 271 | if (commitMsg ==~ /(?s).*\[child-sl-ha\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-sl-ha.*/) { |
| 272 | runChildStacklightHa = true |
| 273 | deployChild = true |
| 274 | } |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 275 | if (commitMsg ==~ /(?s).*\[lma-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-test.*/) { |
| 276 | runLMATest = true |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 277 | enableLMALogging = true |
| 278 | common.infoMsg('LMA logging will be enabled since LMA test suite will be executed') |
Victor Ryzhenkin | 1520659 | 2021-06-21 17:38:23 +0400 | [diff] [blame] | 279 | } |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 280 | if (commitMsg ==~ /(?s).*\[maintenance-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*maintenance-test.*/) { |
| 281 | runMaintenanceTest = true |
| 282 | } |
slalov | 0a4947a | 2022-06-09 15:44:35 +0400 | [diff] [blame] | 283 | if (commitMsg ==~ /(?s).*\[container-registry-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*container-registry-test.*/) { |
| 284 | runContainerregistryTest = true |
| 285 | } |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 286 | if (commitMsg ==~ /(?s).*\[mgmt-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-delete-master-test.*/) { |
| 287 | runMgmtDeleteMasterTest = true |
| 288 | } |
| 289 | if (commitMsg ==~ /(?s).*\[rgnl-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*rgnl-delete-master-test.*/) { |
| 290 | runRgnlDeleteMasterTest = true |
| 291 | } |
| 292 | if (commitMsg ==~ /(?s).*\[child-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-delete-master-test.*/) { |
Sergey Lalov | 47e2159 | 2023-07-18 23:36:32 +0400 | [diff] [blame] | 293 | if (!mosDeployChild) { |
| 294 | deployChild = true |
| 295 | } |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 296 | runChildDeleteMasterTest = true |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 297 | common.infoMsg('Child cluster deployment will be enabled since delete child master node test suite will be executed') |
| 298 | } |
| 299 | if (commitMsg ==~ /(?s).*\[child-machine-deletion-policy-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-machine-deletion-policy-test.*/) { |
| 300 | runChildMachineDeletionPolicyTest = true |
| 301 | deployChild = true |
| 302 | common.infoMsg('Child cluster deployment will be enabled since machine deletion child policy test suite will be executed') |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 303 | } |
Mikhail Nikolaenko | 7e632cd | 2022-10-24 16:20:31 +0300 | [diff] [blame] | 304 | if (commitMsg ==~ /(?s).*\[graceful-reboot-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*graceful-reboot-test.*/) { |
| 305 | runGracefulRebootTest = true |
| 306 | } |
Sergey Lalov | bc68d75 | 2022-11-08 13:40:53 +0400 | [diff] [blame] | 307 | if (commitMsg ==~ /(?s).*\[pause-for-debug\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*pause-for-debug.*/) { |
| 308 | pauseForDebug = true |
| 309 | } |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 310 | if (commitMsg ==~ /(?s).*\[child-offline\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-offline.*/) { |
| 311 | proxyConfig['childOffline'] = true |
| 312 | deployChild = true |
| 313 | } |
Владислав Наумов | 257ea13 | 2021-04-14 14:44:13 +0200 | [diff] [blame] | 314 | if (commitMsg ==~ /(?s).*\[child-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-proxy.*/) { |
| 315 | proxyConfig['childOffline'] = true |
| 316 | proxyConfig['childProxy'] = true |
| 317 | deployChild = true |
| 318 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 319 | if (commitMsg ==~ /(?s).*\[fetch.*binaries\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*fetch.*binaries.*/) { |
| 320 | fetchServiceBinaries = true |
| 321 | } |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 322 | if (commitMsg ==~ /(?s).*\[equinix-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-on-aws.*/) { |
| 323 | equinixOnAwsDemo = true |
| 324 | 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]\' ') |
| 325 | } |
| 326 | if (commitMsg ==~ /(?s).*\[azure-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-on-aws.*/) { |
| 327 | azureOnAwsDemo = true |
| 328 | common.warningMsg('Forced running child cluster deployment on Azure provider based on AWS management cluster, triggered on patchset using custom keyword: \'[azure-on-aws]\' ') |
| 329 | } |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 330 | if (commitMsg ==~ /(?s).*\[aws-demo\].*/ || |
| 331 | env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aws-demo.*/ || |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 332 | runBYOMatrix || |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 333 | seedMacOs || |
| 334 | equinixOnAwsDemo || |
| 335 | azureOnAwsDemo) { |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 336 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 337 | awsOnDemandDemo = true |
Владислав Наумов | 2d3db33 | 2021-06-15 15:19:19 +0200 | [diff] [blame] | 338 | common.warningMsg('Running additional kaas deployment with AWS provider, may be forced due applied trigger cross dependencies, follow docs to clarify info') |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 339 | } |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 340 | if (commitMsg ==~ /(?s).*\[equinix-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-demo\.*/) { |
| 341 | equinixOnDemandDemo = true |
| 342 | } |
Владислав Наумов | 82305e9 | 2021-10-14 20:45:20 +0200 | [diff] [blame] | 343 | if (commitMsg ==~ /(?s).*\[equinixmetalv2-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-demo\.*/) { |
Владислав Наумов | 144956f | 2021-10-14 17:49:19 +0200 | [diff] [blame] | 344 | equinixMetalV2OnDemandDemo = true |
| 345 | } |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 346 | if (commitMsg ==~ /(?s).*\[equinixmetalv2-child-diff-metro\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-child-diff-metro\.*/) { |
| 347 | equinixMetalV2OnDemandDemo = true |
| 348 | equinixMetalV2ChildDiffMetro = true |
| 349 | } |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 350 | if (commitMsg ==~ /(?s).*\[azure-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-demo\.*/) { |
| 351 | azureOnDemandDemo = true |
| 352 | } |
Sergey Lalov | 10cb350 | 2023-03-27 22:13:49 +0400 | [diff] [blame] | 353 | if (commitMsg ==~ /(?s).*\[disable-all-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-all-demo\.*/) { |
| 354 | enableVsphereDemo = false |
| 355 | enableOSDemo = false |
| 356 | enableBMDemo = false |
Sergey Lalov | 781fccc | 2023-10-12 21:55:17 +0400 | [diff] [blame] | 357 | enableBv2Smoke = false |
| 358 | common.errorMsg('vSphere, BM, Openstack, demo deployments and Bootstrap v2 smoke checks will be aborted, VF -1 will be set') |
Sergey Lalov | 10cb350 | 2023-03-27 22:13:49 +0400 | [diff] [blame] | 359 | } |
| 360 | |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 361 | if (commitMsg ==~ /(?s).*\[disable-os-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-os-demo\.*/) { |
| 362 | enableOSDemo = false |
| 363 | common.errorMsg('Openstack demo deployment will be aborted, VF -1 will be set') |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 364 | } |
| 365 | |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 366 | if (commitMsg ==~ /(?s).*\[disable-bm-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-demo\.*/) { |
| 367 | enableBMDemo = false |
| 368 | common.errorMsg('BM demo deployment will be aborted, VF -1 will be set') |
| 369 | } |
| 370 | |
Sergey Lalov | d0e2085 | 2023-08-17 19:11:19 +0400 | [diff] [blame] | 371 | if (commitMsg ==~ /(?s).*\[bm-core-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bm-core-demo\\.*/) { |
| 372 | enablebmCoreDemo = true |
| 373 | enableBMDemo = false |
| 374 | } |
| 375 | |
| 376 | if (commitMsg ==~ /(?s).*\[disable-bm-core-cleanup\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-core-cleanup\\.*/) { |
| 377 | bmCoreCleanup = false |
| 378 | } |
| 379 | |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 380 | if (commitMsg ==~ /(?s).*\[disable-vsphere-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-vsphere-demo\.*/) { |
| 381 | enableVsphereDemo = false |
| 382 | common.errorMsg('vSphere demo deployment will be aborted, VF -1 will be set') |
| 383 | } |
Alexandr Lovtsov | 36473f3 | 2022-04-28 15:46:09 +0300 | [diff] [blame] | 384 | if (commitMsg ==~ /(?s).*\[vsphere-ubuntu\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-ubuntu\.*/) { |
| 385 | enableVsphereUbuntu = true |
| 386 | common.warningMsg('Ubuntu will be used to deploy vsphere machines') |
| 387 | } |
Ivan Berezovskiy | 30c4b12 | 2023-11-06 18:03:18 +0500 | [diff] [blame] | 388 | if (commitMsg ==~ /(?s).*\[vsphere-rhel\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-rhel\.*/) { |
| 389 | enableVsphereRHEL = true |
| 390 | common.warningMsg('RHEL will be used to deploy vsphere machines') |
| 391 | } |
vryzhenkin | 4fd3f24 | 2023-03-29 15:13:46 +0400 | [diff] [blame] | 392 | if (commitMsg ==~ /(?s).*\[disable-bv2-smoke\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bv2-smoke\.*/) { |
| 393 | enableBv2Smoke = false |
| 394 | common.errorMsg('Bootstrap v2 smoke checks will be aborted, WF -1 will be set') |
| 395 | } |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 396 | |
vryzhenkin | 211a4e8 | 2023-11-23 12:48:27 +0400 | [diff] [blame] | 397 | if (commitMsg ==~ /(?s).*\[cve-scan\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*cve-scan\.*/) { |
| 398 | cveScan = true |
| 399 | common.errorMsg('CVE Scan job enabled') |
| 400 | } |
| 401 | |
Sergey Lalov | 7c2377e | 2023-12-15 23:14:45 +0400 | [diff] [blame] | 402 | def slackChannelMatches = (commitMsg =~ /(\[slack-channel\s*[#@](\S+)])/) |
| 403 | if (slackChannelMatches.size() > 0) { |
| 404 | // override chanenel notify when it set explicitly |
| 405 | customSlackChannel = slackChannelMatches[0][0].split("slack-channel")[1].replaceAll('[\\[\\]]', '').trim() |
| 406 | common.warningMsg("Forced send notify to ${customSlackChannel} channel") |
| 407 | } |
| 408 | |
Mikhail Ivanov | bd1a9fd | 2022-03-29 21:36:21 +0400 | [diff] [blame] | 409 | if (commitMsg ==~ /(?s).*\[disable-artifacts-build\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-artifacts-build\.*/) { |
| 410 | enableArtifactsBuild = false |
| 411 | common.errorMsg('artifacts build will be aborted, VF -1 will be set') |
| 412 | } |
| 413 | |
Sergey Zhemerdeev | e67fb26 | 2022-06-21 00:49:34 +0300 | [diff] [blame] | 414 | if (commitMsg ==~ /(?s).*\[child-os-boot-from-volume\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-os-boot-from-volume\.*/) { |
| 415 | childOsBootFromVolume = true |
| 416 | common.warningMsg('OS will be booted from Ceph volumes') |
| 417 | } |
| 418 | |
Sergey Lalov | d5efcd5 | 2023-03-01 22:42:17 +0400 | [diff] [blame] | 419 | if (commitMsg ==~ /(?s).*\[child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-custom-cert-test\.*/) { |
| 420 | runChildCustomCertTest = true |
| 421 | deployChild = true |
| 422 | common.warningMsg('Child cluster deployment will be enabled since custom cert child test suite will be executed') |
| 423 | } |
| 424 | |
Sergey Lalov | f6fbfea | 2023-04-06 17:05:40 +0400 | [diff] [blame] | 425 | if (commitMsg ==~ /(?s).*\[mgmt-custom-cache-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-custom-cache-cert-test\.*/) { |
| 426 | runMgmtCustomCacheCertTest = true |
| 427 | deployChild = true |
| 428 | common.warningMsg('Child cluster deployment will be enabled as the test replaces the mgmt and cluster childcertificates') |
| 429 | } |
| 430 | |
Sergey Lalov | 48e6902 | 2023-07-25 16:08:00 +0400 | [diff] [blame] | 431 | if (commitMsg ==~ /(?s).*\[mke-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mke-custom-cert-test\.*/) { |
| 432 | runMkeCustomCertTest = true |
| 433 | } |
| 434 | |
Sergey Lalov | 62c2831 | 2023-10-18 19:23:59 +0400 | [diff] [blame] | 435 | if (commitMsg ==~ /(?s).*\[custom-hostnames\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*custom-hostnames\.*/) { |
| 436 | runCustomHostnames = true |
| 437 | common.warningMsg('All clusters will be deployed with Custom Hostnames') |
| 438 | } |
| 439 | |
vryzhenkin | 504dfc9 | 2023-11-01 15:49:47 +0400 | [diff] [blame] | 440 | if (commitMsg ==~ /(?s).*\[sl-latest\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*sl-latest\.*/) { |
| 441 | slLatest = true |
| 442 | common.warningMsg('All clusters will be deployed with Stacklight version from artifact-metadata') |
| 443 | } |
| 444 | |
vryzhenkin | a8d74e7 | 2024-02-26 14:59:37 +0400 | [diff] [blame] | 445 | if (commitMsg ==~ /(?s).*\[keycloak-ldap\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*keycloak-ldap\.*/) { |
| 446 | coreKeycloakLdap = true |
| 447 | common.warningMsg('Management cluster will be deployed with LDAP integration enabled and after-deployment checks will be executed') |
| 448 | } |
| 449 | |
vryzhenkin | e0ff1d8 | 2024-03-18 15:08:09 +0400 | [diff] [blame] | 450 | if (commitMsg ==~ /(?s).*\[internal-ntp\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*internal-ntp\.*/ || proxyConfig['mgmtOffline'] || proxyConfig['childOffline']) { |
| 451 | configureInternalNTP = true |
Sergey Lalov | 348f945 | 2024-04-18 10:34:04 +0000 | [diff] [blame] | 452 | openstackIMC = 'eu' |
| 453 | common.warningMsg('Internal NTP servers will be used. Forced deployment for an offline case in eu cloud') |
vryzhenkin | e0ff1d8 | 2024-03-18 15:08:09 +0400 | [diff] [blame] | 454 | } |
| 455 | |
Sergey Lalov | d7593ab | 2024-01-11 13:40:13 +0400 | [diff] [blame] | 456 | if (commitMsg ==~ /(?s).*\[disable-kube-api-audit\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-kube-api-audit\.*/) { |
| 457 | disableKubeApiAudit = true |
| 458 | common.warningMsg('Disable KUBE API audit for mgmt cluster') |
| 459 | } |
| 460 | |
Sergey Lalov | 26e24c2 | 2024-03-20 13:47:31 +0400 | [diff] [blame] | 461 | if (commitMsg ==~ /(?s).*\[auditd\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-kube-api-audit\.*/) { |
| 462 | auditd = true |
| 463 | } |
| 464 | |
Sergey Lalov | 430fcd7 | 2023-03-20 17:19:44 +0400 | [diff] [blame] | 465 | if (commitMsg ==~ /(?s).*\[byo-child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-child-custom-cert-test\.*/) { |
| 466 | runByoChildCustomCertTest = true |
| 467 | attachBYO = true |
| 468 | common.warningMsg('Byo child cluster deployment will be enabled since custom cert child test suite will be executed') |
| 469 | } |
| 470 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 471 | // TODO (vnaumov) remove below condition after moving all releases to UCP |
| 472 | def ucpChildMatches = (commitMsg =~ /(\[child-ucp\s*ucp-.*?\])/) |
| 473 | if (ucpChildMatches.size() > 0) { |
| 474 | deployChild = true |
| 475 | common.warningMsg('Forced UCP based child deployment triggered on patchset using custom keyword: \'[child-ucp ucp-5-1-0-3-3-0-example]\' ') |
| 476 | |
| 477 | // TODO(vnaumov) delete after ucp upgrades support |
| 478 | common.errorMsg('Child upgrade test will be skipped, UCP upgrades temporally disabled') |
| 479 | upgradeChild = false |
| 480 | } |
| 481 | |
Mikhail Nikolaenko | c36dea9 | 2022-12-12 02:40:40 +0300 | [diff] [blame] | 482 | if (commitMsg ==~ /(?s).*\[aio-cluster\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aio-cluster.*/) { |
| 483 | aioCluster = true |
| 484 | } |
| 485 | |
Ivan Berezovskiy | 02baa98 | 2023-06-06 12:46:27 +0400 | [diff] [blame] | 486 | if (commitMsg ==~ /(?s).*\[cache-warmup\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*cache-warmup.*/) { |
| 487 | runCacheWarmup = true |
| 488 | } |
| 489 | |
| 490 | if (runCacheWarmup && (!deployChild && !mosDeployChild)) { |
| 491 | runCacheWarmup = false |
| 492 | common.errorMsg('Child cluster deployment is not enabled, skipping Cache Warmup') |
| 493 | } |
| 494 | |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 495 | // multiregional tests |
| 496 | def multiRegionalMatches = (commitMsg =~ /(\[multiregion\s*.*?\])/) |
| 497 | if (multiRegionalMatches.size() > 0) { |
| 498 | multiregionalMappings = multiregionWorkflowParser(multiRegionalMatches) |
| 499 | } |
| 500 | switch (multiregionalMappings['managementLocation']) { |
| 501 | case 'aws': |
| 502 | common.warningMsg('Forced running additional kaas deployment with AWS provider according multiregional demo request') |
| 503 | awsOnDemandDemo = true |
| 504 | |
| 505 | if (multiregionalMappings['regionLocation'] != 'aws' && seedMacOs) { // macstadium seed node has access only to *public* providers |
| 506 | error('incompatible triggers: [seed-macos] and multiregional deployment based on *private* regional provider cannot be applied simultaneously') |
| 507 | } |
| 508 | break |
| 509 | case 'os': |
| 510 | if (enableOSDemo == false) { |
| 511 | error('incompatible triggers: [disable-os-demo] and multiregional deployment based on OSt management region cannot be applied simultaneously') |
| 512 | } |
| 513 | break |
| 514 | case 'vsphere': |
| 515 | if (enableVsphereDemo == false) { |
| 516 | error('incompatible triggers: [disable-vsphere-demo] and multiregional deployment based on Vsphere management region cannot be applied simultaneously') |
| 517 | } |
| 518 | break |
| 519 | case 'equinix': |
| 520 | common.warningMsg('Forced running additional kaas deployment with Equinix provider according multiregional demo request') |
| 521 | equinixOnDemandDemo = true |
| 522 | break |
| 523 | case 'equinixmetalv2': |
| 524 | common.warningMsg('Forced running additional kaas deployment with Equinix Metal V2 provider according multiregional demo request') |
| 525 | equinixMetalV2OnDemandDemo = true |
| 526 | break |
| 527 | case 'azure': |
| 528 | common.warningMsg('Forced running additional kaas deployment with Azure provider according multiregional demo request') |
| 529 | azureOnDemandDemo = true |
| 530 | break |
| 531 | } |
| 532 | |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 533 | // CDN configuration |
| 534 | def cdnConfig = [ |
| 535 | mgmt: [ |
Sergey Lalov | f80dab5 | 2024-04-19 14:16:52 +0000 | [diff] [blame^] | 536 | openstack: 'internal-ci', |
| 537 | vsphere: 'internal-ci', |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 538 | aws: 'public-ci', |
Владислав Наумов | e021b02 | 2021-05-06 11:26:38 +0200 | [diff] [blame] | 539 | equinix: 'public-ci', |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 540 | azure: 'public-ci', |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 541 | ], |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 542 | ] |
| 543 | |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 544 | if (commitMsg ==~ /(?s).*\[eu-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*eu-demo.*/) { |
| 545 | openstackIMC = 'eu' |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 546 | } |
Sergey Lalov | ac6a8e7 | 2023-12-19 01:28:41 +0400 | [diff] [blame] | 547 | |
| 548 | if (openstackIMC == 'eu') { |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame] | 549 | // use internal-eu because on internal-ci with eu cloud image pull takes much time |
Sergey Lalov | f80dab5 | 2024-04-19 14:16:52 +0000 | [diff] [blame^] | 550 | def cdnRegion = 'internal-eu' |
slalov | 021171f | 2022-03-04 14:48:38 +0400 | [diff] [blame] | 551 | cdnConfig['mgmt']['openstack'] = cdnRegion |
| 552 | } |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 553 | |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 554 | // calculate weight of current demo run to manage lockable resources |
Sergey Lalov | 46deb44 | 2022-08-18 12:11:03 +0400 | [diff] [blame] | 555 | def demoWeight = deployChild ? 2 : 1 // management = 1, child += 1 |
Sergey Lalov | 9504060 | 2023-03-07 16:42:16 +0400 | [diff] [blame] | 556 | if (runUie2e || runUie2eNew) { |
Sergey Lalov | 46deb44 | 2022-08-18 12:11:03 +0400 | [diff] [blame] | 557 | demoWeight += 1 |
| 558 | } |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 559 | |
Sergey Lalov | eb611b2 | 2023-09-22 16:59:09 +0400 | [diff] [blame] | 560 | if (commitMsg ==~ /(?s).*\[bootstrapv1-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv1-scenario\.*/) { |
| 561 | bootstrapV2Scenario = false |
| 562 | } |
| 563 | |
Ivan Berezovskiy | 29e72b7 | 2022-07-12 21:03:24 +0400 | [diff] [blame] | 564 | if (commitMsg ==~ /(?s).*\[bootstrapv2-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv2-scenario\.*/) { |
| 565 | bootstrapV2Scenario = true |
| 566 | } |
| 567 | |
Mikhail Ivanov | 3088d3d | 2022-10-24 14:05:46 +0400 | [diff] [blame] | 568 | if (commitMsg ==~ /(?s).*\[enable-fips\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*enable-fips\.*/) { |
| 569 | enableFips = true |
| 570 | } |
| 571 | |
Sergey Lalov | 00bea0f | 2023-08-14 16:46:33 +0400 | [diff] [blame] | 572 | if (commitMsg ==~ /(?s).*\[enable-mke-debug\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*enable-mke-debug\.*/) { |
| 573 | enableMkeDebug = true |
| 574 | } |
| 575 | |
Mikhail Morgoev | 58855c1 | 2023-02-10 14:57:31 +0100 | [diff] [blame] | 576 | if (commitMsg ==~ /(?s).*\[vsphere-vvmt-obj\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-vvmt-obj\.*/) { |
| 577 | useVsphereVvmtObjects = true |
| 578 | } |
| 579 | |
Sergey Zhemerdeev | dd31ce9 | 2022-07-19 14:15:22 +0300 | [diff] [blame] | 580 | // parse equinixmetalv2-metro trigger |
Sergey Zhemerdeev | dd31ce9 | 2022-07-19 14:15:22 +0300 | [diff] [blame] | 581 | def equinixMetalV2MetroMatcher = (commitMsg =~ /\[equinixmetalv2-metro(\s+.*)?\]/) |
| 582 | if (equinixMetalV2OnDemandDemo && equinixMetalV2MetroMatcher.size() > 0) { |
Sergey Zhemerdeev | cc785e4 | 2022-07-22 17:15:47 +0300 | [diff] [blame] | 583 | equinixMetalV2Metro = equinixMetalV2MetroMatcher[0][1].trim().toLowerCase() |
Sergey Zhemerdeev | dd31ce9 | 2022-07-19 14:15:22 +0300 | [diff] [blame] | 584 | common.infoMsg("Forced Equnix mgmt deployment using custom metro ${equinixMetalV2Metro}") |
| 585 | } |
| 586 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 587 | common.infoMsg(""" |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 588 | OpenStack Cloud location: ${openstackIMC} |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 589 | CDN deployment configuration: ${cdnConfig} |
| 590 | MCC offline deployment configuration: ${proxyConfig} |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 591 | Use MacOS node as seed: ${seedMacOs} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 592 | Child cluster deployment scheduled: ${deployChild} |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 593 | Custom child cluster release: ${customChildRelease} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 594 | Child cluster release upgrade scheduled: ${upgradeChild} |
Sergey Lalov | c1cb49f | 2022-09-27 01:16:25 +0400 | [diff] [blame] | 595 | Full Child cluster release upgrade scheduled: ${fullUpgradeChild} |
Mikhail Ivanov | 38ee438 | 2022-01-27 16:21:51 +0400 | [diff] [blame] | 596 | MOS child deploy scheduled: ${mosDeployChild} |
| 597 | MOS child upgrade scheduled: ${mosUpgradeChild} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 598 | Child conformance testing scheduled: ${runChildConformance} |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 599 | Child conformance network policy testing scheduled: ${runChildConformanceNetworkPolicy} |
vryzhenkin | b286bd8 | 2023-04-04 07:17:52 +0400 | [diff] [blame] | 600 | Child HPA testing scheduled: ${runChildHPA} |
Sergey Lalov | 012496a | 2023-11-27 15:57:52 +0400 | [diff] [blame] | 601 | Child Stacklight HA: ${runChildStacklightHa} |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 602 | Single BYO cluster attachment scheduled: ${attachBYO} |
| 603 | Single Attached BYO cluster upgrade test scheduled: ${upgradeBYO} |
| 604 | BYO test matrix whole suite scheduled: ${runBYOMatrix} |
Mikhail Ivanov | eabc9d9 | 2021-12-30 16:40:14 +0400 | [diff] [blame] | 605 | Default BYO OS: ${defaultBYOOs} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 606 | Mgmt cluster release upgrade scheduled: ${upgradeMgmt} |
slalov | 1202bba | 2022-04-20 22:31:07 +0400 | [diff] [blame] | 607 | Mgmt cluster release auto upgrade scheduled: ${autoUpgradeMgmt} |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 608 | Mgmt LMA logging enabled: ${enableLMALogging} |
Sergey Lalov | b2f6037 | 2022-09-20 23:58:47 +0400 | [diff] [blame] | 609 | Deploy Os on child with mos release ${deployOsOnMos} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 610 | Mgmt conformance testing scheduled: ${runMgmtConformance} |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 611 | Mgmt conformance network policy testing scheduled: ${runMgmtConformanceNetworkPolicy} |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 612 | LMA testing scheduled: ${runLMATest} |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 613 | Mgmt user controller testing scheduled: ${runMgmtUserControllerTest} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 614 | Mgmt UI e2e testing scheduled: ${runUie2e} |
Mikhail Ivanov | f5e20af | 2022-03-24 15:38:06 +0400 | [diff] [blame] | 615 | Mgmt UI e2e playwrite testing scheduled: ${runUie2eNew} |
slalov | 13e579c | 2022-01-31 21:37:02 +0400 | [diff] [blame] | 616 | Maintenance test: ${runMaintenanceTest} |
slalov | 0a4947a | 2022-06-09 15:44:35 +0400 | [diff] [blame] | 617 | Container Registry test: ${runContainerregistryTest} |
slalov | 574123e | 2022-04-06 17:24:19 +0400 | [diff] [blame] | 618 | Child proxy test: ${runProxyChildTest} |
Mikhail Nikolaenko | 7e632cd | 2022-10-24 16:20:31 +0300 | [diff] [blame] | 619 | Graceful reboot test: ${runGracefulRebootTest} |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 620 | Delete mgmt master node test: ${runMgmtDeleteMasterTest} |
| 621 | Delete rgnl master node test: ${runRgnlDeleteMasterTest} |
| 622 | Delete child master node test: ${runChildDeleteMasterTest} |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 623 | Child machine deletion policy test: ${runChildMachineDeletionPolicyTest} |
Sergey Lalov | d5efcd5 | 2023-03-01 22:42:17 +0400 | [diff] [blame] | 624 | Custom cert test for child clusters: ${runChildCustomCertTest} |
Sergey Lalov | 430fcd7 | 2023-03-20 17:19:44 +0400 | [diff] [blame] | 625 | Custom cert test for Byo child clusters: ${runByoChildCustomCertTest} |
Sergey Lalov | f6fbfea | 2023-04-06 17:05:40 +0400 | [diff] [blame] | 626 | Custom cache cert test for mgmt and child clusters: ${runMgmtCustomCacheCertTest} |
Sergey Lalov | 48e6902 | 2023-07-25 16:08:00 +0400 | [diff] [blame] | 627 | MKE custom cert test for mgmt/region: ${runMkeCustomCertTest} |
Sergey Lalov | 62c2831 | 2023-10-18 19:23:59 +0400 | [diff] [blame] | 628 | Custom hostnames for all clisuers: ${runCustomHostnames} |
vryzhenkin | 504dfc9 | 2023-11-01 15:49:47 +0400 | [diff] [blame] | 629 | Stacklight templates enchanced with latest version from artifact-metadata: ${slLatest} |
Sergey Lalov | d7593ab | 2024-01-11 13:40:13 +0400 | [diff] [blame] | 630 | Disable Kubernetes API audit: ${disableKubeApiAudit} |
Sergey Lalov | 26e24c2 | 2024-03-20 13:47:31 +0400 | [diff] [blame] | 631 | Enable Auditd : ${auditd} |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 632 | AWS provider deployment scheduled: ${awsOnDemandDemo} |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 633 | Equinix provider deployment scheduled: ${equinixOnDemandDemo} |
Владислав Наумов | 144956f | 2021-10-14 17:49:19 +0200 | [diff] [blame] | 634 | EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo} |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 635 | EquinixmetalV2 child deploy in a separate metro scheduled: ${equinixMetalV2ChildDiffMetro} |
Sergey Zhemerdeev | 019c45a | 2022-08-13 00:09:07 +0300 | [diff] [blame] | 636 | EquinixmetalV2 mgmt will be deployed on the metro: ${equinixMetalV2Metro?:'auto'} |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 637 | Equinix@AWS child cluster deployment scheduled: ${equinixOnAwsDemo} |
| 638 | Azure provider deployment scheduled: ${azureOnDemandDemo} |
| 639 | Azure@AWS child cluster deployment scheduled: ${azureOnAwsDemo} |
Ivan Berezovskiy | f9bcfd6 | 2021-03-18 18:41:38 +0400 | [diff] [blame] | 640 | VSPHERE provider deployment scheduled: ${enableVsphereDemo} |
Владислав Наумов | 4eb1da3 | 2020-08-31 14:45:16 +0200 | [diff] [blame] | 641 | OS provider deployment scheduled: ${enableOSDemo} |
Sergey Lalov | d0e2085 | 2023-08-17 19:11:19 +0400 | [diff] [blame] | 642 | BM Core provider deployment scheduled: ${enablebmCoreDemo} |
| 643 | BM Core type deplyment: ${bmDeployType} |
| 644 | BM Core cleanup: ${bmCoreCleanup} |
azvyagintsev | 1761bdc | 2020-09-04 17:24:12 +0300 | [diff] [blame] | 645 | BM provider deployment scheduled: ${enableBMDemo} |
Alexandr Lovtsov | 36473f3 | 2022-04-28 15:46:09 +0300 | [diff] [blame] | 646 | Ubuntu on vSphere scheduled: ${enableVsphereUbuntu} |
Ivan Berezovskiy | 30c4b12 | 2023-11-06 18:03:18 +0500 | [diff] [blame] | 647 | RHEL on vSphere scheduled: ${enableVsphereRHEL} |
Mikhail Ivanov | bd1a9fd | 2022-03-29 21:36:21 +0400 | [diff] [blame] | 648 | Artifacts build scheduled: ${enableArtifactsBuild} |
Sergey Zhemerdeev | e67fb26 | 2022-06-21 00:49:34 +0300 | [diff] [blame] | 649 | Boot OS child from Ceph volumes: ${childOsBootFromVolume} |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 650 | Multiregional configuration: ${multiregionalMappings} |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 651 | Service binaries fetching scheduled: ${fetchServiceBinaries} |
Владислав Наумов | 74e2d6e | 2020-12-30 17:05:40 +0100 | [diff] [blame] | 652 | Current weight of the demo run: ${demoWeight} (Used to manage lockable resources) |
Ivan Berezovskiy | 29e72b7 | 2022-07-12 21:03:24 +0400 | [diff] [blame] | 653 | Bootstrap v2 scenario enabled: ${bootstrapV2Scenario} |
Mikhail Ivanov | 3088d3d | 2022-10-24 14:05:46 +0400 | [diff] [blame] | 654 | FIPS enabled: ${enableFips} |
Sergey Lalov | 00bea0f | 2023-08-14 16:46:33 +0400 | [diff] [blame] | 655 | MKE DEBUG enabled: ${enableMkeDebug} |
Sergey Lalov | bc68d75 | 2022-11-08 13:40:53 +0400 | [diff] [blame] | 656 | Pause for debug enabled: ${pauseForDebug} |
Mikhail Nikolaenko | c36dea9 | 2022-12-12 02:40:40 +0300 | [diff] [blame] | 657 | AIO cluster: ${aioCluster} |
Mikhail Morgoev | 58855c1 | 2023-02-10 14:57:31 +0100 | [diff] [blame] | 658 | Use Vsphere VVMT Objects: ${useVsphereVvmtObjects} |
vryzhenkin | 4fd3f24 | 2023-03-29 15:13:46 +0400 | [diff] [blame] | 659 | Bootsrap v2 smoke checks enabled: ${enableBv2Smoke} |
Ivan Berezovskiy | 02baa98 | 2023-06-06 12:46:27 +0400 | [diff] [blame] | 660 | Run Cache warmup for child clusters: ${runCacheWarmup} |
vryzhenkin | 211a4e8 | 2023-11-23 12:48:27 +0400 | [diff] [blame] | 661 | CVE Scan enabled: ${cveScan} |
vryzhenkin | a8d74e7 | 2024-02-26 14:59:37 +0400 | [diff] [blame] | 662 | Keycloak+LDAP integration enabled: ${coreKeycloakLdap} |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 663 | Triggers: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""") |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 664 | return [ |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 665 | osCloudLocation : openstackIMC, |
| 666 | cdnConfig : cdnConfig, |
| 667 | proxyConfig : proxyConfig, |
| 668 | useMacOsSeedNode : seedMacOs, |
| 669 | deployChildEnabled : deployChild, |
| 670 | childDeployCustomRelease : customChildRelease, |
| 671 | upgradeChildEnabled : upgradeChild, |
| 672 | fullUpgradeChildEnabled : fullUpgradeChild, |
| 673 | mosDeployChildEnabled : mosDeployChild, |
| 674 | mosUpgradeChildEnabled : mosUpgradeChild, |
| 675 | runChildConformanceEnabled : runChildConformance, |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 676 | runChildConformanceNetworkPolicyEnabled : runChildConformanceNetworkPolicy, |
vryzhenkin | b286bd8 | 2023-04-04 07:17:52 +0400 | [diff] [blame] | 677 | runChildHPAEnabled : runChildHPA, |
Sergey Lalov | 012496a | 2023-11-27 15:57:52 +0400 | [diff] [blame] | 678 | runChildStacklightHaEnabled : runChildStacklightHa, |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 679 | attachBYOEnabled : attachBYO, |
| 680 | upgradeBYOEnabled : upgradeBYO, |
| 681 | runBYOMatrixEnabled : runBYOMatrix, |
| 682 | defaultBYOOs : defaultBYOOs, |
| 683 | upgradeMgmtEnabled : upgradeMgmt, |
| 684 | autoUpgradeMgmtEnabled : autoUpgradeMgmt, |
| 685 | enableLMALoggingEnabled : enableLMALogging, |
| 686 | deployOsOnMosEnabled : deployOsOnMos, |
| 687 | runUie2eEnabled : runUie2e, |
| 688 | runUie2eNewEnabled : runUie2eNew, |
| 689 | runMgmtConformanceEnabled : runMgmtConformance, |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 690 | runMgmtConformanceNetworkPolicyEnabled : runMgmtConformanceNetworkPolicy, |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 691 | runMaintenanceTestEnabled : runMaintenanceTest, |
| 692 | runContainerregistryTestEnabled : runContainerregistryTest, |
| 693 | runGracefulRebootTestEnabled : runGracefulRebootTest, |
| 694 | pauseForDebugEnabled : pauseForDebug, |
| 695 | runMgmtDeleteMasterTestEnabled : runMgmtDeleteMasterTest, |
| 696 | runRgnlDeleteMasterTestEnabled : runRgnlDeleteMasterTest, |
| 697 | runChildDeleteMasterTestEnabled : runChildDeleteMasterTest, |
Sergey Lalov | d5efcd5 | 2023-03-01 22:42:17 +0400 | [diff] [blame] | 698 | runChildCustomCertTestEnabled : runChildCustomCertTest, |
Sergey Lalov | 7c2377e | 2023-12-15 23:14:45 +0400 | [diff] [blame] | 699 | customSlackChannelEnabled : customSlackChannel, |
Sergey Lalov | f6fbfea | 2023-04-06 17:05:40 +0400 | [diff] [blame] | 700 | runMgmtCustomCacheCertTestEnabled : runMgmtCustomCacheCertTest, |
Sergey Lalov | 48e6902 | 2023-07-25 16:08:00 +0400 | [diff] [blame] | 701 | runMkeCustomCertTestEnabled : runMkeCustomCertTest, |
Sergey Lalov | 62c2831 | 2023-10-18 19:23:59 +0400 | [diff] [blame] | 702 | runCustomHostnamesEnabled : runCustomHostnames, |
vryzhenkin | 504dfc9 | 2023-11-01 15:49:47 +0400 | [diff] [blame] | 703 | slLatestEnabled : slLatest, |
Sergey Lalov | 430fcd7 | 2023-03-20 17:19:44 +0400 | [diff] [blame] | 704 | runByoChildCustomCertTestEnabled : runByoChildCustomCertTest, |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 705 | runChildMachineDeletionPolicyTestEnabled : runChildMachineDeletionPolicyTest, |
| 706 | runLMATestEnabled : runLMATest, |
| 707 | runMgmtUserControllerTestEnabled : runMgmtUserControllerTest, |
| 708 | runProxyChildTestEnabled : runProxyChildTest, |
| 709 | fetchServiceBinariesEnabled : fetchServiceBinaries, |
| 710 | awsOnDemandDemoEnabled : awsOnDemandDemo, |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 711 | equinixOnDemandDemoEnabled : equinixOnDemandDemo, |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 712 | equinixMetalV2OnDemandDemoEnabled : equinixMetalV2OnDemandDemo, |
| 713 | equinixMetalV2ChildDiffMetroEnabled : equinixMetalV2ChildDiffMetro, |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 714 | equinixOnAwsDemoEnabled : equinixOnAwsDemo, |
| 715 | azureOnDemandDemoEnabled : azureOnDemandDemo, |
| 716 | azureOnAwsDemoEnabled : azureOnAwsDemo, |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 717 | vsphereDemoEnabled : enableVsphereDemo, |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 718 | bmDemoEnabled : enableBMDemo, |
Sergey Lalov | d0e2085 | 2023-08-17 19:11:19 +0400 | [diff] [blame] | 719 | bmCoreDemoEnabled : enablebmCoreDemo, |
| 720 | bmCoreCleanup : bmCoreCleanup, |
Sergey Lalov | 4ea2cbc | 2024-04-04 21:41:47 +0400 | [diff] [blame] | 721 | bmDeployType : bmDeployType, |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 722 | osDemoEnabled : enableOSDemo, |
| 723 | vsphereUbuntuEnabled : enableVsphereUbuntu, |
Ivan Berezovskiy | 30c4b12 | 2023-11-06 18:03:18 +0500 | [diff] [blame] | 724 | vsphereRHELEnabled : enableVsphereRHEL, |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 725 | artifactsBuildEnabled : enableArtifactsBuild, |
| 726 | childOsBootFromVolume : childOsBootFromVolume, |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 727 | multiregionalConfiguration : multiregionalMappings, |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 728 | demoWeight : demoWeight, |
| 729 | bootstrapV2Scenario : bootstrapV2Scenario, |
| 730 | equinixMetalV2Metro : equinixMetalV2Metro, |
Mikhail Nikolaenko | c36dea9 | 2022-12-12 02:40:40 +0300 | [diff] [blame] | 731 | enableFips : enableFips, |
Sergey Lalov | 00bea0f | 2023-08-14 16:46:33 +0400 | [diff] [blame] | 732 | enableMkeDebugEnabled : enableMkeDebug, |
Mikhail Morgoev | 58855c1 | 2023-02-10 14:57:31 +0100 | [diff] [blame] | 733 | aioCluster : aioCluster, |
vryzhenkin | 4fd3f24 | 2023-03-29 15:13:46 +0400 | [diff] [blame] | 734 | useVsphereVvmtObjects : useVsphereVvmtObjects, |
Ivan Berezovskiy | 02baa98 | 2023-06-06 12:46:27 +0400 | [diff] [blame] | 735 | bv2SmokeEnabled : enableBv2Smoke, |
| 736 | runCacheWarmup : runCacheWarmup, |
vryzhenkin | 211a4e8 | 2023-11-23 12:48:27 +0400 | [diff] [blame] | 737 | cveScanEnabled : cveScan, |
Sergey Lalov | d7593ab | 2024-01-11 13:40:13 +0400 | [diff] [blame] | 738 | disableKubeApiAudit : disableKubeApiAudit, |
Sergey Lalov | 26e24c2 | 2024-03-20 13:47:31 +0400 | [diff] [blame] | 739 | auditdEnabled : auditd, |
vryzhenkin | a8d74e7 | 2024-02-26 14:59:37 +0400 | [diff] [blame] | 740 | coreKeycloakLdapEnabled : coreKeycloakLdap, |
vryzhenkin | e0ff1d8 | 2024-03-18 15:08:09 +0400 | [diff] [blame] | 741 | internalNTPServersEnabled : configureInternalNTP, |
Ivan Berezovskiy | 02baa98 | 2023-06-06 12:46:27 +0400 | [diff] [blame] | 742 | ] |
Владислав Наумов | 765f3bd | 2020-09-07 18:09:24 +0200 | [diff] [blame] | 743 | } |
| 744 | |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 745 | /** |
| 746 | * Determine management and regional setup for demo workflow scenario |
| 747 | * |
| 748 | * |
| 749 | * @param: keyword (string) string , represents keyword trigger, specified in gerrit commit body, like `[multiregion aws,os]` |
| 750 | or Jenkins environment string variable in form like 'aws,os' |
| 751 | * @return (map)[ |
| 752 | enabled: (bool), |
| 753 | * managementLocation: (string), //aws,os |
| 754 | * regionLocation: (string), //aws,os |
| 755 | * ] |
| 756 | */ |
| 757 | def multiregionWorkflowParser(keyword) { |
| 758 | def common = new com.mirantis.mk.Common() |
| 759 | def supportedManagementProviders = ['os', 'aws', 'vsphere', 'equinix', 'equinixmetalv2', 'azure'] |
| 760 | def supportedRegionalProviders = ['os', 'vsphere', 'equinix', 'equinixmetalv2', 'bm', 'azure', 'aws'] |
| 761 | |
| 762 | def clusterTypes = '' |
| 763 | if (keyword.toString().contains('multiregion')) { |
| 764 | common.infoMsg('Multiregion definition configured via gerrit keyword trigger') |
| 765 | clusterTypes = keyword[0][0].split('multiregion')[1].replaceAll('[\\[\\]]', '').trim().split(',') |
| 766 | } else { |
| 767 | common.infoMsg('Multiregion definition configured via environment variable') |
| 768 | clusterTypes = keyword.trim().split(',') |
| 769 | } |
| 770 | |
| 771 | if (clusterTypes.size() != 2) { |
| 772 | error("Incorrect regions definiton, valid scheme: [multiregion ${management}, ${region}], got: ${clusterTypes}") |
| 773 | } |
| 774 | |
| 775 | def desiredManagementProvider = clusterTypes[0].trim() |
| 776 | def desiredRegionalProvider = clusterTypes[1].trim() |
| 777 | if (! supportedManagementProviders.contains(desiredManagementProvider) || ! supportedRegionalProviders.contains(desiredRegionalProvider)) { |
| 778 | error("""unsupported management <-> regional bundle, available options: |
| 779 | management providers list - ${supportedManagementProviders} |
| 780 | regional providers list - ${supportedRegionalProviders}""") |
| 781 | } |
| 782 | |
| 783 | return [ |
| 784 | enabled: true, |
| 785 | managementLocation: desiredManagementProvider, |
| 786 | regionLocation: desiredRegionalProvider, |
| 787 | ] |
| 788 | } |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 789 | |
| 790 | /** |
| 791 | * Determine if custom si tests/pipelines refspec forwarded from gerrit change request |
| 792 | |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 793 | * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 794 | * Used for components team to test component changes w/ custom SI refspecs using kaas/core deployment jobs |
| 795 | * Example scheme: |
| 796 | * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| 797 | * manage refspecs through Jenkins Job Parameters |
| 798 | * |
azvyagintsev | a12230a | 2020-06-05 13:24:06 +0300 | [diff] [blame] | 799 | * @return (map)[* siTests: (string) final refspec for si-tests |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 800 | * siPipelines: (string) final refspec for si-pipelines |
| 801 | * ] |
| 802 | */ |
| 803 | def checkCustomSIRefspec() { |
vnaumov | bdb9022 | 2020-05-04 18:25:50 +0200 | [diff] [blame] | 804 | def common = new com.mirantis.mk.Common() |
| 805 | |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 806 | // Available triggers and its sane defaults |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 807 | def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master' |
| 808 | def siPipelinesRefspec = env.SI_PIPELINES_REFSPEC ?: 'master' |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 809 | def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test' |
| 810 | def siTestsDockerImageTag = env.SI_TESTS_DOCKER_IMAGE_TAG ?: 'master' |
Владислав Наумов | 6c2afff | 2020-06-05 12:54:53 +0200 | [diff] [blame] | 811 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 812 | |
| 813 | def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/) |
| 814 | def siPipelinesMatches = (commitMsg =~ /(\[si-pipelines-ref\s*refs\/changes\/.*?\])/) |
| 815 | |
| 816 | if (siTestMatches.size() > 0) { |
| 817 | siTestsRefspec = siTestMatches[0][0].split('si-tests-ref')[1].replaceAll('[\\[\\]]', '').trim() |
Владислав Наумов | 7f6c088 | 2021-03-23 19:10:57 +0400 | [diff] [blame] | 818 | siTestsDockerImage = "docker-review-local.docker.mirantis.net/review/kaas-si-test-${siTestsRefspec.split('/')[-2]}" |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 819 | siTestsDockerImageTag = siTestsRefspec.split('/')[-1] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 820 | } |
| 821 | if (siPipelinesMatches.size() > 0) { |
| 822 | siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 823 | } |
| 824 | |
| 825 | common.infoMsg(""" |
| 826 | kaas/si-pipelines will be fetched from: ${siPipelinesRefspec} |
| 827 | kaas/si-tests will be fetched from: ${siTestsRefspec} |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 828 | kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}:${siTestsDockerImageTag} |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 829 | Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""") |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 830 | return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage, siTestsDockerImageTag: siTestsDockerImageTag] |
vnaumov | 33747e1 | 2020-05-04 17:35:20 +0200 | [diff] [blame] | 831 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 832 | |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 833 | /** |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 834 | * Parse additional configuration for kaas component CICD repo |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 835 | * @param configurationFile (str) path to configuration file in yaml format |
| 836 | * |
| 837 | * @return (map)[ siTestsFeatureFlags (string) dedicated feature flags that will be used in SI tests, |
Alexandr Lovtsov | 1c78e45 | 2022-08-29 20:57:51 +0300 | [diff] [blame] | 838 | * siTestsFeatureFlagsStable (string) dedicated feature flags that will be used in SI tests for deploying stable release |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 839 | * ] |
| 840 | */ |
| 841 | def parseKaaSComponentCIParameters(configurationFile){ |
| 842 | def common = new com.mirantis.mk.Common() |
| 843 | def ciConfig = readYaml file: configurationFile |
| 844 | def ciSpec = [ |
| 845 | siTestsFeatureFlags: env.SI_TESTS_FEATURE_FLAGS ?: '', |
Alexandr Lovtsov | 1c78e45 | 2022-08-29 20:57:51 +0300 | [diff] [blame] | 846 | siTestsFeatureFlagsStable: env.SI_TESTS_FEATURE_FLAGS_STABLE ?: '', |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 847 | ] |
| 848 | |
Alexandr Lovtsov | 1c78e45 | 2022-08-29 20:57:51 +0300 | [diff] [blame] | 849 | // If exists and not empty |
| 850 | if (ciConfig.getOrDefault('si-tests-feature-flags', [])) { |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 851 | common.infoMsg("""SI tests feature flags customization detected, |
| 852 | results will be merged with existing flags: [${ciSpec['siTestsFeatureFlags']}] identification...""") |
| 853 | |
| 854 | def ffMeta = ciSpec['siTestsFeatureFlags'].tokenize(',').collect { it.trim() } |
| 855 | ffMeta.addAll(ciConfig['si-tests-feature-flags']) |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 856 | |
Владислав Наумов | cb5ffca | 2020-07-14 15:28:36 +0200 | [diff] [blame] | 857 | ciSpec['siTestsFeatureFlags'] = ffMeta.unique().join(',') |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 858 | common.infoMsg("SI tests custom feature flags: ${ciSpec['siTestsFeatureFlags']}") |
| 859 | } |
Alexandr Lovtsov | 1c78e45 | 2022-08-29 20:57:51 +0300 | [diff] [blame] | 860 | if (ciConfig.getOrDefault('si-tests-feature-flags-stable', [])) { |
| 861 | common.infoMsg("""SI tests feature flags for stable release customization detected, |
| 862 | results will be merged with existing flags: [${ciSpec['siTestsFeatureFlagsStable']}] identification...""") |
| 863 | |
| 864 | def ffMeta = ciSpec['siTestsFeatureFlagsStable'].tokenize(',').collect { it.trim() } |
| 865 | ffMeta.addAll(ciConfig['si-tests-feature-flags-stable']) |
| 866 | |
| 867 | ciSpec['siTestsFeatureFlagsStable'] = ffMeta.unique().join(',') |
| 868 | common.infoMsg("SI tests custom feature flags for stable release: ${ciSpec['siTestsFeatureFlagsStable']}") |
| 869 | } |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 870 | |
| 871 | common.infoMsg("""Additional ci configuration parsed successfully: |
Alexandr Lovtsov | 1c78e45 | 2022-08-29 20:57:51 +0300 | [diff] [blame] | 872 | siTestsFeatureFlags: ${ciSpec['siTestsFeatureFlags']} |
| 873 | siTestsFeatureFlagsStable: ${ciSpec['siTestsFeatureFlagsStable']}""") |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 874 | return ciSpec |
| 875 | } |
| 876 | |
| 877 | /** |
| 878 | * Determine if custom kaas core/pipelines refspec forwarded from gerrit change request |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 879 | |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 880 | * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 881 | * Used for components team to test component changes w/ custom Core refspecs using kaas/core deployment jobs |
| 882 | * Example scheme: |
| 883 | * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| 884 | * manage refspecs through Jenkins Job Parameters |
| 885 | * |
| 886 | * @return (map)[ core: (string) final refspec for kaas/core |
| 887 | * corePipelines: (string) final refspec for pipelines in kaas/core |
| 888 | * ] |
| 889 | */ |
| 890 | def checkCustomCoreRefspec() { |
| 891 | def common = new com.mirantis.mk.Common() |
| 892 | |
| 893 | // Available triggers and its sane defaults |
| 894 | def coreRefspec = env.KAAS_CORE_REFSPEC ?: 'master' |
| 895 | // by default using value of GERRIT_REFSPEC parameter in *kaas/core jobs* |
| 896 | def corePipelinesRefspec = env.KAAS_PIPELINE_REFSPEC ?: '\$GERRIT_REFSPEC' |
| 897 | def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| 898 | |
| 899 | def coreMatches = (commitMsg =~ /(\[core-ref\s*refs\/changes\/.*?\])/) |
| 900 | def corePipelinesMatches = (commitMsg =~ /(\[core-pipelines-ref\s*refs\/changes\/.*?\])/) |
| 901 | |
| 902 | if (coreMatches.size() > 0) { |
| 903 | coreRefspec = coreMatches[0][0].split('core-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 904 | } |
| 905 | if (corePipelinesMatches.size() > 0) { |
| 906 | corePipelinesRefspec = corePipelinesMatches[0][0].split('core-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| 907 | } |
| 908 | |
| 909 | common.infoMsg(""" |
| 910 | kaas/core will be fetched from: ${coreRefspec} |
| 911 | kaas/core pipelines will be fetched from: ${corePipelinesRefspec} |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 912 | Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""") |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 913 | return [core: coreRefspec, corePipelines: corePipelinesRefspec] |
| 914 | } |
| 915 | |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 916 | |
| 917 | /** |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 918 | * generate Jenkins Parameter objects from from text parameter with additonal kaas core context |
| 919 | * needed to forward inside kaas core set of jobs |
| 920 | * |
| 921 | * @param context (string) Representation of the string enviroment variables needed for kaas core jobs in yaml format |
| 922 | * @return (list)[ string(name: '', value: ''), |
| 923 | * ] |
| 924 | */ |
| 925 | def generateKaaSVarsFromContext(context) { |
| 926 | def common = new com.mirantis.mk.Common() |
| 927 | def parameters = [] |
| 928 | def config = readYaml text: context |
| 929 | |
| 930 | config.each { k,v -> |
| 931 | common.infoMsg("Custom KaaS Core context parameter: ${k}=${v}") |
| 932 | parameters.add(string(name: k, value: v)) |
| 933 | } |
| 934 | |
| 935 | return parameters |
| 936 | } |
| 937 | |
| 938 | /** |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 939 | * Trigger KaaS demo jobs based on AWS/OS providers with customized test suite, parsed from external sources (gerrit commit/jj vars) |
Владислав Наумов | 8177747 | 2021-03-09 15:14:27 +0400 | [diff] [blame] | 940 | * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 941 | * Used for components team to test component changes w/ customized SI tests/refspecs using kaas/core deployment jobs |
| 942 | * |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 943 | * @param: component (string) component name [iam, lcm, stacklight] |
| 944 | * @param: patchSpec (string) Patch for kaas/cluster releases in json format |
| 945 | * @param: configurationFile (string) Additional file for component repo CI config in yaml format |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 946 | */ |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 947 | def triggerPatchedComponentDemo(component, patchSpec = '', configurationFile = '.ci-parameters.yaml', coreContext = '') { |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 948 | def common = new com.mirantis.mk.Common() |
| 949 | // Determine if custom trigger keywords forwarded from gerrit |
| 950 | def triggers = checkDeploymentTestSuite() |
| 951 | // Determine SI refspecs |
| 952 | def siRefspec = checkCustomSIRefspec() |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 953 | // Determine Core refspecs |
| 954 | def coreRefspec = checkCustomCoreRefspec() |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 955 | |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 956 | // Determine component repo ci configuration |
| 957 | def ciSpec = [:] |
| 958 | def componentFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: '' |
| 959 | if (fileExists(configurationFile)) { |
| 960 | common.infoMsg('Component CI configuration file detected, parsing...') |
| 961 | ciSpec = parseKaaSComponentCIParameters(configurationFile) |
| 962 | componentFeatureFlags = ciSpec['siTestsFeatureFlags'] |
| 963 | } else { |
| 964 | common.warningMsg('''Component CI configuration file is not exists, |
Владислав Наумов | c17dd55 | 2020-07-29 17:07:38 +0200 | [diff] [blame] | 965 | several code-management features may be unavailable, |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 966 | follow https://mirantis.jira.com/wiki/spaces/QA/pages/2310832276/SI-tests+feature+flags#%5BUpdated%5D-Using-a-feature-flag |
| 967 | to create the configuration file''') |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 968 | } |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 969 | |
| 970 | def platforms = [] |
| 971 | if (component == 'ipam' && triggers.vsphereDemoEnabled) { |
| 972 | // Currently only vsphere demo is required for IPAM component |
| 973 | platforms.add('vsphere') |
| 974 | } else { |
| 975 | if (triggers.osDemoEnabled) { |
| 976 | platforms.add('openstack') |
| 977 | } |
| 978 | if (triggers.awsOnDemandDemoEnabled) { |
| 979 | platforms.add('aws') |
| 980 | } |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 981 | if (triggers.equinixOnDemandDemoEnabled) { |
| 982 | platforms.add('equinix') |
| 983 | } |
Владислав Наумов | 144956f | 2021-10-14 17:49:19 +0200 | [diff] [blame] | 984 | if (triggers.equinixMetalV2OnDemandDemoEnabled) { |
| 985 | platforms.add('equinixmetalv2') |
| 986 | } |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 987 | if (triggers.azureOnDemandDemoEnabled) { |
| 988 | platforms.add('azure') |
| 989 | } |
Ivan Berezovskiy | b0229d0 | 2021-05-17 16:55:18 +0400 | [diff] [blame] | 990 | if (triggers.vsphereDemoEnabled) { |
| 991 | platforms.add('vsphere') |
| 992 | } |
Sergey Kolekonov | 8e4de18 | 2024-03-05 15:07:07 +0500 | [diff] [blame] | 993 | if (triggers.bmCoreDemoEnabled) { |
| 994 | platforms.add('bm') |
| 995 | } |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 996 | } |
| 997 | |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 998 | def jobs = [:] |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 999 | def parameters = [ |
Владислав Наумов | 9080f37 | 2020-06-08 13:57:16 +0200 | [diff] [blame] | 1000 | string(name: 'GERRIT_REFSPEC', value: coreRefspec.core), |
| 1001 | string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 1002 | string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests), |
Владислав Наумов | 418042b | 2020-07-09 18:31:10 +0200 | [diff] [blame] | 1003 | string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags), |
Владислав Наумов | 2db15e2 | 2020-07-14 12:29:22 +0200 | [diff] [blame] | 1004 | string(name: 'SI_TESTS_DOCKER_IMAGE', value: siRefspec.siTestsDockerImage), |
| 1005 | string(name: 'SI_TESTS_DOCKER_IMAGE_TAG', value: siRefspec.siTestsDockerImageTag), |
Владислав Наумов | 4a5c324 | 2020-06-08 14:36:11 +0200 | [diff] [blame] | 1006 | string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 1007 | string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec), |
Mikhail Ivanov | 7450437 | 2021-05-21 17:01:06 +0400 | [diff] [blame] | 1008 | string(name: 'KAAS_CHILD_CLUSTER_RELEASE_NAME', value: triggers.childDeployCustomRelease), |
Mikhail Ivanov | b6283f7 | 2021-11-24 18:34:57 +0400 | [diff] [blame] | 1009 | string(name: 'OPENSTACK_CLOUD_LOCATION', value: triggers.osCloudLocation), |
Sergey Lalov | 7c2377e | 2023-12-15 23:14:45 +0400 | [diff] [blame] | 1010 | string(name: 'SLACK_CHANNEL_NOTIFY', value: triggers.customSlackChannelEnabled), |
Sergey Lalov | 4ea2cbc | 2024-04-04 21:41:47 +0400 | [diff] [blame] | 1011 | string(name: 'BM_DEPLOY_TYPE', value: triggers.bmDeployType), |
Владислав Наумов | b8305e2 | 2021-02-10 17:23:12 +0100 | [diff] [blame] | 1012 | booleanParam(name: 'OFFLINE_MGMT_CLUSTER', value: triggers.proxyConfig['mgmtOffline']), |
Владислав Наумов | f8f23fa | 2021-04-01 16:57:52 +0200 | [diff] [blame] | 1013 | booleanParam(name: 'OFFLINE_CHILD_CLUSTER', value: triggers.proxyConfig['childOffline']), |
Владислав Наумов | 257ea13 | 2021-04-14 14:44:13 +0200 | [diff] [blame] | 1014 | booleanParam(name: 'PROXY_CHILD_CLUSTER', value: triggers.proxyConfig['childProxy']), |
Владислав Наумов | 44c64b7 | 2020-12-04 20:22:53 +0100 | [diff] [blame] | 1015 | booleanParam(name: 'SEED_MACOS', value: triggers.useMacOsSeedNode), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 1016 | booleanParam(name: 'UPGRADE_MGMT_CLUSTER', value: triggers.upgradeMgmtEnabled), |
slalov | 1202bba | 2022-04-20 22:31:07 +0400 | [diff] [blame] | 1017 | booleanParam(name: 'AUTO_UPGRADE_MCC', value: triggers.autoUpgradeMgmtEnabled), |
Victor Ryzhenkin | d2b7b66 | 2021-08-23 14:18:38 +0400 | [diff] [blame] | 1018 | booleanParam(name: 'ENABLE_LMA_LOGGING', value: triggers.enableLMALoggingEnabled), |
Sergey Lalov | b2f6037 | 2022-09-20 23:58:47 +0400 | [diff] [blame] | 1019 | booleanParam(name: 'DEPLOY_OS_ON_MOS', value: triggers.deployOsOnMosEnabled), |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 1020 | booleanParam(name: 'RUN_UI_E2E', value: triggers.runUie2eEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 1021 | booleanParam(name: 'RUN_MGMT_CFM', value: triggers.runMgmtConformanceEnabled), |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 1022 | booleanParam(name: 'RUN_MGMT_CFM_NETWORK_POLICY', value: triggers.runMgmtConformanceNetworkPolicyEnabled), |
slalov | 0a4947a | 2022-06-09 15:44:35 +0400 | [diff] [blame] | 1023 | booleanParam(name: 'RUN_MAINTENANCE_TEST', value: triggers.runMaintenanceTestEnabled), |
| 1024 | booleanParam(name: 'RUN_CONTAINER_REGISTRY_TEST', value: triggers.runContainerregistryTestEnabled), |
Mikhail Nikolaenko | 7e632cd | 2022-10-24 16:20:31 +0300 | [diff] [blame] | 1025 | booleanParam(name: 'RUN_GRACEFUL_REBOOT_TEST', value: triggers.runGracefulRebootTestEnabled), |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 1026 | booleanParam(name: 'RUN_MGMT_DELETE_MASTER_TEST', value: triggers.runMgmtDeleteMasterTestEnabled), |
| 1027 | booleanParam(name: 'RUN_RGNL_DELETE_MASTER_TEST', value: triggers.runRgnlDeleteMasterTestEnabled), |
| 1028 | booleanParam(name: 'RUN_CHILD_DELETE_MASTER_TEST', value: triggers.runChildDeleteMasterTestEnabled), |
Sergey Lalov | d5efcd5 | 2023-03-01 22:42:17 +0400 | [diff] [blame] | 1029 | booleanParam(name: 'RUN_CHILD_CUSTOM_CERT_TEST', value: triggers.runChildCustomCertTestEnabled), |
Sergey Lalov | f6fbfea | 2023-04-06 17:05:40 +0400 | [diff] [blame] | 1030 | booleanParam(name: 'RUN_MGMT_CUSTOM_CACHE_CERT_TEST', value: triggers.runMgmtCustomCacheCertTestEnabled), |
Sergey Lalov | 48e6902 | 2023-07-25 16:08:00 +0400 | [diff] [blame] | 1031 | booleanParam(name: 'RUN_MKE_CUSTOM_CERT_TEST', value: triggers.runMkeCustomCertTestEnabled), |
Sergey Lalov | 62c2831 | 2023-10-18 19:23:59 +0400 | [diff] [blame] | 1032 | booleanParam(name: 'RUN_CUSTOM_HOSTNAMES', value: triggers.runCustomHostnamesEnabled), |
vryzhenkin | 504dfc9 | 2023-11-01 15:49:47 +0400 | [diff] [blame] | 1033 | booleanParam(name: 'SL_LATEST', value: triggers.slLatestEnabled), |
Sergey Lalov | 430fcd7 | 2023-03-20 17:19:44 +0400 | [diff] [blame] | 1034 | booleanParam(name: 'RUN_BYO_CHILD_CUSTOM_CERT_TEST', value: triggers.runByoChildCustomCertTestEnabled), |
Dmitriy Kasyanov | 43cb06e | 2022-08-17 14:35:39 +0300 | [diff] [blame] | 1035 | booleanParam(name: 'RUN_CHILD_MACHINE_DELETION_POLICY_TEST', value: triggers.runChildMachineDeletionPolicyTestEnabled), |
Владислав Наумов | 9cec55d | 2021-08-03 15:00:59 +0200 | [diff] [blame] | 1036 | booleanParam(name: 'RUN_LMA_TEST', value: triggers.runLMATestEnabled), |
Vladyslav Drok | c4f9c1b | 2021-07-22 15:34:24 +0200 | [diff] [blame] | 1037 | booleanParam(name: 'RUN_MGMT_USER_CONTROLLER_TEST', value: triggers.runMgmtUserControllerTestEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 1038 | booleanParam(name: 'DEPLOY_CHILD_CLUSTER', value: triggers.deployChildEnabled), |
| 1039 | booleanParam(name: 'UPGRADE_CHILD_CLUSTER', value: triggers.upgradeChildEnabled), |
Sergey Lalov | c1cb49f | 2022-09-27 01:16:25 +0400 | [diff] [blame] | 1040 | booleanParam(name: 'FULL_UPGRADE_CHILD_CLUSTER', value: triggers.fullUpgradeChildEnabled), |
slalov | 574123e | 2022-04-06 17:24:19 +0400 | [diff] [blame] | 1041 | booleanParam(name: 'RUN_PROXY_CHILD_TEST', value: triggers.runProxyChildTestEnabled), |
Владислав Наумов | 0dc9925 | 2020-11-13 13:30:48 +0100 | [diff] [blame] | 1042 | booleanParam(name: 'ATTACH_BYO', value: triggers.attachBYOEnabled), |
Владислав Наумов | cdbd84e | 2020-12-01 16:51:09 +0100 | [diff] [blame] | 1043 | booleanParam(name: 'UPGRADE_BYO', value: triggers.upgradeBYOEnabled), |
Vladislav Naumov | 7930ab2 | 2021-11-22 18:24:24 +0100 | [diff] [blame] | 1044 | booleanParam(name: 'RUN_BYO_MATRIX', value: triggers.runBYOMatrixEnabled), |
Владислав Наумов | 080d941 | 2020-07-29 13:05:14 +0200 | [diff] [blame] | 1045 | booleanParam(name: 'RUN_CHILD_CFM', value: triggers.runChildConformanceEnabled), |
Sergey Lalov | afcc043 | 2023-04-13 14:59:06 +0400 | [diff] [blame] | 1046 | booleanParam(name: 'RUN_CHILD_CFM_NETPOLICY', value: triggers.runChildConformanceNetworkPolicyEnabled), |
vryzhenkin | b286bd8 | 2023-04-04 07:17:52 +0400 | [diff] [blame] | 1047 | booleanParam(name: 'RUN_CHILD_HPA', value: triggers.runChildHPAEnabled), |
Sergey Lalov | 012496a | 2023-11-27 15:57:52 +0400 | [diff] [blame] | 1048 | booleanParam(name: 'RUN_STACKLIGHT_CHILD_HA', value: triggers.runChildStacklightHaEnabled), |
Ivan Berezovskiy | cbf9eeb | 2021-03-22 15:57:32 +0400 | [diff] [blame] | 1049 | booleanParam(name: 'ALLOW_AWS_ON_DEMAND', value: triggers.awsOnDemandDemoEnabled), |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 1050 | booleanParam(name: 'ALLOW_EQUINIX_ON_DEMAND', value: triggers.equinixOnDemandDemoEnabled), |
Владислав Наумов | 82305e9 | 2021-10-14 20:45:20 +0200 | [diff] [blame] | 1051 | booleanParam(name: 'ALLOW_EQUINIXMETALV2_ON_DEMAND', value: triggers.equinixMetalV2OnDemandDemoEnabled), |
Vladislav Naumov | 42b71dc | 2021-11-22 13:09:42 +0100 | [diff] [blame] | 1052 | booleanParam(name: 'EQUINIXMETALV2_CHILD_DIFF_METRO', value: triggers.equinixMetalV2ChildDiffMetroEnabled), |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 1053 | booleanParam(name: 'EQUINIX_ON_AWS_DEMO', value: triggers.equinixOnAwsDemoEnabled), |
| 1054 | booleanParam(name: 'ALLOW_AZURE_ON_DEMAND', value: triggers.azureOnDemandDemoEnabled), |
| 1055 | booleanParam(name: 'AZURE_ON_AWS_DEMO', value: triggers.azureOnAwsDemoEnabled), |
Sergey Lalov | c63259f | 2024-01-28 16:52:30 +0400 | [diff] [blame] | 1056 | booleanParam(name: 'ALLOW_BM_CORE_ON_DEMAND', value: triggers.bmCoreDemoEnabled), |
Sergey Zhemerdeev | 9074f6e | 2022-06-07 12:03:16 +0300 | [diff] [blame] | 1057 | booleanParam(name: 'VSPHERE_DEPLOY_UBUNTU', value: triggers.vsphereUbuntuEnabled), |
Sergey Lalov | bc68d75 | 2022-11-08 13:40:53 +0400 | [diff] [blame] | 1058 | booleanParam(name: 'PAUSE_FOR_DEBUG', value: triggers.pauseForDebugEnabled), |
Mikhail Nikolaenko | c36dea9 | 2022-12-12 02:40:40 +0300 | [diff] [blame] | 1059 | booleanParam(name: 'ENABLE_FIPS', value: triggers.enableFips), |
Sergey Lalov | 00bea0f | 2023-08-14 16:46:33 +0400 | [diff] [blame] | 1060 | booleanParam(name: 'ENABLE_MKE_DUBUG', value: triggers.enableMkeDebugEnabled), |
Mikhail Nikolaenko | c36dea9 | 2022-12-12 02:40:40 +0300 | [diff] [blame] | 1061 | booleanParam(name: 'AIO_CLUSTER', value: triggers.aioCluster), |
Sergey Lalov | d0e2085 | 2023-08-17 19:11:19 +0400 | [diff] [blame] | 1062 | booleanParam(name: 'BM_CORE_CLEANUP', value: triggers.bmCoreCleanup), |
Sergey Lalov | d7593ab | 2024-01-11 13:40:13 +0400 | [diff] [blame] | 1063 | booleanParam(name: 'DISABLE_KUBE_API_AUDIT', value: triggers.disableKubeApiAudit), |
Sergey Lalov | f44cbb7 | 2024-03-27 15:19:24 +0400 | [diff] [blame] | 1064 | booleanParam(name: "AUDITD_ENABLE", value: triggers.auditdEnabled), |
vryzhenkin | e0ff1d8 | 2024-03-18 15:08:09 +0400 | [diff] [blame] | 1065 | booleanParam(name: 'CORE_KEYCLOAK_LDAP_ENABLED', value: triggers.coreKeycloakLdapEnabled), |
| 1066 | booleanParam(name: 'CORE_KAAS_NTP_ENABLED', value: triggers.internalNTPServersEnabled) |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 1067 | ] |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 1068 | |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 1069 | // customize multiregional demo |
| 1070 | if (triggers.multiregionalConfiguration.enabled) { |
| 1071 | parameters.add(string(name: 'MULTIREGION_SETUP', |
| 1072 | value: "${triggers.multiregionalConfiguration.managementLocation},${triggers.multiregionalConfiguration.regionLocation}" |
| 1073 | )) |
| 1074 | } |
| 1075 | |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 1076 | // Determine component team custom context |
| 1077 | if (coreContext != '') { |
| 1078 | common.infoMsg('Additional KaaS Core context detected, will be forwarded into kaas core cicd...') |
| 1079 | def additionalParameters = generateKaaSVarsFromContext(coreContext) |
Владислав Наумов | bef51a9 | 2020-10-01 17:36:51 +0200 | [diff] [blame] | 1080 | parameters.addAll(additionalParameters) |
Владислав Наумов | 92288d9 | 2020-07-13 18:36:21 +0200 | [diff] [blame] | 1081 | } |
| 1082 | |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 1083 | def jobResults = [] |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 1084 | |
| 1085 | platforms.each { platform -> |
| 1086 | jobs["kaas-core-${platform}-patched-${component}"] = { |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 1087 | try { |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 1088 | common.infoMsg("Deploy: patched KaaS demo with ${platform} provider") |
| 1089 | def job_info = build job: "kaas-testing-core-${platform}-workflow-${component}", parameters: parameters, wait: true |
| 1090 | def build_description = job_info.getDescription() |
| 1091 | def build_result = job_info.getResult() |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 1092 | jobResults.add(build_result) |
Владислав Наумов | d044e84 | 2020-06-17 15:33:43 +0200 | [diff] [blame] | 1093 | |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 1094 | if (build_description) { |
| 1095 | currentBuild.description += build_description |
| 1096 | } |
| 1097 | } finally { |
Ivan Berezovskiy | 91ede50 | 2021-05-13 21:05:36 +0400 | [diff] [blame] | 1098 | common.infoMsg("Patched KaaS demo with ${platform} provider finished") |
Vladislav Naumov | 5313a20 | 2021-04-07 17:13:39 +0000 | [diff] [blame] | 1099 | } |
| 1100 | } |
| 1101 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 1102 | |
| 1103 | common.infoMsg('Trigger KaaS demo deployments according to defined provider set') |
Владислав Наумов | 37f7f84 | 2021-03-09 16:08:39 +0400 | [diff] [blame] | 1104 | if (jobs.size() == 0) { |
| 1105 | error('No demo jobs matched with keywords, execution will be aborted, at least 1 provider should be enabled') |
| 1106 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 1107 | // Limit build concurency workaround examples: https://issues.jenkins-ci.org/browse/JENKINS-44085 |
| 1108 | parallel jobs |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 1109 | |
| 1110 | if (jobResults.contains('FAILURE')) { |
Владислав Наумов | f86b111 | 2020-06-09 14:04:48 +0200 | [diff] [blame] | 1111 | common.infoMsg('One of parallel downstream jobs is failed, mark executor job as failed') |
Владислав Наумов | aa43061 | 2020-06-08 17:18:31 +0200 | [diff] [blame] | 1112 | currentBuild.result = 'FAILURE' |
| 1113 | } |
Владислав Наумов | 2a982ff | 2020-06-02 19:06:46 +0200 | [diff] [blame] | 1114 | } |
Владислав Наумов | 30a516c | 2020-07-09 13:15:41 +0200 | [diff] [blame] | 1115 | |
| 1116 | |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1117 | /** |
| 1118 | * Function currently supported to be called from aws or vsphere demos. It gets particular demo context |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 1119 | * and generate proper lockResources data and netMap data for vsphere,equinix related clusters. |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1120 | * |
| 1121 | * @param: callBackDemo (string) Demo which requested to generate lockResources [aws or vsphere] |
| 1122 | * @param: triggers (map) Custom trigger keywords forwarded from gerrit |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 1123 | * @param: multiregionalConfiguration (map) Multiregional configuration |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1124 | * @return (map) Return aggregated map with lockResources and netMap |
| 1125 | */ |
| 1126 | |
| 1127 | |
| 1128 | def generateLockResources(callBackDemo, triggers) { |
| 1129 | def common = new com.mirantis.mk.Common() |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 1130 | def netMap = [ |
| 1131 | vsphere: [:], |
| 1132 | equinix: [:], |
| 1133 | ] |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1134 | // Define vsphere locklabels with initial quantity |
| 1135 | def lockLabels = [ |
| 1136 | vsphere_networking_core_ci: 0, |
| 1137 | vsphere_offline_networking_core_ci: 0, |
| 1138 | ] |
| 1139 | def deployChild = triggers.deployChildEnabled |
Sergey Lalov | 13eea42 | 2023-08-21 23:10:17 +0400 | [diff] [blame] | 1140 | def testUiVsphere = triggers.runUie2eEnabled || triggers.runUie2eNewEnabled |
Sergey Lalov | 900aff4 | 2024-03-08 00:05:50 +0400 | [diff] [blame] | 1141 | def vsphereByo = triggers.attachBYOEnabled |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 1142 | def multiregionConfig = triggers.multiregionalConfiguration |
| 1143 | def runMultiregion = multiregionConfig.enabled |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1144 | |
| 1145 | // Generate vsphere netMap and lockLabels based on demo context |
| 1146 | switch (callBackDemo) { |
| 1147 | case 'aws': |
| 1148 | // Add aws specific lock label with quantity calculated based on single mgmt deploy or mgmt + child |
| 1149 | lockLabels['aws_core_ci_queue'] = triggers.demoWeight |
Sergey Kolekonov | f4c1f49 | 2022-02-03 14:44:45 +0400 | [diff] [blame] | 1150 | if (triggers.runBYOMatrixEnabled) { lockLabels['aws_core_ci_queue'] += 6 } |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 1151 | |
| 1152 | // Define netMap for Vsphere region |
| 1153 | if (runMultiregion && multiregionConfig.managementLocation == 'aws') { |
| 1154 | if (multiregionConfig.regionLocation == 'vsphere') { |
| 1155 | if (deployChild) { |
| 1156 | addToProviderNetMap(netMap, 'vsphere', 'regional-child') |
| 1157 | } |
| 1158 | addToProviderNetMap(netMap, 'vsphere', 'region') |
| 1159 | } |
| 1160 | |
| 1161 | if (multiregionConfig.regionLocation == 'azure') { |
| 1162 | lockLabels['azure_core_ci_queue'] = 1 |
| 1163 | if (deployChild) { |
| 1164 | lockLabels['azure_core_ci_queue'] += 1 |
| 1165 | } |
| 1166 | } |
| 1167 | } |
| 1168 | if (triggers.azureOnAwsDemoEnabled) { |
| 1169 | lockLabels['azure_core_ci_queue'] = 1 |
| 1170 | } |
| 1171 | |
| 1172 | if (triggers.equinixOnAwsDemoEnabled) { |
| 1173 | lockLabels['equinix_core_ci_queue'] = 1 |
| 1174 | } |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1175 | break |
| 1176 | case 'vsphere': |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 1177 | addToProviderNetMap(netMap, 'vsphere', 'mgmt') |
Sergey Lalov | 900aff4 | 2024-03-08 00:05:50 +0400 | [diff] [blame] | 1178 | if (deployChild || testUiVsphere || vsphereByo) { |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 1179 | addToProviderNetMap(netMap, 'vsphere', 'child') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1180 | } |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 1181 | if (runMultiregion && multiregionConfig.managementLocation == 'vsphere' && |
| 1182 | multiregionConfig.regionLocation == 'vsphere') { |
| 1183 | if (deployChild) { |
| 1184 | addToProviderNetMap(netMap, 'vsphere', 'regional-child') |
| 1185 | } |
| 1186 | addToProviderNetMap(netMap, 'vsphere', 'region') |
| 1187 | } |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1188 | break |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 1189 | case 'azure': |
| 1190 | lockLabels['azure_core_ci_queue'] = triggers.demoWeight |
| 1191 | if (runMultiregion && multiregionConfig.managementLocation == 'azure') { |
| 1192 | if (multiregionConfig.regionLocation == 'aws') { |
| 1193 | lockLabels['aws_core_ci_queue'] = 1 |
| 1194 | if (deployChild) { |
| 1195 | lockLabels['aws_core_ci_queue'] += 1 |
| 1196 | } |
| 1197 | } |
| 1198 | |
| 1199 | if (multiregionConfig.regionLocation == 'equinix') { |
| 1200 | lockLabels['equinix_core_ci_queue'] = 1 |
| 1201 | if (deployChild) { |
| 1202 | lockLabels['equinix_core_ci_queue'] +=1 |
| 1203 | } |
| 1204 | } |
| 1205 | } |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1206 | default: |
Sergey Kolekonov | d6a1739 | 2024-02-06 15:57:53 +0000 | [diff] [blame] | 1207 | error('Supposed to be called from aws, azure or vsphere demos only') |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1208 | } |
| 1209 | |
| 1210 | // Checking gerrit triggers and manage lock label quantity and network types in case of Offline deployment |
| 1211 | // Vsphere labels only |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 1212 | netMap['vsphere'].each { clusterType, netConfig -> |
| 1213 | if (triggers.proxyConfig["${clusterType}Offline"] == true || |
| 1214 | (clusterType == 'regional-child' && triggers.proxyConfig['childOffline'] == true) || |
| 1215 | (clusterType == 'region' && triggers.proxyConfig['mgmtOffline'])) { |
| 1216 | |
| 1217 | netMap['vsphere'][clusterType]['netName'] = 'offline' |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1218 | lockLabels['vsphere_offline_networking_core_ci']++ |
| 1219 | } else { |
| 1220 | lockLabels['vsphere_networking_core_ci']++ |
| 1221 | } |
| 1222 | } |
| 1223 | |
| 1224 | // generate lock metadata |
| 1225 | def lockResources = [] |
| 1226 | lockLabels.each { label, quantity -> |
| 1227 | if (quantity > 0) { |
| 1228 | def res = [ |
| 1229 | label: label, |
| 1230 | quantity: quantity, |
| 1231 | ] |
| 1232 | lockResources.add(res) |
| 1233 | } |
| 1234 | } |
| 1235 | |
| 1236 | common.infoMsg("""Generated vsphere netMap: ${netMap} |
| 1237 | Generated lockResources: ${lockResources}""") |
| 1238 | |
| 1239 | return [ |
| 1240 | netMap: netMap, |
| 1241 | lockResources: lockResources, |
| 1242 | ] |
| 1243 | } |
| 1244 | |
| 1245 | /** |
| 1246 | * Function gets vsphere netMap or empty map and adds new vsphere clusterType with default netName |
| 1247 | * and empty rangeConfig to the this map. |
| 1248 | * |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 1249 | * @param: netMap (string) vsphere, equinix netMap or empty map |
| 1250 | * @param: provider (string) provider type |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1251 | * @param: clusterType (string) Vsphere cluster type |
| 1252 | */ |
| 1253 | |
Владислав Наумов | 33e1e81 | 2021-08-17 17:09:25 +0200 | [diff] [blame] | 1254 | def addToProviderNetMap (netMap, provider, clusterType) { |
| 1255 | switch (provider) { |
| 1256 | case 'equinix': |
| 1257 | netMap[provider][clusterType] = [ |
| 1258 | vlanConfig: '', |
| 1259 | ] |
| 1260 | break |
| 1261 | case 'vsphere': |
| 1262 | netMap[provider][clusterType] = [ |
| 1263 | netName: 'default', |
| 1264 | rangeConfig: '', |
| 1265 | ] |
| 1266 | break |
| 1267 | default: |
| 1268 | error('Net map locks supported for Equinix/Vsphere providers only') |
| 1269 | } |
Stanislav Riazanov | 78fa7df | 2021-05-28 20:28:59 +0400 | [diff] [blame] | 1270 | } |
Dmitry Teselkin | fce71aa | 2022-03-05 19:36:52 +0300 | [diff] [blame] | 1271 | |
| 1272 | /** |
| 1273 | * getCIKeywordsFromCommitMsg parses commit message and returns all gerrit keywords with their values as a list of maps. |
| 1274 | * Each element (map) contains keys 'key' for keyword name and 'value' for its value. |
| 1275 | * If keyword contains only 'key' part then 'value' is boolean True. |
| 1276 | * This function does not perform keywords validation. |
| 1277 | * First line of a commit message is ignored. |
| 1278 | * To use '[' or ']' characters inside keyword prepend it with backslash '\'. |
| 1279 | * TODO: Remove backslash chars from values if they prepend '[' or ']'. |
| 1280 | **/ |
| 1281 | |
| 1282 | List getCIKeywordsFromCommitMsg() { |
| 1283 | String commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| 1284 | List commitMsgLines = commitMsg.split('\n') |
| 1285 | List keywords = [] |
| 1286 | if (commitMsgLines.size() < 2) { |
| 1287 | return keywords |
| 1288 | } |
| 1289 | |
| 1290 | String commitMsgBody = commitMsgLines[1..-1].join('\n') |
| 1291 | |
| 1292 | // Split commit message body to chunks using '[' or ']' as delimiter, |
| 1293 | // ignoring them if prepended by backslash (regex negative lookbehind). |
| 1294 | // Resulting list will have chunks between '[' and ']' at odd indexes. |
| 1295 | List parts = commitMsgBody.split(/(?<!\\)[\[\]]/) |
| 1296 | |
| 1297 | // Iterate chunks by odd indexes only, trim values and split to |
| 1298 | // <key> / <value> pair where <key> is the part of a sting before the first |
| 1299 | // whitespace delimiter, and <value> is the rest (may include whitespaces). |
| 1300 | // If there is no whitespace in the string then this is a 'switch' |
| 1301 | // and <value> will be boolean True. |
| 1302 | for (i = 1; i < parts.size(); i += 2) { |
| 1303 | def (key, value) = (parts[i].trim().split(/\s+/, 2) + [true, ])[0..1] |
| 1304 | keywords.add(['key': key, 'value': value]) |
| 1305 | } |
| 1306 | |
| 1307 | return keywords |
| 1308 | } |
| 1309 | |
| 1310 | /** |
| 1311 | * getJobsParamsFromCommitMsg parses list of CI keywords and returns values of 'job-params' keyword |
| 1312 | * that were specified for given job name. `job-params` keyword has the following structure |
| 1313 | * |
| 1314 | * [job-params <job name> <parameter name> <parameter value>] |
| 1315 | * |
| 1316 | * Return value is a Map that contains those parameters using the following structure: |
| 1317 | * |
| 1318 | * <job name>: |
| 1319 | * <parameter name>: <parameter value> |
| 1320 | * |
| 1321 | **/ |
| 1322 | Map getJobsParamsFromCommitMsg() { |
| 1323 | List keywords = getCIKeywordsFromCommitMsg() |
| 1324 | |
| 1325 | List jobsParamsList = [] |
| 1326 | keywords.findAll{ it.key == 'job-params' }.collect(jobsParamsList) { |
| 1327 | def (name, params) = (it['value'].split(/\s+/, 2) + [null, ])[0..1] |
| 1328 | def (key, value) = params.split(/\s+/, 2) |
| 1329 | ['name': name, 'key': key, 'value': value] |
| 1330 | } |
| 1331 | |
| 1332 | Map jobsParams = jobsParamsList.inject([:]) { result, it -> |
| 1333 | if (!result.containsKey(it.name)) { |
| 1334 | result[it.name] = [:] |
| 1335 | } |
| 1336 | result[it.name][it.key] = it.value |
| 1337 | result |
| 1338 | } |
| 1339 | |
| 1340 | return jobsParams |
| 1341 | } |
| 1342 | |
| 1343 | |
| 1344 | /** |
| 1345 | * getJobParamsFromCommitMsg returns key:value Map of parameters set for a job in commit message. |
| 1346 | * It uses getJobsParamsFromCommitMsg to get all parameters from commit message and then |
| 1347 | * uses only those parametes that were set to all jobs (with <job name> == '*') or to |
| 1348 | * a particular job. Parameters set to a particular job have higher precedence. |
| 1349 | * |
| 1350 | * Return value is a Map that contains those parameters: |
| 1351 | * |
| 1352 | * <parameter name>: <parameter value> |
| 1353 | * |
| 1354 | **/ |
| 1355 | Map getJobParamsFromCommitMsg(String jobName) { |
| 1356 | jobsParams = getJobsParamsFromCommitMsg() |
| 1357 | jobParams = jobsParams.getOrDefault('*', [:]) |
| 1358 | if (jobName) { |
| 1359 | jobParams.putAll(jobsParams.getOrDefault(jobName, [:])) |
| 1360 | } |
| 1361 | return jobParams |
| 1362 | } |
azvyagintsev | c17d14b | 2022-06-06 19:06:33 +0300 | [diff] [blame] | 1363 | |
| 1364 | /** Getting test scheme from text, which should be |
| 1365 | Imput example: |
| 1366 | text=""" |
| 1367 | DATA |
| 1368 | |
| 1369 | kaas_bm_test_schemas: |
| 1370 | KAAS_RELEASES_REFSPEC: '' |
| 1371 | KEY: VAL |
| 1372 | |
| 1373 | DATA |
| 1374 | """ |
| 1375 | |
| 1376 | Call: parseTextForTestSchemas(['text' : text,'keyLine' : 'kaas_bm_test_schemas']) |
| 1377 | |
| 1378 | Return: |
| 1379 | ['KAAS_RELEASES_REFSPEC': '', 'KEY' : 'VAL'] |
| 1380 | **/ |
| 1381 | def parseTextForTestSchemas(Map opts) { |
azvyagintsev | d96aac2 | 2022-06-10 14:23:26 +0300 | [diff] [blame] | 1382 | String text = opts.getOrDefault('text', '') |
azvyagintsev | c17d14b | 2022-06-06 19:06:33 +0300 | [diff] [blame] | 1383 | String keyLine = opts.getOrDefault('keyLine', '') |
| 1384 | Map testScheme = [:] |
| 1385 | if (!text || !keyLine) { |
azvyagintsev | d96aac2 | 2022-06-10 14:23:26 +0300 | [diff] [blame] | 1386 | return testScheme |
azvyagintsev | c17d14b | 2022-06-06 19:06:33 +0300 | [diff] [blame] | 1387 | } |
| 1388 | if (text =~ /\n$keyLine\n.*/) { |
| 1389 | def common = new com.mirantis.mk.Common() |
| 1390 | try { |
| 1391 | String regExp = '\\n' + keyLine + '\\n' |
| 1392 | // regexep block must be followed by empty line |
| 1393 | testScheme = readYaml text: "${text.split(regExp)[1].split('\n\n')[0]}" |
| 1394 | common.infoMsg("parseTextForTestSchemas result:\n" + testScheme) |
| 1395 | common.mergeEnv(env, toJson(testScheme)) |
| 1396 | } |
| 1397 | catch (Exception e) { |
| 1398 | common.errorMsg("There is an error occured during parseTextForTestSchemas execution:\n${e}") |
| 1399 | throw e |
| 1400 | } |
| 1401 | } |
azvyagintsev | d96aac2 | 2022-06-10 14:23:26 +0300 | [diff] [blame] | 1402 | return testScheme |
Dmitriy Kasyanov | 5f910e6 | 2022-02-11 14:57:05 +0300 | [diff] [blame] | 1403 | } |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1404 | |
| 1405 | |
| 1406 | /** |
eromanova | b24cb23 | 2023-11-17 12:17:06 +0400 | [diff] [blame] | 1407 | * getEquinixMetroWithCapacity returns list of Equinix metros using specified |
| 1408 | * instance type (nodeType), desired count of metros (metroCount) and |
| 1409 | * instances (nodeCount) in a metro using specified matal version. |
| 1410 | * Function downloads metal CLI from the |
| 1411 | * https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux |
| 1412 | * Empty list is returned in case of no metros with specified capacity was found or any other errors. |
| 1413 | * Non-empty list is shuffled. |
| 1414 | * |
| 1415 | * @param: metroCount (int) Desired count of metros |
| 1416 | * @param: nodeCount (int) Desired count of instances |
| 1417 | * @param: nodeType (string) Instance type |
| 1418 | * @param: version (string) Metal version to use |
| 1419 | * @return ([]string) List of selected metros |
| 1420 | * |
| 1421 | **/ |
| 1422 | def getEquinixMetroWithCapacity(metroCount = 1, nodeCount = 50, nodeType = 'c3.small.x86', version = '0.9.0') { |
| 1423 | def common = new com.mirantis.mk.Common() |
| 1424 | def metalUrl = "https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux" |
| 1425 | def metal = './metal --config metal.yaml' |
| 1426 | def metro = [] |
| 1427 | def out = '' |
| 1428 | def retries = 3 // number of retries |
| 1429 | def i = 0 |
| 1430 | def delay = 60 // 1 minute sleep |
| 1431 | def excludeMetro = [] // list of metros to exclude from selection |
| 1432 | try { |
| 1433 | if (excludeMetro.size() > 0) { |
| 1434 | common.infoMsg("Excluded metros: ${excludeMetros}") |
| 1435 | } |
| 1436 | sh "curl -o metal -# ${metalUrl} && chmod +x metal" |
| 1437 | withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) { |
| 1438 | sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml' |
| 1439 | } |
| 1440 | while (metro.size() < metroCount && i < retries) { |
| 1441 | common.infoMsg("Selecting ${metroCount} available Equinix metros with free ${nodeCount} ${nodeType} hosts, try ${i+1}/${retries} ...") |
| 1442 | if (i > 0) { // skip sleep on first step |
| 1443 | sleep(delay) |
| 1444 | } |
| 1445 | 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() |
| 1446 | metro = out.tokenize(',') |
| 1447 | metro -= excludeMetro |
| 1448 | if (metro.size() < metroCount) { |
| 1449 | nodeCount -= 10 |
| 1450 | // We need different metros for the [equinixmetalv2-child-diff-metro] case |
| 1451 | } else if (metro.size() == 2 && metro[0][0, 1] == metro[1][0, 1]) { |
| 1452 | nodeCount -= 10 |
| 1453 | } |
| 1454 | i++ |
| 1455 | } |
| 1456 | if (metro.size() > 0) { |
eromanova | efbbb42 | 2023-11-24 13:54:35 +0400 | [diff] [blame] | 1457 | m = metro.size() > 1 ? "${metro[0]},${metro[1]}" : "${metro[0]}" |
| 1458 | sh "${metal} capacity check -P ${nodeType} -m ${m} -q ${nodeCount}" |
eromanova | b24cb23 | 2023-11-17 12:17:06 +0400 | [diff] [blame] | 1459 | } |
| 1460 | } catch (Exception e) { |
| 1461 | common.errorMsg "Exception: '${e}'" |
| 1462 | return [] |
| 1463 | } finally { |
| 1464 | sh 'rm metal.yaml' |
| 1465 | } |
| 1466 | if (metro.size() > 0) { |
| 1467 | Collections.shuffle(metro) |
| 1468 | common.infoMsg("Selected metros: ${metro}") |
| 1469 | } else { |
| 1470 | common.warningMsg('No any metros have been selected !!! :(') |
| 1471 | } |
| 1472 | return metro |
| 1473 | } |
| 1474 | |
| 1475 | |
| 1476 | /** |
Sergey Zhemerdeev | de949bf | 2022-09-14 15:44:33 +0300 | [diff] [blame] | 1477 | * getEquinixFacilityWithCapacity returns list of Equinix facilities using specified |
Sergey Zhemerdeev | 46080fa | 2022-10-06 12:34:12 +0300 | [diff] [blame] | 1478 | * instance type (nodeType), desired count of facilities (facilityCount) and |
| 1479 | * instances (nodeCount) in a facility using specified matal version. |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1480 | * Function downloads metal CLI from the |
Sergey Zhemerdeev | de949bf | 2022-09-14 15:44:33 +0300 | [diff] [blame] | 1481 | * https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux |
| 1482 | * Empty list is returned in case of no facilities with specified capacity was found or any other errors. |
Sergey Zhemerdeev | 15aa860 | 2022-10-13 11:10:02 +0300 | [diff] [blame] | 1483 | * Non-empty list is shuffled. |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1484 | * |
Sergey Zhemerdeev | 46080fa | 2022-10-06 12:34:12 +0300 | [diff] [blame] | 1485 | * @param: facilityCount (int) Desired count of facilities |
| 1486 | * @param: nodeCount (int) Desired count of instances |
| 1487 | * @param: nodeType (string) Instance type |
| 1488 | * @param: version (string) Metal version to use |
Sergey Zhemerdeev | de949bf | 2022-09-14 15:44:33 +0300 | [diff] [blame] | 1489 | * @return ([]string) List of selected facilities |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1490 | * |
| 1491 | **/ |
eromanova | b24cb23 | 2023-11-17 12:17:06 +0400 | [diff] [blame] | 1492 | @Deprecated |
Sergey Zhemerdeev | 46080fa | 2022-10-06 12:34:12 +0300 | [diff] [blame] | 1493 | def getEquinixFacilityWithCapacity(facilityCount = 1, nodeCount = 50, nodeType = 'c3.small.x86', version = '0.9.0') { |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1494 | def common = new com.mirantis.mk.Common() |
Sergey Lalov | 314daae | 2023-11-27 12:21:20 +0400 | [diff] [blame] | 1495 | common.warningMsg('You are using deprecated method getEquinixFacilityWithCapacity. Use getEquinixMetroWithCapacity instead') |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1496 | def metalUrl = "https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux" |
Sergey Zhemerdeev | b68bf61 | 2022-09-12 13:12:32 +0300 | [diff] [blame] | 1497 | def metal = './metal --config metal.yaml' |
Sergey Zhemerdeev | b68bf61 | 2022-09-12 13:12:32 +0300 | [diff] [blame] | 1498 | def facility = [] |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1499 | def out = '' |
Sergey Zhemerdeev | bcccb91 | 2022-08-25 14:26:52 +0300 | [diff] [blame] | 1500 | def retries = 3 // number of retries |
Sergey Zhemerdeev | 495ba58 | 2022-08-16 16:31:43 +0300 | [diff] [blame] | 1501 | def i = 0 |
| 1502 | def delay = 60 // 1 minute sleep |
Sergey Zhemerdeev | 46080fa | 2022-10-06 12:34:12 +0300 | [diff] [blame] | 1503 | def excludeFacility = [] // list of facilities to exclude from selection |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1504 | try { |
Sergey Zhemerdeev | b357534 | 2022-10-04 11:02:19 +0300 | [diff] [blame] | 1505 | if (excludeFacility.size() > 0) { |
| 1506 | common.infoMsg("Excluded facilities: ${excludeFacility}") |
| 1507 | } |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1508 | sh "curl -o metal -# ${metalUrl} && chmod +x metal" |
| 1509 | withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) { |
| 1510 | sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml' |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1511 | } |
Sergey Zhemerdeev | 46080fa | 2022-10-06 12:34:12 +0300 | [diff] [blame] | 1512 | while (facility.size() < facilityCount && i < retries) { |
| 1513 | common.infoMsg("Selecting ${facilityCount} available Equinix facilities with free ${nodeCount} ${nodeType} hosts, try ${i+1}/${retries} ...") |
Sergey Zhemerdeev | 495ba58 | 2022-08-16 16:31:43 +0300 | [diff] [blame] | 1514 | if (i > 0 ) { // skip sleep on first step |
| 1515 | sleep(delay) |
| 1516 | } |
Sergey Zhemerdeev | b68bf61 | 2022-09-12 13:12:32 +0300 | [diff] [blame] | 1517 | 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() |
| 1518 | facility = out.tokenize(',') |
Sergey Zhemerdeev | b357534 | 2022-10-04 11:02:19 +0300 | [diff] [blame] | 1519 | facility -= excludeFacility |
Sergey Zhemerdeev | 46080fa | 2022-10-06 12:34:12 +0300 | [diff] [blame] | 1520 | if (facility.size() < facilityCount) { |
| 1521 | nodeCount -= 10 |
| 1522 | // We need different metros for the [equinixmetalv2-child-diff-metro] case, facility[][0, 1] contains a metro name |
| 1523 | } else if (facility.size() == 2 && facility[0][0, 1] == facility[1][0, 1]) { |
Sergey Zhemerdeev | bcccb91 | 2022-08-25 14:26:52 +0300 | [diff] [blame] | 1524 | nodeCount -= 10 |
| 1525 | } |
Sergey Zhemerdeev | 495ba58 | 2022-08-16 16:31:43 +0300 | [diff] [blame] | 1526 | i++ |
| 1527 | } |
Sergey Zhemerdeev | b68bf61 | 2022-09-12 13:12:32 +0300 | [diff] [blame] | 1528 | if (facility.size() > 0) { |
| 1529 | f = facility.size() > 1 ? "${facility[0]},${facility[1]}" : "${facility[0]}" |
| 1530 | sh "${metal} capacity check -P ${nodeType} -f ${f} -q ${nodeCount}" |
Sergey Zhemerdeev | bcccb91 | 2022-08-25 14:26:52 +0300 | [diff] [blame] | 1531 | } |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1532 | } catch (Exception e) { |
| 1533 | common.errorMsg "Exception: '${e}'" |
| 1534 | return [] |
Sergey Zhemerdeev | 495ba58 | 2022-08-16 16:31:43 +0300 | [diff] [blame] | 1535 | } finally { |
| 1536 | sh 'rm metal.yaml' |
| 1537 | } |
Sergey Zhemerdeev | b68bf61 | 2022-09-12 13:12:32 +0300 | [diff] [blame] | 1538 | if (facility.size() > 0) { |
Sergey Zhemerdeev | 15aa860 | 2022-10-13 11:10:02 +0300 | [diff] [blame] | 1539 | Collections.shuffle(facility) |
Sergey Zhemerdeev | b68bf61 | 2022-09-12 13:12:32 +0300 | [diff] [blame] | 1540 | common.infoMsg("Selected facilities: ${facility}") |
Sergey Zhemerdeev | 495ba58 | 2022-08-16 16:31:43 +0300 | [diff] [blame] | 1541 | } else { |
Sergey Zhemerdeev | de949bf | 2022-09-14 15:44:33 +0300 | [diff] [blame] | 1542 | common.warningMsg('No any facilities have been selected !!! :(') |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1543 | } |
Sergey Zhemerdeev | de949bf | 2022-09-14 15:44:33 +0300 | [diff] [blame] | 1544 | return facility |
Sergey Zhemerdeev | 3156908 | 2022-08-10 10:13:19 +0300 | [diff] [blame] | 1545 | } |
Sergey Zhemerdeev | 2a27334 | 2022-08-18 12:06:11 +0300 | [diff] [blame] | 1546 | |
| 1547 | |
| 1548 | /** |
| 1549 | * genCommandLine prepares command line for artifactory-replication |
| 1550 | * command using legacy environment variables |
| 1551 | * |
| 1552 | * @return: (string) Prepared command line |
| 1553 | */ |
| 1554 | def genCommandLine() { |
| 1555 | def envToParam = [ |
| 1556 | 'DESTINATION_USER': '-dst-user', |
| 1557 | 'ARTIFACT_FILTER': '-artifact-filter', |
| 1558 | 'ARTIFACT_FILTER_PROD': '-artifact-filter-prod', |
| 1559 | 'ARTIFACT_TYPE': '-artifact-type', |
| 1560 | 'BINARY_CLEAN': '-bin-cleanup', |
| 1561 | 'BINARY_CLEAN_KEEP_DAYS': '-bin-clean-keep-days', |
| 1562 | 'BINARY_CLEAN_PREFIX': '-bin-clean-prefix', |
| 1563 | 'BUILD_URL': '-slack-build-url', |
| 1564 | 'CHECK_REPOS': '-check-repos', |
| 1565 | 'DESTINATION_REGISTRY': '-dst-repo', |
| 1566 | 'DESTINATION_REGISTRY_TYPE': '-dst-repo-type', |
Ihor Hryshchenko | 4f70386 | 2023-12-07 14:45:50 +0200 | [diff] [blame] | 1567 | 'SIGNED_IMAGES_PATH': '-signed-images-path', |
Sergey Zhemerdeev | 2a27334 | 2022-08-18 12:06:11 +0300 | [diff] [blame] | 1568 | 'DOCKER_CLEAN': '-cleanup', |
Ihor Hryshchenko | aa50100 | 2024-03-11 16:39:56 +0200 | [diff] [blame] | 1569 | 'DOCKER_OLDER_THAN_DAYS': '-older-than-days', |
Sergey Zhemerdeev | 2a27334 | 2022-08-18 12:06:11 +0300 | [diff] [blame] | 1570 | 'DOCKER_REPO_PREFIX': '-docker-repo-prefix', |
| 1571 | 'DOCKER_TAG': '-docker-tag', |
| 1572 | 'FORCE': '-force', |
| 1573 | 'HELM_CDN_DOMAIN': '-helm-cdn-domain', |
| 1574 | 'SLACK_CHANNEL': '-slack-channel', |
Ihor Hryshchenko | 742c901 | 2024-01-19 16:47:22 +0200 | [diff] [blame] | 1575 | 'SLACK_CHANNELS': '-slack-channels', |
Sergey Zhemerdeev | 2a27334 | 2022-08-18 12:06:11 +0300 | [diff] [blame] | 1576 | 'SLACK_USER': '-slack-user', |
| 1577 | 'SOURCE_REGISTRY': '-src-repo', |
| 1578 | 'SOURCE_REGISTRY_TYPE': '-src-repo-type', |
| 1579 | 'SYNC_PATTERN': '-sync-pattern' |
| 1580 | ] |
| 1581 | def cmdParams = '' |
Sergey Zhemerdeev | 88d1c3d | 2022-08-31 16:37:48 +0300 | [diff] [blame] | 1582 | def isCheckClean = false |
Sergey Zhemerdeev | 2a27334 | 2022-08-18 12:06:11 +0300 | [diff] [blame] | 1583 | for (e in envToParam) { |
| 1584 | if (env[e.key] == null) { |
| 1585 | continue |
| 1586 | } |
| 1587 | if (e.key == 'CHECK_REPOS' || e.key == 'DOCKER_CLEAN') { |
Sergey Zhemerdeev | 88d1c3d | 2022-08-31 16:37:48 +0300 | [diff] [blame] | 1588 | // Avoid CHECK_REPOS=true and DOCKER_CLEAN=true |
| 1589 | if (env[e.key].toBoolean() && !isCheckClean) { |
Sergey Zhemerdeev | 2a27334 | 2022-08-18 12:06:11 +0300 | [diff] [blame] | 1590 | cmdParams += e.value + ' ' |
Sergey Zhemerdeev | 88d1c3d | 2022-08-31 16:37:48 +0300 | [diff] [blame] | 1591 | isCheckClean = true |
Sergey Zhemerdeev | 2a27334 | 2022-08-18 12:06:11 +0300 | [diff] [blame] | 1592 | } |
| 1593 | } else if (e.key == 'FORCE') { |
| 1594 | if (env[e.key].toBoolean()) { |
| 1595 | cmdParams += e.value + ' ' |
| 1596 | } |
| 1597 | } else { |
Sergey Zhemerdeev | e2926cd | 2022-08-29 15:28:47 +0300 | [diff] [blame] | 1598 | cmdParams += "${e.value} '${env[e.key]}' " |
Sergey Zhemerdeev | 2a27334 | 2022-08-18 12:06:11 +0300 | [diff] [blame] | 1599 | } |
| 1600 | } |
Sergey Zhemerdeev | 88d1c3d | 2022-08-31 16:37:48 +0300 | [diff] [blame] | 1601 | // No any check or clean was specified - take a default action |
| 1602 | if (!isCheckClean) { |
| 1603 | cmdParams += '-replicate' |
| 1604 | } |
Sergey Zhemerdeev | 2a27334 | 2022-08-18 12:06:11 +0300 | [diff] [blame] | 1605 | return cmdParams |
| 1606 | } |
Sergey Kolekonov | 0e60a94 | 2022-09-05 13:02:22 +0400 | [diff] [blame] | 1607 | |
| 1608 | /** |
| 1609 | * custom scheduling algorithm |
| 1610 | * it ensures that builds of the same job are distributed as much as possible between different nodes |
| 1611 | * @param label (string) desired node label |
| 1612 | * @return: (string) node name |
| 1613 | */ |
| 1614 | def schedule (label='docker') { |
| 1615 | def common = new com.mirantis.mk.Common() |
| 1616 | def freeNodes = [] |
| 1617 | def nodesMap = [:] |
| 1618 | |
| 1619 | // filter nodes with the specified label and at least one free executor |
| 1620 | timeout(time: 30, unit: 'MINUTES') { |
| 1621 | while (!freeNodes) { |
| 1622 | freeNodes = jenkins.model.Jenkins.instance.computers.findAll { node -> |
| 1623 | label in node.getAssignedLabels().collect { it.name } && |
Sergey Kolekonov | d588717 | 2022-11-10 12:13:22 +0600 | [diff] [blame] | 1624 | node.isPartiallyIdle() && |
| 1625 | node.isOnline() |
Sergey Kolekonov | 0e60a94 | 2022-09-05 13:02:22 +0400 | [diff] [blame] | 1626 | } |
| 1627 | if (!freeNodes) { |
| 1628 | echo 'No nodes available for scheduling, retrying...' |
| 1629 | sleep 30 |
| 1630 | } |
| 1631 | } |
| 1632 | } |
| 1633 | |
| 1634 | // generate a map of nodes matching other criteria |
| 1635 | for (node in freeNodes) { |
| 1636 | // sameJobExecutors is the number of executors running the same job as the calling one |
| 1637 | sameJobExecutors = node.getExecutors() // get all executors |
| 1638 | .collect { executor -> executor.getCurrentExecutable() } // get running "threads" |
| 1639 | .collect { thread -> thread?.displayName } // filter job names from threads |
| 1640 | .minus(null) // null = empty executors, remove them from the list |
| 1641 | .findAll { it.contains(env.JOB_NAME) } // filter the same jobs as the calling one |
| 1642 | .size() |
| 1643 | |
| 1644 | // calculate busy executors, we don't want to count "sameJobExecutors" twice |
| 1645 | totalBusyExecutors = node.countBusy() - sameJobExecutors |
| 1646 | // generate the final map which contains nodes matching criteria with their load score |
| 1647 | // builds of the same jobs have x10 score, all others x1 |
| 1648 | nodesMap += ["${node.getName()}" : sameJobExecutors * 10 + totalBusyExecutors] |
| 1649 | } |
| 1650 | |
| 1651 | // return the least loaded node |
| 1652 | return common.SortMapByValueAsc(nodesMap).collect { it.key }[0] |
| 1653 | } |
Sergey Zhemerdeev | 78a6527 | 2023-03-23 18:05:22 +0200 | [diff] [blame] | 1654 | |
| 1655 | |
| 1656 | /** |
| 1657 | * Get latest tag for test/frontend & equinix-private-infra images |
| 1658 | * @param version (str) default tag value from main workflow |
| 1659 | * @param isChanged (bool) is dependent directory files were changed |
| 1660 | * @param imageName (string) image name for information message |
| 1661 | * @return: (string) tag name |
| 1662 | */ |
| 1663 | def getImageTag(version, isChanged, imageName) { |
| 1664 | def common = new com.mirantis.mk.Common() |
Sergey Zhemerdeev | 5fbf202 | 2023-04-28 14:51:36 +0300 | [diff] [blame] | 1665 | def latestTag = '' |
| 1666 | if (env.GERRIT_EVENT_TYPE && !(env.GERRIT_EVENT_TYPE in ['change-merged', 'ref-updated']) && isChanged) { |
Sergey Zhemerdeev | 78a6527 | 2023-03-23 18:05:22 +0200 | [diff] [blame] | 1667 | latestTag = version |
Sergey Zhemerdeev | ebdcad2 | 2023-04-25 16:58:28 +0300 | [diff] [blame] | 1668 | } else { |
| 1669 | if (env.GERRIT_EVENT_TYPE == 'ref-updated') { |
| 1670 | latestTag = env.GERRIT_REFNAME.replace('refs/tags/v', '').trim() |
| 1671 | } else { |
| 1672 | latestTag = env.GERRIT_BRANCH ? env.GERRIT_BRANCH : env.GERRIT_REFSPEC ? env.GERRIT_REFSPEC : 'master' |
| 1673 | if (latestTag != 'master') { |
| 1674 | latestTag = latestTag.replaceAll('/', '_') |
| 1675 | } |
| 1676 | } |
Sergey Zhemerdeev | 78a6527 | 2023-03-23 18:05:22 +0200 | [diff] [blame] | 1677 | } |
| 1678 | common.infoMsg("${imageName} image will use tag '${latestTag}'") |
| 1679 | return latestTag |
| 1680 | } |
Sergey Zhemerdeev | 1d2c03e | 2023-04-28 11:07:24 +0300 | [diff] [blame] | 1681 | |
Sergey Lalov | 7865910 | 2024-02-15 16:57:21 +0400 | [diff] [blame] | 1682 | /** |
| 1683 | * Get actual branch version for os deployment job |
| 1684 | * @param mosChildPreviouseComplexRelease (string) kaas_previous_complex_mosk_cluster_release_version.txt |
| 1685 | * @param mosChildLatestComplexRelease (string) kaas_latest_complex_mosk_cluster_release_version.txt |
| 1686 | * @param upgradeFlag (boolean) |
| 1687 | * all parametrs get from si-test-release-sanity-check-prepare-configuration job |
| 1688 | * @return: (string) branch verison |
| 1689 | */ |
| 1690 | def getOpenstackbranchVersion(mosChildPreviouseComplexRelease, mosChildLatestComplexRelease, upgradeFlag) { |
| 1691 | def common = new com.mirantis.mk.Common() |
| 1692 | def regex = Pattern.compile('([a-z]+)-([0-9]+-[0-9]+-[0-9]+)-([a-z]*)-?([0-9]+-[0-9]+-?[0-9]*)') |
| 1693 | |
| 1694 | def mosVersionBranch = upgradeFlag ? mosChildPreviouseComplexRelease : mosChildLatestComplexRelease |
| 1695 | def matcherComplexVersion = regex.matcher((mosVersionBranch).toString()) |
| 1696 | def releaseOpenstackK8sBranch = 'master' |
| 1697 | |
| 1698 | if (matcherComplexVersion.find()) { |
| 1699 | def matcherComplexVersionParts = matcherComplexVersion.group(2).split('-') |
| 1700 | releaseOpenstackK8sBranch = String.format('%s.%s.%s', matcherComplexVersionParts[0], matcherComplexVersionParts[1], '0') |
| 1701 | } |
| 1702 | common.infoMsg("Use: OPENSTACK_DEPLOY_RELEASE_DIR ${releaseOpenstackK8sBranch}") |
| 1703 | return releaseOpenstackK8sBranch |
| 1704 | } |
| 1705 | |
| 1706 | |
Sergey Zhemerdeev | 1d2c03e | 2023-04-28 11:07:24 +0300 | [diff] [blame] | 1707 | |
| 1708 | /** |
| 1709 | * Translates set of environment vars into actual replicator command line |
| 1710 | * @return: (string cmdParams, string jobDescription) |
| 1711 | * cmdParams - generated command line |
| 1712 | * jobDescription - job description |
| 1713 | */ |
| 1714 | def genReplicatorCommandLine() { |
| 1715 | def mainModes = ['REPLICATE', 'CLEANUP', 'CHECK_REPOS', 'BIN_CLEANUP'] |
Sergey Zhemerdeev | 9919b1b | 2023-04-28 17:24:21 +0300 | [diff] [blame] | 1716 | def parameterWithoutArgument = mainModes |
Sergey Zhemerdeev | 1d2c03e | 2023-04-28 11:07:24 +0300 | [diff] [blame] | 1717 | def parametersList = parameterWithoutArgument + [ |
| 1718 | 'ARTIFACT_FILTER', |
| 1719 | 'ARTIFACT_TYPE', |
| 1720 | 'BIN_CLEAN_KEEP_DAYS', |
| 1721 | 'BIN_CLEAN_PREFIX', |
| 1722 | 'DOCKER_TAG', |
| 1723 | // DST_ will be changed to TARGET_ |
| 1724 | 'DST_REPO', |
| 1725 | 'DST_REPO_TYPE', |
| 1726 | 'DST_USER', |
| 1727 | 'OLDER_THAN_DAYS', |
| 1728 | 'SLACK_BUILD_URL', |
| 1729 | 'SLACK_CHANNEL', |
| 1730 | 'SLACK_USER', |
| 1731 | 'SRC_REPO', |
| 1732 | 'SRC_REPO_TYPE', |
| 1733 | 'SRC_USER', |
| 1734 | 'SYNC_PATTERN', |
| 1735 | 'THREAD_COUNT' |
| 1736 | ] |
| 1737 | def mainModesDescriptions = [ |
| 1738 | 'REPLICATE': 'Replicating binaries/Docker images', |
| 1739 | 'CLEANUP': 'Cleaning Docker images', |
| 1740 | 'BIN_CLEANUP': 'Cleaning binaries', |
| 1741 | 'CHECK_REPOS': 'Checking binaries' |
| 1742 | ] |
| 1743 | |
| 1744 | def cmdParams = '' |
| 1745 | def jobDescription = '' |
| 1746 | for (e in parametersList) { |
| 1747 | if (env[e] == null || env[e] == '') { |
| 1748 | continue |
| 1749 | } |
| 1750 | if (e in mainModes) { |
| 1751 | jobDescription = mainModesDescriptions[e] |
| 1752 | } |
| 1753 | cmdParams += "-${e.replaceAll('_', '-').toLowerCase()} " |
| 1754 | if (!(e in parameterWithoutArgument)) { |
| 1755 | cmdParams += "'${env[e]}' " |
| 1756 | } |
| 1757 | } |
| 1758 | return [cmdParams, jobDescription] |
| 1759 | } |