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