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