| package com.mirantis.mk |
| |
| import static groovy.json.JsonOutput.toJson |
| import java.util.regex.Pattern |
| |
| /** |
| * |
| * KaaS Component Testing Utilities |
| * |
| */ |
| |
| /** |
| * Check KaaS Core CICD feature flags |
| * such triggers can be used in case of switching between pipelines, |
| * conditions inside pipelines to reduce dependency on jenkins job builder and jenkins job templates itself |
| * |
| * @return (map)[ |
| * ffNameEnabled: (bool) True/False |
| * ] |
| */ |
| def checkCoreCIFeatureFlags() { |
| def common = new com.mirantis.mk.Common() |
| def ff = [ |
| build_artifacts_upgrade: false, |
| ] |
| |
| def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| if (commitMsg ==~ /(?s).*\[ci-build-artifacts-upgrade\].*/) { |
| ff['build_artifacts_upgrade'] = true |
| } |
| |
| common.infoMsg("Core ci feature flags status: ${ff}") |
| return ff |
| } |
| |
| /** |
| * Determine scope of test suite against per-commit KaaS deployment based on keywords |
| * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
| * |
| * Used for components team to combine test-suites and forward desired parameters to kaas/core deployment jobs |
| * Example scheme: |
| * New CR pushed in kubernetes/lcm-ansible -> parsing it'cs commit body and combine test-suite -> trigger deployment jobs from kaas/core |
| * manage test-suite through Jenkins Job Parameters |
| * |
| * @return (map)[ |
| * deployChildEnabled: (bool) True if need to deploy child cluster during demo-run |
| * runUie2eEnabled: (bool) True if need to run ui-e2e cluster during demo-run |
| * ] |
| */ |
| def checkDeploymentTestSuite() { |
| def common = new com.mirantis.mk.Common() |
| |
| // Available triggers and its sane defaults |
| def seedMacOs = env.SEED_MACOS ? env.SEED_MACOS.toBoolean() : false |
| def deployChild = env.DEPLOY_CHILD_CLUSTER ? env.DEPLOY_CHILD_CLUSTER.toBoolean() : false |
| def upgradeChild = env.UPGRADE_CHILD_CLUSTER ? env.UPGRADE_CHILD_CLUSTER.toBoolean() : false |
| def fullUpgradeChild = env.FULL_UPGRADE_CHILD_CLUSTER ? env.FULL_UPGRADE_CHILD_CLUSTER.toBoolean() : false |
| def mosDeployChild = env.DEPLOY_MOS_CHILD_CLUSTER ? env.DEPLOY_MOS_CHILD_CLUSTER.toBoolean() : false |
| def mosUpgradeChild = env.UPGRADE_MOS_CHILD_CLUSTER ? env.UPGRADE_MOS_CHILD_CLUSTER.toBoolean() : false |
| def customChildRelease = env.KAAS_CHILD_CLUSTER_RELEASE_NAME ? env.KAAS_CHILD_CLUSTER_RELEASE_NAME : '' |
| def mosTfDeploy = env.MOS_TF_DEPLOY ? env.MOS_TF_DEPLOY.toBoolean() : false |
| def attachBYO = env.ATTACH_BYO ? env.ATTACH_BYO.toBoolean() : false |
| def upgradeBYO = env.UPGRADE_BYO ? env.UPGRADE_BYO.toBoolean() : false |
| def runBYOMatrix = env.RUN_BYO_MATRIX ? env.RUN_BYO_MATRIX.toBoolean() : false |
| def defaultBYOOs = env.DEFAULT_BYO_OS ? env.DEFAULT_BYO_OS.toString() : 'ubuntu' |
| def upgradeMgmt = env.UPGRADE_MGMT_CLUSTER ? env.UPGRADE_MGMT_CLUSTER.toBoolean() : false |
| def autoUpgradeMgmt = env.AUTO_UPGRADE_MCC ? env.AUTO_UPGRADE_MCC.toBoolean() : false |
| def enableLMALogging = env.ENABLE_LMA_LOGGING ? env.ENABLE_LMA_LOGGING.toBoolean(): false |
| def deployOsOnMos = env.DEPLOY_OS_ON_MOS? env.DEPLOY_OS_ON_MOS.toBoolean() : false |
| def runUie2e = env.RUN_UI_E2E ? env.RUN_UI_E2E.toBoolean() : false |
| def runUie2eNew = env.RUN_UI_E2E_NEW ? env.RUN_UI_E2E_NEW.toBoolean() : false |
| def runMgmtConformance = env.RUN_MGMT_CFM ? env.RUN_MGMT_CFM.toBoolean() : false |
| def runMgmtConformanceNetworkPolicy = env.RUN_MGMT_CFM_NETWORK_POLICY ? env.RUN_MGMT_CFM_NETWORK_POLICY.toBoolean() : false |
| def runLMATest = env.RUN_LMA_TEST ? env.RUN_LMA_TEST.toBoolean() : false |
| def runMgmtUserControllerTest = env.RUN_MGMT_USER_CONTROLLER_TEST ? env.RUN_MGMT_USER_CONTROLLER_TEST.toBoolean() : false |
| def runProxyChildTest = env.RUN_PROXY_CHILD_TEST ? env.RUN_PROXY_CHILD_TEST.toBoolean() : false |
| def runChildConformance = env.RUN_CHILD_CFM ? env.RUN_CHILD_CFM.toBoolean() : false |
| def runChildStacklightHa = env.RUN_STACKLIGHT_CHILD_HA ? env.RUN_STACKLIGHT_CHILD_HA.toBoolean() : false |
| def runChildConformanceNetworkPolicy = env.RUN_CHILD_CFM_NETWORK_POLICY ? env.RUN_CHILD_CFM_NETWORK_POLICY.toBoolean() : false |
| def runChildHPA = env.RUN_CHILD_HPA ? env.RUN_CHILD_HPA.toBoolean() : false |
| def fetchServiceBinaries = env.FETCH_BINARIES_FROM_UPSTREAM ? env.FETCH_BINARIES_FROM_UPSTREAM.toBoolean() : false |
| def equinixMetalV2ChildDiffMetro = env.EQUINIXMETALV2_CHILD_DIFF_METRO ? env.EQUINIXMETALV2_CHILD_DIFF_METRO.toBoolean() : false |
| def runMaintenanceTest = env.RUN_MAINTENANCE_TEST ? env.RUN_MAINTENANCE_TEST.toBoolean() : false |
| def runContainerregistryTest = env.RUN_CONTAINER_REGISTRY_TEST ? env.RUN_CONTAINER_REGISTRY_TEST.toBoolean() : false |
| def runMgmtDeleteMasterTest = env.RUN_MGMT_DELETE_MASTER_TEST ? env.RUN_MGMT_DELETE_MASTER_TEST.toBoolean() : false |
| def runRgnlDeleteMasterTest = env.RUN_RGNL_DELETE_MASTER_TEST ? env.RUN_RGNL_DELETE_MASTER_TEST.toBoolean() : false |
| def runChildDeleteMasterTest = env.RUN_CHILD_DELETE_MASTER_TEST ? env.RUN_CHILD_DELETE_MASTER_TEST.toBoolean() : false |
| def runGracefulRebootTest = env.RUN_GRACEFUL_REBOOT_TEST ? env.RUN_GRACEFUL_REBOOT_TEST.toBoolean() : false |
| def pauseForDebug = env.PAUSE_FOR_DEBUG ? env.PAUSE_FOR_DEBUG.toBoolean() : false |
| def runChildMachineDeletionPolicyTest = env.RUN_CHILD_MACHINE_DELETION_POLICY_TEST ? env.RUN_CHILD_MACHINE_DELETION_POLICY_TEST.toBoolean() : false |
| def runChildCustomCertTest = env.RUN_CHILD_CUSTOM_CERT_TEST ? env.RUN_CHILD_CUSTOM_CERT_TEST.toBoolean() : false |
| def runByoChildCustomCertTest = env.RUN_BYO_CHILD_CUSTOM_CERT_TEST ? env.RUN_BYO_CHILD_CUSTOM_CERT_TEST.toBoolean() : false |
| def runMgmtCustomCacheCertTest = env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST ? env.RUN_MGMT_CUSTOM_CACHE_CERT_TEST.toBoolean() : false |
| def runMkeCustomCertTest = env.RUN_MKE_CUSTOM_CERT_TEST ? env.RUN_MKE_CUSTOM_CERT_TEST.toBoolean() : false |
| def runCustomHostnames = env.RUN_CUSTOM_HOSTNAMES ? env.RUN_CUSTOM_HOSTNAMES.toBoolean() : false |
| def slLatest = env.SL_LATEST ? env.SL_LATEST.toBoolean() : false |
| def coreKeycloakLdap = env.CORE_KEYCLOAK_LDAP_ENABLED ? env.CORE_KEYCLOAK_LDAP_ENABLED.toBoolean() : false |
| def configureInternalNTP = env.CORE_KAAS_NTP_ENABLED ? env.CORE_KAAS_NTP_ENABLED.toBoolean() : false |
| def disableKubeApiAudit = env.DISABLE_KUBE_API_AUDIT ? env.DISABLE_KUBE_API_AUDIT.toBoolean() : false |
| def auditd = env.AUDITD_ENABLE ? env.AUDITD_ENABLE.toBoolean() : false |
| def customSlackChannel = env.SLACK_CHANNEL_NOTIFY ? env.SLACK_CHANNEL_NOTIFY : '' |
| def runNTPUpdateTest = env.RUN_NTP_UPDATE_TEST ? env.RUN_NTP_UPDATE_TEST.toBoolean() : false |
| def runMCCMariaBackupRestoreTest = env.RUN_MCC_MARIA_BACKUP_RESTORE_TEST ? env.RUN_MCC_MARIA_BACKUP_RESTORE_TEST.toBoolean() : false |
| def runRuntimeMigrateExtendedTestMgmt = env.RUN_MGMT_RUNTIME_MIGRATE_EXTENDED_TEST ? env.RUN_MGMT_RUNTIME_MIGRATE_EXTENDED_TEST.toBoolean() : false |
| def runRuntimeMigrateQuickTestMgmt = env.RUN_MGMT_RUNTIME_MIGRATE_QUICK_TEST ? env.RUN_MGMT_RUNTIME_MIGRATE_QUICK_TEST.toBoolean() : false |
| def runRuntimeMigrateAndRollbackTestMgmt = env.RUN_MGMT_RUNTIME_MIGRATE_AND_ROLLBACK_TEST ? env.RUN_MGMT_RUNTIME_MIGRATE_AND_ROLLBACK_TEST.toBoolean() : false |
| def runRuntimeMigrateExtendedTestChild = env.RUN_CHILD_RUNTIME_MIGRATE_EXTENDED_TEST ? env.RUN_CHILD_RUNTIME_MIGRATE_EXTENDED_TEST.toBoolean() : false |
| def runRuntimeMigrateQuickTestChild = env.RUN_CHILD_RUNTIME_MIGRATE_QUICK_TEST ? env.RUN_CHILD_RUNTIME_MIGRATE_QUICK_TEST.toBoolean() : false |
| def runRuntimeMigrateAndRollbackTestChild = env.RUN_CHILD_RUNTIME_MIGRATE_AND_ROLLBACK_TEST ? env.RUN_CHILD_RUNTIME_MIGRATE_AND_ROLLBACK_TEST.toBoolean() : false |
| def upgradeChildPlanSeq = env.UPGRADE_CHILD_PLAN_SEQ ? env.UPGRADE_CHILD_PLAN_SEQ.toBoolean() : false |
| def upgradeChildPlanBulk = env.UPGRADE_CHILD_PLAN_BULK ? env.UPGRADE_CHILD_PLAN_BULK.toBoolean() : false |
| // multiregion configuration from env variable: comma-separated string in form $mgmt_provider,$regional_provider |
| def multiregionalMappings = env.MULTIREGION_SETUP ? multiregionWorkflowParser(env.MULTIREGION_SETUP) : [ |
| enabled: false, |
| managementLocation: '', |
| regionLocation: '', |
| ] |
| |
| // proxy customization |
| def proxyConfig = [ |
| mgmtOffline: env.OFFLINE_MGMT_CLUSTER ? env.OFFLINE_MGMT_CLUSTER.toBoolean() : false, |
| childOffline: env.OFFLINE_CHILD_CLUSTER ? env.OFFLINE_CHILD_CLUSTER.toBoolean() : false, |
| childProxy: env.PROXY_CHILD_CLUSTER ? env.PROXY_CHILD_CLUSTER.toBoolean() : false, |
| ] |
| |
| // optional demo deployment customization |
| def awsOnDemandDemo = env.ALLOW_AWS_ON_DEMAND ? env.ALLOW_AWS_ON_DEMAND.toBoolean() : false |
| def equinixOnDemandDemo = env.ALLOW_EQUINIX_ON_DEMAND ? env.ALLOW_EQUINIX_ON_DEMAND.toBoolean() : false |
| def equinixMetalV2OnDemandDemo = env.ALLOW_EQUINIXMETALV2_ON_DEMAND ? env.ALLOW_EQUINIXMETALV2_ON_DEMAND.toBoolean() : false |
| def equinixOnAwsDemo = env.EQUINIX_ON_AWS_DEMO ? env.EQUINIX_ON_AWS_DEMO.toBoolean() : false |
| def azureOnAwsDemo = env.AZURE_ON_AWS_DEMO ? env.AZURE_ON_AWS_DEMO.toBoolean() : false |
| def azureOnDemandDemo = env.ALLOW_AZURE_ON_DEMAND ? env.ALLOW_AZURE_ON_DEMAND.toBoolean() : false |
| def enableVsphereDemo = env.ALLOW_VSPHERE_ON_DEMAND ? env.ALLOW_VSPHERE_ON_DEMAND.toBoolean() : false |
| def enableOSDemo = true |
| def enableBMDemo = true |
| def enablebmCoreDemo = env.ALLOW_BM_CORE_ON_DEMAND ? env.ALLOW_BM_CORE_ON_DEMAND.toBoolean() : false |
| def bmCoreCleanup = env.BM_CORE_CLEANUP ? env.BM_CORE_CLEANUP.toBoolean() : true |
| def enableArtifactsBuild = true |
| def bmDeployType = env.BM_DEPLOY_TYPE ? env.BM_DEPLOY_TYPE.toString() : 'virtual' |
| def openstackIMC = env.OPENSTACK_CLOUD_LOCATION ? env.OPENSTACK_CLOUD_LOCATION : 'us' |
| def enableVsphereUbuntu = env.VSPHERE_DEPLOY_UBUNTU ? env.VSPHERE_DEPLOY_UBUNTU.toBoolean() : false |
| def enableVsphereRHEL = env.VSPHERE_DEPLOY_RHEL ? env.VSPHERE_DEPLOY_RHEL.toBoolean() : false |
| def childOsBootFromVolume = env.OPENSTACK_BOOT_FROM_VOLUME ? env.OPENSTACK_BOOT_FROM_VOLUME.toBoolean() : false |
| def bootstrapV2Scenario = env.BOOTSTRAP_V2_ENABLED ? env.BOOTSTRAP_V2_ENABLED.toBoolean() : false |
| def equinixMetalV2Metro = env.EQUINIX_MGMT_METRO ? env.EQUINIX_MGMT_METRO : '' |
| def enableFips = env.ENABLE_FIPS ? env.ENABLE_FIPS.toBoolean() : false |
| def enableMkeDebug = env.ENABLE_MKE_DEBUG ? env.ENABLE_MKE_DEBUG.toBoolean() : false |
| def aioCluster = env.AIO_CLUSTER ? env.AIO_CLUSTER.toBoolean() : false |
| def dockerServicesCheckSkip = env.DOCKER_SERVICES_CHECK_SKIP ? env.DOCKER_SERVICES_CHECK_SKIP.toBoolean() : false |
| def useVsphereVvmtObjects = env.VSPHERE_USE_VVMT_OBJECTS ? env.VSPHERE_USE_VVMT_OBJECTS.toBoolean() : false |
| def enableBv2Smoke = true |
| def runCacheWarmup = env.CACHE_WARMUP_ENABLED ? env.CACHE_WARMUP_ENABLED.toBoolean() : false |
| def cveScan = false |
| // Sync to public CDN is triggered automatically for corresponding scenarios |
| // This trigger is used only for on-demand cases |
| def publicCISync = false |
| |
| def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| if (commitMsg ==~ /(?s).*\[mgmt-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-proxy.*/) { |
| proxyConfig['mgmtOffline'] = true |
| common.warningMsg('Forced running offline mgmt deployment, some provider CDN regions for mgmt deployment may be set to *public-ci* to verify proxy configuration') |
| } |
| if (commitMsg ==~ /(?s).*\[mgmt-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-upgrade.*/) { |
| upgradeMgmt = true |
| } |
| if (commitMsg ==~ /(?s).*\[auto-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*auto-upgrade.*/) { |
| autoUpgradeMgmt = true |
| } |
| if (commitMsg ==~ /(?s).*\[seed-macos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*seed-macos.*/) { |
| seedMacOs = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ || |
| upgradeChild || runChildConformance || runProxyChildTest || runChildHPA || runChildConformanceNetworkPolicy) { |
| deployChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) { |
| deployChild = true |
| upgradeChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-upgrade-full\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade-full.*/) { |
| deployChild = true |
| upgradeChild = true |
| common.warningMsg("2-step child updates are not testing (PRODX-33510)") |
| //TODO: revert after start testing the two-step upgrade again (PRODX-33510) |
| //fullUpgradeChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-upgrade-plan-sequental\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade-plan-sequental.*/) { |
| deployChild = true |
| upgradeChild = true |
| upgradeChildPlanSeq = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-upgrade-plan-bulk\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade-plan-bulk.*/) { |
| deployChild = true |
| upgradeChild = true |
| upgradeChildPlanBulk = true |
| } |
| if ((upgradeMgmt || autoUpgradeMgmt) && deployChild) { |
| upgradeChild = true |
| common.warningMsg('child upgrade is automatically enabled as mgmt upgrade and child deploy are enabled') |
| } |
| def childDeployMatches = (commitMsg =~ /(\[child-deploy\s*(\w|\-)+?\])/) |
| if (childDeployMatches.size() > 0) { |
| // override child version when it set explicitly |
| deployChild = true |
| customChildRelease = childDeployMatches[0][0].split('child-deploy')[1].replaceAll('[\\[\\]]', '').trim() |
| common.warningMsg("Forced child deployment using custom release version ${customChildRelease}") |
| } |
| if (commitMsg ==~ /(?s).*\[mos-child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-deploy.*/) { |
| mosDeployChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[mos-child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mos-child-upgrade.*/) { |
| mosDeployChild = true |
| mosUpgradeChild = true |
| } |
| if ((upgradeMgmt || autoUpgradeMgmt) && mosDeployChild) { |
| mosUpgradeChild = true |
| common.warningMsg('MOSK child upgrade is automatically enabled as mgmt upgrade and MOSK child deploy are enabled') |
| } |
| if (commitMsg ==~ /(?s).*\[byo-attach\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-attach.*/) { |
| attachBYO = true |
| } |
| if (commitMsg ==~ /(?s).*\[byo-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-upgrade.*/) { |
| attachBYO = true |
| upgradeBYO = true |
| } |
| if (commitMsg ==~ /(?s).*\[ui-test-on-all-providers\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-test-on-all-providers.*/) { |
| enableVsphereDemo = true |
| enableOSDemo = true |
| awsOnDemandDemo = true |
| azureOnDemandDemo = true |
| equinixOnDemandDemo = true |
| equinixMetalV2OnDemandDemo = true |
| runUie2e = true |
| // Edit after fix PRODX-3961 |
| enableBMDemo = false |
| } |
| def byoDeployMatches = (commitMsg =~ /(\[run-byo-matrix\s*(ubuntu|centos)\])/) |
| if (commitMsg ==~ /(?s).*\[run-byo-matrix\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*run-byo-matrix\.*/ || byoDeployMatches.size() > 0) { |
| runBYOMatrix = true |
| |
| if (byoDeployMatches.size() > 0) { |
| defaultBYOOs = byoDeployMatches[0][2] |
| common.warningMsg("Custom BYO OS detected, using ${defaultBYOOs}") |
| } |
| |
| common.warningMsg('Forced byo matrix test via run-byo-matrix, all other byo triggers will be skipped') |
| attachBYO = false |
| upgradeBYO = false |
| } |
| if (commitMsg ==~ /(?s).*\[lma-logging\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-logging.*/) { |
| enableLMALogging = true |
| } |
| if (commitMsg ==~ /(?s).*\[deploy-os-on-mos\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*deploy-os-on-mos.*/) { |
| deployOsOnMos = true |
| mosDeployChild = true |
| } |
| |
| if (commitMsg ==~ /(?s).*\[half-virtual\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*half-virtual.*/ || upgradeMgmt) { |
| bmDeployType = 'half-virtual' |
| } |
| |
| if (commitMsg ==~ /(?s).*\[ui-e2e-nw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-nw.*/) { |
| runUie2e = true |
| } |
| if (commitMsg ==~ /(?s).*\[ui-e2e-pw\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ui-e2e-pw.*/) { |
| runUie2eNew = true |
| } |
| if (commitMsg ==~ /(?s).*\[mgmt-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm.*/) { |
| runMgmtConformance = true |
| } |
| if (commitMsg ==~ /(?s).*\[mgmt-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-cfm-netpolicy.*/) { |
| runMgmtConformanceNetworkPolicy = true |
| } |
| if (commitMsg ==~ /(?s).*\[test-user-controller\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-user-controller.*/) { |
| runMgmtUserControllerTest = true |
| } |
| if (commitMsg ==~ /(?s).*\[test-proxy-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*test-proxy-child.*/) { |
| runProxyChildTest = true |
| deployChild = true |
| common.infoMsg('Child cluster deployment will be enabled since proxy child test suite will be executed') |
| } |
| if (commitMsg ==~ /(?s).*\[child-cfm\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm.*/) { |
| runChildConformance = true |
| deployChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-cfm-netpolicy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-cfm-netpolicy.*/) { |
| runChildConformanceNetworkPolicy = true |
| deployChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-hpa\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-hpa.*/) { |
| runChildHPA = true |
| deployChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-sl-ha\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-sl-ha.*/) { |
| runChildStacklightHa = true |
| deployChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[lma-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-test.*/) { |
| runLMATest = true |
| enableLMALogging = true |
| common.infoMsg('LMA logging will be enabled since LMA test suite will be executed') |
| } |
| if (commitMsg ==~ /(?s).*\[maintenance-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*maintenance-test.*/) { |
| runMaintenanceTest = true |
| } |
| if (commitMsg ==~ /(?s).*\[container-registry-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*container-registry-test.*/) { |
| runContainerregistryTest = true |
| } |
| if (commitMsg ==~ /(?s).*\[mgmt-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-delete-master-test.*/) { |
| runMgmtDeleteMasterTest = true |
| } |
| if (commitMsg ==~ /(?s).*\[rgnl-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*rgnl-delete-master-test.*/) { |
| runRgnlDeleteMasterTest = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-delete-master-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-delete-master-test.*/) { |
| if (!mosDeployChild) { |
| deployChild = true |
| } |
| runChildDeleteMasterTest = true |
| common.infoMsg('Child cluster deployment will be enabled since delete child master node test suite will be executed') |
| } |
| if (commitMsg ==~ /(?s).*\[child-machine-deletion-policy-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-machine-deletion-policy-test.*/) { |
| runChildMachineDeletionPolicyTest = true |
| deployChild = true |
| common.infoMsg('Child cluster deployment will be enabled since machine deletion child policy test suite will be executed') |
| } |
| if (commitMsg ==~ /(?s).*\[graceful-reboot-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*graceful-reboot-test.*/) { |
| runGracefulRebootTest = true |
| } |
| if (commitMsg ==~ /(?s).*\[pause-for-debug\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*pause-for-debug.*/) { |
| pauseForDebug = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-offline\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-offline.*/) { |
| proxyConfig['childOffline'] = true |
| deployChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[child-proxy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-proxy.*/) { |
| proxyConfig['childOffline'] = true |
| proxyConfig['childProxy'] = true |
| deployChild = true |
| } |
| if (commitMsg ==~ /(?s).*\[fetch.*binaries\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*fetch.*binaries.*/) { |
| fetchServiceBinaries = true |
| } |
| if (commitMsg ==~ /(?s).*\[equinix-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-on-aws.*/) { |
| equinixOnAwsDemo = true |
| common.warningMsg('Forced running child cluster deployment on EQUINIX METAL provider based on AWS management cluster, triggered on patchset using custom keyword: \'[equinix-on-aws]\' ') |
| } |
| if (commitMsg ==~ /(?s).*\[azure-on-aws\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-on-aws.*/) { |
| azureOnAwsDemo = true |
| common.warningMsg('Forced running child cluster deployment on Azure provider based on AWS management cluster, triggered on patchset using custom keyword: \'[azure-on-aws]\' ') |
| } |
| if (commitMsg ==~ /(?s).*\[aws-demo\].*/ || |
| env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aws-demo.*/ || |
| runBYOMatrix || |
| seedMacOs || |
| equinixOnAwsDemo || |
| azureOnAwsDemo) { |
| |
| awsOnDemandDemo = true |
| common.warningMsg('Running additional kaas deployment with AWS provider, may be forced due applied trigger cross dependencies, follow docs to clarify info') |
| } |
| if (commitMsg ==~ /(?s).*\[equinix-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinix-demo\.*/) { |
| equinixOnDemandDemo = true |
| } |
| if (commitMsg ==~ /(?s).*\[equinixmetalv2-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-demo\.*/) { |
| equinixMetalV2OnDemandDemo = true |
| } |
| if (commitMsg ==~ /(?s).*\[equinixmetalv2-child-diff-metro\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*equinixmetalv2-child-diff-metro\.*/) { |
| equinixMetalV2OnDemandDemo = true |
| equinixMetalV2ChildDiffMetro = true |
| } |
| if (commitMsg ==~ /(?s).*\[azure-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*azure-demo\.*/) { |
| azureOnDemandDemo = true |
| } |
| if (commitMsg ==~ /(?s).*\[disable-all-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-all-demo\.*/) { |
| enableVsphereDemo = false |
| enableOSDemo = false |
| enableBMDemo = false |
| enableBv2Smoke = false |
| common.errorMsg('vSphere, BM, Openstack, demo deployments and Bootstrap v2 smoke checks will be aborted, VF -1 will be set') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[disable-os-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-os-demo\.*/) { |
| enableOSDemo = false |
| common.errorMsg('Openstack demo deployment will be aborted, VF -1 will be set') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[disable-bm-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-demo\.*/) { |
| enableBMDemo = false |
| common.errorMsg('BM demo deployment will be aborted, VF -1 will be set') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[bm-core-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bm-core-demo\\.*/) { |
| enablebmCoreDemo = true |
| enableBMDemo = false |
| } |
| |
| if (bmDeployType == 'half-virtual' && enablebmCoreDemo) { |
| common.infoMsg('Half-virtual will be deployed by default on upgrade case') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[disable-bm-core-cleanup\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bm-core-cleanup\\.*/) { |
| bmCoreCleanup = false |
| } |
| |
| if (commitMsg ==~ /(?s).*\[disable-vsphere-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-vsphere-demo\.*/) { |
| enableVsphereDemo = false |
| common.errorMsg('vSphere demo deployment will be aborted, VF -1 will be set') |
| } |
| if (commitMsg ==~ /(?s).*\[vsphere-ubuntu\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-ubuntu\.*/) { |
| enableVsphereUbuntu = true |
| common.warningMsg('Ubuntu will be used to deploy vsphere machines') |
| } |
| if (commitMsg ==~ /(?s).*\[vsphere-rhel\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-rhel\.*/) { |
| enableVsphereRHEL = true |
| common.warningMsg('RHEL will be used to deploy vsphere machines') |
| } |
| if (commitMsg ==~ /(?s).*\[disable-bv2-smoke\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-bv2-smoke\.*/) { |
| enableBv2Smoke = false |
| common.errorMsg('Bootstrap v2 smoke checks will be aborted, WF -1 will be set') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[cve-scan\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*cve-scan\.*/) { |
| cveScan = true |
| common.errorMsg('CVE Scan job enabled') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[public-ci-sync\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*public-ci-sync\.*/) { |
| publicCISync = true |
| common.errorMsg('Sync to public-ci CDN is enabled') |
| } |
| |
| def slackChannelMatches = (commitMsg =~ /(\[slack-channel\s*[#@](\S+)])/) |
| if (slackChannelMatches.size() > 0) { |
| // override chanenel notify when it set explicitly |
| customSlackChannel = slackChannelMatches[0][0].split("slack-channel")[1].replaceAll('[\\[\\]]', '').trim() |
| common.warningMsg("Forced send notify to ${customSlackChannel} channel") |
| } |
| |
| if (commitMsg ==~ /(?s).*\[disable-artifacts-build\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-artifacts-build\.*/) { |
| enableArtifactsBuild = false |
| common.errorMsg('artifacts build will be aborted, VF -1 will be set') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[child-os-boot-from-volume\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-os-boot-from-volume\.*/) { |
| childOsBootFromVolume = true |
| common.warningMsg('OS will be booted from Ceph volumes') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-custom-cert-test\.*/) { |
| runChildCustomCertTest = true |
| deployChild = true |
| common.warningMsg('Child cluster deployment will be enabled since custom cert child test suite will be executed') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[mgmt-custom-cache-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mgmt-custom-cache-cert-test\.*/) { |
| runMgmtCustomCacheCertTest = true |
| deployChild = true |
| common.warningMsg('Child cluster deployment will be enabled as the test replaces the mgmt and cluster childcertificates') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[mke-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mke-custom-cert-test\.*/) { |
| runMkeCustomCertTest = true |
| } |
| |
| if (commitMsg ==~ /(?s).*\[custom-hostnames\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*custom-hostnames\.*/) { |
| runCustomHostnames = true |
| common.warningMsg('All clusters will be deployed with Custom Hostnames') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[sl-latest\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*sl-latest\.*/) { |
| slLatest = true |
| common.warningMsg('All clusters will be deployed with Stacklight version from artifact-metadata') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[keycloak-ldap\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*keycloak-ldap\.*/) { |
| coreKeycloakLdap = true |
| common.warningMsg('Management cluster will be deployed with LDAP integration enabled and after-deployment checks will be executed') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[ntp-update\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*ntp-update\.*/) { |
| runNTPUpdateTest = true |
| common.warningMsg('After deployment of mgmt job with NTP update will be executed') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[mcc-maria-backup-restore\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*mcc-maria-backup-restore\.*/) { |
| runMCCMariaBackupRestoreTest = true |
| common.warningMsg('MCC Maria Backup/Restore test will be executed as part of mgmt test suite') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[runtime-migrate-extended-mgmt\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-extended-mgmt\.*/) { |
| runRuntimeMigrateExtendedTestMgmt = true |
| common.warningMsg('Runtime migration with semi-reverts (extended test) scheduled as part of mgmt test suite') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[runtime-migrate-quick-mgmt\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-quick-mgmt\.*/) { |
| runRuntimeMigrateQuickTestMgmt = true |
| common.warningMsg('Runtime migration of all nodes in one action (quick test) scheduled as part of mgmt test suite') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[runtime-migrate-and-rollback-mgmt\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-and-rollback-mgmt\.*/) { |
| runRuntimeMigrateAndRollbackTestMgmt = true |
| common.warningMsg('Runtime migration with semi-reverts (extended test) and runtime rollback scheduled as part of mgmt test suite') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[runtime-migrate-extended-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-extended-child\.*/) { |
| runRuntimeMigrateExtendedTestChild = true |
| common.warningMsg('Runtime migration with semi-reverts (extended test) scheduled as part of child test suite') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[runtime-migrate-quick-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-quick-child\.*/) { |
| runRuntimeMigrateQuickTestChild = true |
| common.warningMsg('Runtime migration of all nodes in one action (quick test) scheduled as part of child test suite') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[runtime-migrate-and-rollback-child\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*runtime-migrate-and-rollback-child\.*/) { |
| runRuntimeMigrateAndRollbackTestChild = true |
| common.warningMsg('Runtime migration with semi-reverts (extended test) and runtime rollback scheduled as part of child test suite') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[internal-ntp\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*internal-ntp\.*/ || proxyConfig['mgmtOffline'] || proxyConfig['childOffline']) { |
| configureInternalNTP = true |
| openstackIMC = 'eu' |
| common.warningMsg('Internal NTP servers will be used. Forced deployment for an offline case in eu cloud') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[disable-kube-api-audit\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-kube-api-audit\.*/) { |
| disableKubeApiAudit = true |
| common.warningMsg('Disable KUBE API audit for mgmt cluster') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[auditd\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-kube-api-audit\.*/) { |
| auditd = true |
| } |
| |
| if (commitMsg ==~ /(?s).*\[byo-child-custom-cert-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*byo-child-custom-cert-test\.*/) { |
| runByoChildCustomCertTest = true |
| attachBYO = true |
| common.warningMsg('Byo child cluster deployment will be enabled since custom cert child test suite will be executed') |
| } |
| |
| // TODO (vnaumov) remove below condition after moving all releases to UCP |
| def ucpChildMatches = (commitMsg =~ /(\[child-ucp\s*ucp-.*?\])/) |
| if (ucpChildMatches.size() > 0) { |
| deployChild = true |
| common.warningMsg('Forced UCP based child deployment triggered on patchset using custom keyword: \'[child-ucp ucp-5-1-0-3-3-0-example]\' ') |
| |
| // TODO(vnaumov) delete after ucp upgrades support |
| common.errorMsg('Child upgrade test will be skipped, UCP upgrades temporally disabled') |
| upgradeChild = false |
| } |
| |
| if (commitMsg ==~ /(?s).*\[aio-cluster\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aio-cluster.*/) { |
| aioCluster = true |
| } |
| |
| if (commitMsg ==~ /(?s).*\[enable-docker-services-check\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*aio-cluster.*/) { |
| dockerServicesCheckSkip = false |
| common.warningMsg('Forced enable docker service check for all job on WF') |
| } |
| |
| if (commitMsg ==~ /(?s).*\[cache-warmup\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*cache-warmup.*/) { |
| runCacheWarmup = true |
| } |
| |
| if (runCacheWarmup && (!deployChild && !mosDeployChild)) { |
| runCacheWarmup = false |
| common.errorMsg('Child cluster deployment is not enabled, skipping Cache Warmup') |
| } |
| |
| // multiregional tests |
| def multiRegionalMatches = (commitMsg =~ /(\[multiregion\s*.*?\])/) |
| if (multiRegionalMatches.size() > 0) { |
| multiregionalMappings = multiregionWorkflowParser(multiRegionalMatches) |
| } |
| switch (multiregionalMappings['managementLocation']) { |
| case 'aws': |
| common.warningMsg('Forced running additional kaas deployment with AWS provider according multiregional demo request') |
| awsOnDemandDemo = true |
| |
| if (multiregionalMappings['regionLocation'] != 'aws' && seedMacOs) { // macstadium seed node has access only to *public* providers |
| error('incompatible triggers: [seed-macos] and multiregional deployment based on *private* regional provider cannot be applied simultaneously') |
| } |
| break |
| case 'os': |
| if (enableOSDemo == false) { |
| error('incompatible triggers: [disable-os-demo] and multiregional deployment based on OSt management region cannot be applied simultaneously') |
| } |
| break |
| case 'vsphere': |
| if (enableVsphereDemo == false) { |
| error('incompatible triggers: [disable-vsphere-demo] and multiregional deployment based on Vsphere management region cannot be applied simultaneously') |
| } |
| break |
| case 'equinix': |
| common.warningMsg('Forced running additional kaas deployment with Equinix provider according multiregional demo request') |
| equinixOnDemandDemo = true |
| break |
| case 'equinixmetalv2': |
| common.warningMsg('Forced running additional kaas deployment with Equinix Metal V2 provider according multiregional demo request') |
| equinixMetalV2OnDemandDemo = true |
| break |
| case 'azure': |
| common.warningMsg('Forced running additional kaas deployment with Azure provider according multiregional demo request') |
| azureOnDemandDemo = true |
| break |
| } |
| |
| // CDN configuration |
| def cdnConfig = [ |
| mgmt: [ |
| openstack: 'internal-ci', |
| vsphere: 'internal-eu', |
| aws: 'public-ci', |
| equinix: 'public-ci', |
| azure: 'public-ci', |
| ], |
| ] |
| |
| if (commitMsg ==~ /(?s).*\[eu-demo\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*eu-demo.*/) { |
| openstackIMC = 'eu' |
| } |
| |
| if (openstackIMC == 'eu') { |
| // use internal-eu because on internal-ci with eu cloud image pull takes much time |
| def cdnRegion = 'internal-eu' |
| cdnConfig['mgmt']['openstack'] = cdnRegion |
| } |
| |
| // calculate weight of current demo run to manage lockable resources |
| def demoWeight = deployChild ? 2 : 1 // management = 1, child += 1 |
| if (runUie2e || runUie2eNew) { |
| demoWeight += 1 |
| } |
| |
| if (commitMsg ==~ /(?s).*\[bootstrapv1-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv1-scenario\.*/) { |
| bootstrapV2Scenario = false |
| } |
| |
| if (commitMsg ==~ /(?s).*\[bootstrapv2-scenario\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*bootstrapv2-scenario\.*/) { |
| bootstrapV2Scenario = true |
| } |
| |
| if (commitMsg ==~ /(?s).*\[enable-fips\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*enable-fips\.*/) { |
| enableFips = true |
| } |
| |
| if (commitMsg ==~ /(?s).*\[enable-mke-debug\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*enable-mke-debug\.*/) { |
| enableMkeDebug = true |
| } |
| |
| if (commitMsg ==~ /(?s).*\[vsphere-vvmt-obj\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*vsphere-vvmt-obj\.*/) { |
| useVsphereVvmtObjects = true |
| } |
| |
| // parse equinixmetalv2-metro trigger |
| def equinixMetalV2MetroMatcher = (commitMsg =~ /\[equinixmetalv2-metro(\s+.*)?\]/) |
| if (equinixMetalV2OnDemandDemo && equinixMetalV2MetroMatcher.size() > 0) { |
| equinixMetalV2Metro = equinixMetalV2MetroMatcher[0][1].trim().toLowerCase() |
| common.infoMsg("Forced Equnix mgmt deployment using custom metro ${equinixMetalV2Metro}") |
| } |
| |
| common.infoMsg(""" |
| OpenStack Cloud location: ${openstackIMC} |
| CDN deployment configuration: ${cdnConfig} |
| MCC offline deployment configuration: ${proxyConfig} |
| Use MacOS node as seed: ${seedMacOs} |
| Child cluster deployment scheduled: ${deployChild} |
| Custom child cluster release: ${customChildRelease} |
| Child cluster release upgrade scheduled: ${upgradeChild} |
| Full Child cluster release upgrade scheduled: ${fullUpgradeChild} |
| MOS child deploy scheduled: ${mosDeployChild} |
| MOS child upgrade scheduled: ${mosUpgradeChild} |
| Child conformance testing scheduled: ${runChildConformance} |
| Child conformance network policy testing scheduled: ${runChildConformanceNetworkPolicy} |
| Child HPA testing scheduled: ${runChildHPA} |
| Child Stacklight HA: ${runChildStacklightHa} |
| Single BYO cluster attachment scheduled: ${attachBYO} |
| Single Attached BYO cluster upgrade test scheduled: ${upgradeBYO} |
| BYO test matrix whole suite scheduled: ${runBYOMatrix} |
| Default BYO OS: ${defaultBYOOs} |
| Mgmt cluster release upgrade scheduled: ${upgradeMgmt} |
| Mgmt cluster release auto upgrade scheduled: ${autoUpgradeMgmt} |
| Mgmt LMA logging enabled: ${enableLMALogging} |
| Deploy Os on child with mos release ${deployOsOnMos} |
| Mgmt conformance testing scheduled: ${runMgmtConformance} |
| Mgmt conformance network policy testing scheduled: ${runMgmtConformanceNetworkPolicy} |
| LMA testing scheduled: ${runLMATest} |
| Mgmt user controller testing scheduled: ${runMgmtUserControllerTest} |
| Mgmt UI e2e testing scheduled: ${runUie2e} |
| Mgmt UI e2e playwrite testing scheduled: ${runUie2eNew} |
| Maintenance test: ${runMaintenanceTest} |
| Container Registry test: ${runContainerregistryTest} |
| Child proxy test: ${runProxyChildTest} |
| Graceful reboot test: ${runGracefulRebootTest} |
| Delete mgmt master node test: ${runMgmtDeleteMasterTest} |
| Delete rgnl master node test: ${runRgnlDeleteMasterTest} |
| Delete child master node test: ${runChildDeleteMasterTest} |
| Child machine deletion policy test: ${runChildMachineDeletionPolicyTest} |
| Custom cert test for child clusters: ${runChildCustomCertTest} |
| Custom cert test for Byo child clusters: ${runByoChildCustomCertTest} |
| Custom cache cert test for mgmt and child clusters: ${runMgmtCustomCacheCertTest} |
| MKE custom cert test for mgmt/region: ${runMkeCustomCertTest} |
| Custom hostnames for all clisuers: ${runCustomHostnames} |
| Stacklight templates enchanced with latest version from artifact-metadata: ${slLatest} |
| Disable Kubernetes API audit: ${disableKubeApiAudit} |
| Enable Auditd : ${auditd} |
| AWS provider deployment scheduled: ${awsOnDemandDemo} |
| Equinix provider deployment scheduled: ${equinixOnDemandDemo} |
| EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo} |
| EquinixmetalV2 child deploy in a separate metro scheduled: ${equinixMetalV2ChildDiffMetro} |
| EquinixmetalV2 mgmt will be deployed on the metro: ${equinixMetalV2Metro?:'auto'} |
| Equinix@AWS child cluster deployment scheduled: ${equinixOnAwsDemo} |
| Azure provider deployment scheduled: ${azureOnDemandDemo} |
| Azure@AWS child cluster deployment scheduled: ${azureOnAwsDemo} |
| VSPHERE provider deployment scheduled: ${enableVsphereDemo} |
| OS provider deployment scheduled: ${enableOSDemo} |
| BM Core provider deployment scheduled: ${enablebmCoreDemo} |
| BM Core type deplyment: ${bmDeployType} |
| BM Core cleanup: ${bmCoreCleanup} |
| BM provider deployment scheduled: ${enableBMDemo} |
| Ubuntu on vSphere scheduled: ${enableVsphereUbuntu} |
| RHEL on vSphere scheduled: ${enableVsphereRHEL} |
| Artifacts build scheduled: ${enableArtifactsBuild} |
| Boot OS child from Ceph volumes: ${childOsBootFromVolume} |
| Multiregional configuration: ${multiregionalMappings} |
| Service binaries fetching scheduled: ${fetchServiceBinaries} |
| Current weight of the demo run: ${demoWeight} (Used to manage lockable resources) |
| Bootstrap v2 scenario enabled: ${bootstrapV2Scenario} |
| FIPS enabled: ${enableFips} |
| MKE DEBUG enabled: ${enableMkeDebug} |
| Pause for debug enabled: ${pauseForDebug} |
| AIO cluster: ${aioCluster} |
| Docker services check skip: ${dockerServicesCheckSkip} |
| Use Vsphere VVMT Objects: ${useVsphereVvmtObjects} |
| Bootsrap v2 smoke checks enabled: ${enableBv2Smoke} |
| Run Cache warmup for child clusters: ${runCacheWarmup} |
| CVE Scan enabled: ${cveScan} |
| Keycloak+LDAP integration enabled: ${coreKeycloakLdap} |
| NTP update job scheduled: ${runNTPUpdateTest} |
| MCC MariaDB Backup/Restore test enabled: ${runMCCMariaBackupRestoreTest} |
| Sync to public-ci CDN enabled: ${publicCISync} |
| Mgmt runtime migration (extended) enabled: ${runRuntimeMigrateExtendedTestMgmt} |
| Mgmt runtime migration (quick) enabled: ${runRuntimeMigrateQuickTestMgmt} |
| Mgmt runtime migration (extended) with rollback enabled: ${runRuntimeMigrateAndRollbackTestMgmt} |
| Child runtime migration (extended) enabled: ${runRuntimeMigrateExtendedTestChild} |
| Child runtime migration (quick) enabled: ${runRuntimeMigrateQuickTestChild} |
| Child runtime migration (extended) with rollback enabled: ${runRuntimeMigrateAndRollbackTestChild} |
| Child Upgrade via update plan with sequental steps enabled: ${upgradeChildPlanSeq} |
| Child Upgrade via update plan with bulk steps enabled: ${upgradeChildPlanBulk} |
| Triggers: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""") |
| return [ |
| osCloudLocation : openstackIMC, |
| cdnConfig : cdnConfig, |
| proxyConfig : proxyConfig, |
| useMacOsSeedNode : seedMacOs, |
| deployChildEnabled : deployChild, |
| childDeployCustomRelease : customChildRelease, |
| upgradeChildEnabled : upgradeChild, |
| fullUpgradeChildEnabled : fullUpgradeChild, |
| mosDeployChildEnabled : mosDeployChild, |
| mosUpgradeChildEnabled : mosUpgradeChild, |
| runChildConformanceEnabled : runChildConformance, |
| runChildConformanceNetworkPolicyEnabled : runChildConformanceNetworkPolicy, |
| runChildHPAEnabled : runChildHPA, |
| runChildStacklightHaEnabled : runChildStacklightHa, |
| attachBYOEnabled : attachBYO, |
| upgradeBYOEnabled : upgradeBYO, |
| runBYOMatrixEnabled : runBYOMatrix, |
| defaultBYOOs : defaultBYOOs, |
| upgradeMgmtEnabled : upgradeMgmt, |
| autoUpgradeMgmtEnabled : autoUpgradeMgmt, |
| enableLMALoggingEnabled : enableLMALogging, |
| deployOsOnMosEnabled : deployOsOnMos, |
| runUie2eEnabled : runUie2e, |
| runUie2eNewEnabled : runUie2eNew, |
| runMgmtConformanceEnabled : runMgmtConformance, |
| runMgmtConformanceNetworkPolicyEnabled : runMgmtConformanceNetworkPolicy, |
| runMaintenanceTestEnabled : runMaintenanceTest, |
| runContainerregistryTestEnabled : runContainerregistryTest, |
| runGracefulRebootTestEnabled : runGracefulRebootTest, |
| pauseForDebugEnabled : pauseForDebug, |
| runMgmtDeleteMasterTestEnabled : runMgmtDeleteMasterTest, |
| runRgnlDeleteMasterTestEnabled : runRgnlDeleteMasterTest, |
| runChildDeleteMasterTestEnabled : runChildDeleteMasterTest, |
| runChildCustomCertTestEnabled : runChildCustomCertTest, |
| customSlackChannelEnabled : customSlackChannel, |
| runMgmtCustomCacheCertTestEnabled : runMgmtCustomCacheCertTest, |
| runMkeCustomCertTestEnabled : runMkeCustomCertTest, |
| runCustomHostnamesEnabled : runCustomHostnames, |
| slLatestEnabled : slLatest, |
| runByoChildCustomCertTestEnabled : runByoChildCustomCertTest, |
| runChildMachineDeletionPolicyTestEnabled : runChildMachineDeletionPolicyTest, |
| runLMATestEnabled : runLMATest, |
| runMgmtUserControllerTestEnabled : runMgmtUserControllerTest, |
| runProxyChildTestEnabled : runProxyChildTest, |
| fetchServiceBinariesEnabled : fetchServiceBinaries, |
| awsOnDemandDemoEnabled : awsOnDemandDemo, |
| equinixOnDemandDemoEnabled : equinixOnDemandDemo, |
| equinixMetalV2OnDemandDemoEnabled : equinixMetalV2OnDemandDemo, |
| equinixMetalV2ChildDiffMetroEnabled : equinixMetalV2ChildDiffMetro, |
| equinixOnAwsDemoEnabled : equinixOnAwsDemo, |
| azureOnDemandDemoEnabled : azureOnDemandDemo, |
| azureOnAwsDemoEnabled : azureOnAwsDemo, |
| vsphereDemoEnabled : enableVsphereDemo, |
| bmDemoEnabled : enableBMDemo, |
| bmCoreDemoEnabled : enablebmCoreDemo, |
| bmCoreCleanup : bmCoreCleanup, |
| bmDeployType : bmDeployType, |
| osDemoEnabled : enableOSDemo, |
| vsphereUbuntuEnabled : enableVsphereUbuntu, |
| vsphereRHELEnabled : enableVsphereRHEL, |
| artifactsBuildEnabled : enableArtifactsBuild, |
| childOsBootFromVolume : childOsBootFromVolume, |
| multiregionalConfiguration : multiregionalMappings, |
| demoWeight : demoWeight, |
| bootstrapV2Scenario : bootstrapV2Scenario, |
| equinixMetalV2Metro : equinixMetalV2Metro, |
| enableFips : enableFips, |
| enableMkeDebugEnabled : enableMkeDebug, |
| aioCluster : aioCluster, |
| dockerServicesCheckSkip : dockerServicesCheckSkip, |
| useVsphereVvmtObjects : useVsphereVvmtObjects, |
| bv2SmokeEnabled : enableBv2Smoke, |
| runCacheWarmup : runCacheWarmup, |
| cveScanEnabled : cveScan, |
| disableKubeApiAudit : disableKubeApiAudit, |
| auditdEnabled : auditd, |
| coreKeycloakLdapEnabled : coreKeycloakLdap, |
| internalNTPServersEnabled : configureInternalNTP, |
| runNTPUpdateTestEnabled : runNTPUpdateTest, |
| runMCCMariaBackupRestoreTestEnabled : runMCCMariaBackupRestoreTest, |
| publicCISyncEnabled : publicCISync, |
| runtimeMigrateExtendedMgmtEnabled : runRuntimeMigrateExtendedTestMgmt, |
| runtimeMigrateQuickMgmtEnabled : runRuntimeMigrateQuickTestMgmt, |
| runtimeMigrateMgmtAndRollbackEnabled : runRuntimeMigrateAndRollbackTestMgmt, |
| runtimeMigrateExtendedChildEnabled : runRuntimeMigrateExtendedTestChild, |
| runtimeMigrateQuickChildEnabled : runRuntimeMigrateQuickTestChild, |
| runtimeMigrateChildAndRollbackEnabled : runRuntimeMigrateAndRollbackTestChild, |
| upgradeChildPlanSeqEnabled : upgradeChildPlanSeq, |
| upgradeChildPlanBulkEnabled : upgradeChildPlanBulk, |
| ] |
| } |
| |
| /** |
| * Determine management and regional setup for demo workflow scenario |
| * |
| * |
| * @param: keyword (string) string , represents keyword trigger, specified in gerrit commit body, like `[multiregion aws,os]` |
| or Jenkins environment string variable in form like 'aws,os' |
| * @return (map)[ |
| enabled: (bool), |
| * managementLocation: (string), //aws,os |
| * regionLocation: (string), //aws,os |
| * ] |
| */ |
| def multiregionWorkflowParser(keyword) { |
| def common = new com.mirantis.mk.Common() |
| def supportedManagementProviders = ['os', 'aws', 'vsphere', 'equinix', 'equinixmetalv2', 'azure'] |
| def supportedRegionalProviders = ['os', 'vsphere', 'equinix', 'equinixmetalv2', 'bm', 'azure', 'aws'] |
| |
| def clusterTypes = '' |
| if (keyword.toString().contains('multiregion')) { |
| common.infoMsg('Multiregion definition configured via gerrit keyword trigger') |
| clusterTypes = keyword[0][0].split('multiregion')[1].replaceAll('[\\[\\]]', '').trim().split(',') |
| } else { |
| common.infoMsg('Multiregion definition configured via environment variable') |
| clusterTypes = keyword.trim().split(',') |
| } |
| |
| if (clusterTypes.size() != 2) { |
| error("Incorrect regions definiton, valid scheme: [multiregion ${management}, ${region}], got: ${clusterTypes}") |
| } |
| |
| def desiredManagementProvider = clusterTypes[0].trim() |
| def desiredRegionalProvider = clusterTypes[1].trim() |
| if (! supportedManagementProviders.contains(desiredManagementProvider) || ! supportedRegionalProviders.contains(desiredRegionalProvider)) { |
| error("""unsupported management <-> regional bundle, available options: |
| management providers list - ${supportedManagementProviders} |
| regional providers list - ${supportedRegionalProviders}""") |
| } |
| |
| return [ |
| enabled: true, |
| managementLocation: desiredManagementProvider, |
| regionLocation: desiredRegionalProvider, |
| ] |
| } |
| |
| /** |
| * Determine if custom si tests/pipelines refspec forwarded from gerrit change request |
| |
| * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
| * Used for components team to test component changes w/ custom SI refspecs using kaas/core deployment jobs |
| * Example scheme: |
| * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| * manage refspecs through Jenkins Job Parameters |
| * |
| * @return (map)[* siTests: (string) final refspec for si-tests |
| * siPipelines: (string) final refspec for si-pipelines |
| * ] |
| */ |
| def checkCustomSIRefspec() { |
| def common = new com.mirantis.mk.Common() |
| |
| // Available triggers and its sane defaults |
| def siTestsRefspec = env.SI_TESTS_REFSPEC ?: 'master' |
| def siPipelinesRefspec = env.SI_PIPELINES_REFSPEC ?: 'master' |
| def siTestsDockerImage = env.SI_TESTS_DOCKER_IMAGE ?: 'docker-dev-kaas-local.docker.mirantis.net/mirantis/kaas/si-test' |
| def siTestsDockerImageTag = env.SI_TESTS_DOCKER_IMAGE_TAG ?: 'master' |
| def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| |
| def siTestMatches = (commitMsg =~ /(\[si-tests-ref\s*refs\/changes\/.*?\])/) |
| def siPipelinesMatches = (commitMsg =~ /(\[si-pipelines-ref\s*refs\/changes\/.*?\])/) |
| |
| if (siTestMatches.size() > 0) { |
| siTestsRefspec = siTestMatches[0][0].split('si-tests-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| siTestsDockerImage = "docker-review-local.docker.mirantis.net/review/kaas-si-test-${siTestsRefspec.split('/')[-2]}" |
| siTestsDockerImageTag = siTestsRefspec.split('/')[-1] |
| } |
| if (siPipelinesMatches.size() > 0) { |
| siPipelinesRefspec = siPipelinesMatches[0][0].split('si-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| } |
| |
| common.infoMsg(""" |
| kaas/si-pipelines will be fetched from: ${siPipelinesRefspec} |
| kaas/si-tests will be fetched from: ${siTestsRefspec} |
| kaas/si-tests as dockerImage will be fetched from: ${siTestsDockerImage}:${siTestsDockerImageTag} |
| Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""") |
| return [siTests: siTestsRefspec, siPipelines: siPipelinesRefspec, siTestsDockerImage: siTestsDockerImage, siTestsDockerImageTag: siTestsDockerImageTag] |
| } |
| |
| /** |
| * Parse additional configuration for kaas component CICD repo |
| * @param configurationFile (str) path to configuration file in yaml format |
| * |
| * @return (map)[ siTestsFeatureFlags (string) dedicated feature flags that will be used in SI tests, |
| * siTestsFeatureFlagsStable (string) dedicated feature flags that will be used in SI tests for deploying stable release |
| * ] |
| */ |
| def parseKaaSComponentCIParameters(configurationFile){ |
| def common = new com.mirantis.mk.Common() |
| def ciConfig = readYaml file: configurationFile |
| def ciSpec = [ |
| siTestsFeatureFlags: env.SI_TESTS_FEATURE_FLAGS ?: '', |
| siTestsFeatureFlagsStable: env.SI_TESTS_FEATURE_FLAGS_STABLE ?: '', |
| ] |
| |
| // If exists and not empty |
| if (ciConfig.getOrDefault('si-tests-feature-flags', [])) { |
| common.infoMsg("""SI tests feature flags customization detected, |
| results will be merged with existing flags: [${ciSpec['siTestsFeatureFlags']}] identification...""") |
| |
| def ffMeta = ciSpec['siTestsFeatureFlags'].tokenize(',').collect { it.trim() } |
| ffMeta.addAll(ciConfig['si-tests-feature-flags']) |
| |
| ciSpec['siTestsFeatureFlags'] = ffMeta.unique().join(',') |
| common.infoMsg("SI tests custom feature flags: ${ciSpec['siTestsFeatureFlags']}") |
| } |
| if (ciConfig.getOrDefault('si-tests-feature-flags-stable', [])) { |
| common.infoMsg("""SI tests feature flags for stable release customization detected, |
| results will be merged with existing flags: [${ciSpec['siTestsFeatureFlagsStable']}] identification...""") |
| |
| def ffMeta = ciSpec['siTestsFeatureFlagsStable'].tokenize(',').collect { it.trim() } |
| ffMeta.addAll(ciConfig['si-tests-feature-flags-stable']) |
| |
| ciSpec['siTestsFeatureFlagsStable'] = ffMeta.unique().join(',') |
| common.infoMsg("SI tests custom feature flags for stable release: ${ciSpec['siTestsFeatureFlagsStable']}") |
| } |
| |
| common.infoMsg("""Additional ci configuration parsed successfully: |
| siTestsFeatureFlags: ${ciSpec['siTestsFeatureFlags']} |
| siTestsFeatureFlagsStable: ${ciSpec['siTestsFeatureFlagsStable']}""") |
| return ciSpec |
| } |
| |
| /** |
| * Determine if custom kaas core/pipelines refspec forwarded from gerrit change request |
| |
| * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
| * Used for components team to test component changes w/ custom Core refspecs using kaas/core deployment jobs |
| * Example scheme: |
| * New CR pushed in kubernetes/lcm-ansible -> parsing it's commit body and get custom test refspecs -> trigger deployment jobs from kaas/core |
| * manage refspecs through Jenkins Job Parameters |
| * |
| * @return (map)[ core: (string) final refspec for kaas/core |
| * corePipelines: (string) final refspec for pipelines in kaas/core |
| * ] |
| */ |
| def checkCustomCoreRefspec() { |
| def common = new com.mirantis.mk.Common() |
| |
| // Available triggers and its sane defaults |
| def coreRefspec = env.KAAS_CORE_REFSPEC ?: 'master' |
| // by default using value of GERRIT_REFSPEC parameter in *kaas/core jobs* |
| def corePipelinesRefspec = env.KAAS_PIPELINE_REFSPEC ?: '\$GERRIT_REFSPEC' |
| def commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| |
| def coreMatches = (commitMsg =~ /(\[core-ref\s*refs\/changes\/.*?\])/) |
| def corePipelinesMatches = (commitMsg =~ /(\[core-pipelines-ref\s*refs\/changes\/.*?\])/) |
| |
| if (coreMatches.size() > 0) { |
| coreRefspec = coreMatches[0][0].split('core-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| } |
| if (corePipelinesMatches.size() > 0) { |
| corePipelinesRefspec = corePipelinesMatches[0][0].split('core-pipelines-ref')[1].replaceAll('[\\[\\]]', '').trim() |
| } |
| |
| common.infoMsg(""" |
| kaas/core will be fetched from: ${coreRefspec} |
| kaas/core pipelines will be fetched from: ${corePipelinesRefspec} |
| Keywords: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""") |
| return [core: coreRefspec, corePipelines: corePipelinesRefspec] |
| } |
| |
| |
| /** |
| * generate Jenkins Parameter objects from from text parameter with additonal kaas core context |
| * needed to forward inside kaas core set of jobs |
| * |
| * @param context (string) Representation of the string enviroment variables needed for kaas core jobs in yaml format |
| * @return (list)[ string(name: '', value: ''), |
| * ] |
| */ |
| def generateKaaSVarsFromContext(context) { |
| def common = new com.mirantis.mk.Common() |
| def parameters = [] |
| def config = readYaml text: context |
| |
| config.each { k,v -> |
| common.infoMsg("Custom KaaS Core context parameter: ${k}=${v}") |
| parameters.add(string(name: k, value: v)) |
| } |
| |
| return parameters |
| } |
| |
| /** |
| * Trigger KaaS demo jobs based on AWS/OS providers with customized test suite, parsed from external sources (gerrit commit/jj vars) |
| * Keyword list: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md |
| * Used for components team to test component changes w/ customized SI tests/refspecs using kaas/core deployment jobs |
| * |
| * @param: component (string) component name [iam, lcm, stacklight] |
| * @param: patchSpec (string) Patch for kaas/cluster releases in json format |
| * @param: configurationFile (string) Additional file for component repo CI config in yaml format |
| */ |
| def triggerPatchedComponentDemo(component, patchSpec = '', configurationFile = '.ci-parameters.yaml', coreContext = '') { |
| def common = new com.mirantis.mk.Common() |
| // Determine if custom trigger keywords forwarded from gerrit |
| def triggers = checkDeploymentTestSuite() |
| // Determine SI refspecs |
| def siRefspec = checkCustomSIRefspec() |
| // Determine Core refspecs |
| def coreRefspec = checkCustomCoreRefspec() |
| |
| // Determine component repo ci configuration |
| def ciSpec = [:] |
| def componentFeatureFlags = env.SI_TESTS_FEATURE_FLAGS ?: '' |
| if (fileExists(configurationFile)) { |
| common.infoMsg('Component CI configuration file detected, parsing...') |
| ciSpec = parseKaaSComponentCIParameters(configurationFile) |
| componentFeatureFlags = ciSpec['siTestsFeatureFlags'] |
| } else { |
| common.warningMsg('''Component CI configuration file is not exists, |
| several code-management features may be unavailable, |
| follow https://mirantis.jira.com/wiki/spaces/QA/pages/2310832276/SI-tests+feature+flags#%5BUpdated%5D-Using-a-feature-flag |
| to create the configuration file''') |
| } |
| |
| def platforms = [] |
| if (component == 'ipam' && triggers.vsphereDemoEnabled) { |
| // Currently only vsphere demo is required for IPAM component |
| platforms.add('vsphere') |
| } else { |
| if (triggers.osDemoEnabled) { |
| platforms.add('openstack') |
| } |
| if (triggers.awsOnDemandDemoEnabled) { |
| platforms.add('aws') |
| } |
| if (triggers.equinixOnDemandDemoEnabled) { |
| platforms.add('equinix') |
| } |
| if (triggers.equinixMetalV2OnDemandDemoEnabled) { |
| platforms.add('equinixmetalv2') |
| } |
| if (triggers.azureOnDemandDemoEnabled) { |
| platforms.add('azure') |
| } |
| if (triggers.vsphereDemoEnabled) { |
| platforms.add('vsphere') |
| } |
| if (triggers.bmCoreDemoEnabled) { |
| platforms.add('bm') |
| } |
| } |
| |
| def jobs = [:] |
| def parameters = [ |
| string(name: 'GERRIT_REFSPEC', value: coreRefspec.core), |
| string(name: 'KAAS_PIPELINE_REFSPEC', value: coreRefspec.corePipelines), |
| string(name: 'SI_TESTS_REFSPEC', value: siRefspec.siTests), |
| string(name: 'SI_TESTS_FEATURE_FLAGS', value: componentFeatureFlags), |
| string(name: 'SI_TESTS_DOCKER_IMAGE', value: siRefspec.siTestsDockerImage), |
| string(name: 'SI_TESTS_DOCKER_IMAGE_TAG', value: siRefspec.siTestsDockerImageTag), |
| string(name: 'SI_PIPELINES_REFSPEC', value: siRefspec.siPipelines), |
| string(name: 'CUSTOM_RELEASE_PATCH_SPEC', value: patchSpec), |
| string(name: 'KAAS_CHILD_CLUSTER_RELEASE_NAME', value: triggers.childDeployCustomRelease), |
| string(name: 'OPENSTACK_CLOUD_LOCATION', value: triggers.osCloudLocation), |
| string(name: 'SLACK_CHANNEL_NOTIFY', value: triggers.customSlackChannelEnabled), |
| string(name: 'BM_DEPLOY_TYPE', value: triggers.bmDeployType), |
| booleanParam(name: 'OFFLINE_MGMT_CLUSTER', value: triggers.proxyConfig['mgmtOffline']), |
| booleanParam(name: 'OFFLINE_CHILD_CLUSTER', value: triggers.proxyConfig['childOffline']), |
| booleanParam(name: 'PROXY_CHILD_CLUSTER', value: triggers.proxyConfig['childProxy']), |
| booleanParam(name: 'SEED_MACOS', value: triggers.useMacOsSeedNode), |
| booleanParam(name: 'UPGRADE_MGMT_CLUSTER', value: triggers.upgradeMgmtEnabled), |
| booleanParam(name: 'AUTO_UPGRADE_MCC', value: triggers.autoUpgradeMgmtEnabled), |
| booleanParam(name: 'ENABLE_LMA_LOGGING', value: triggers.enableLMALoggingEnabled), |
| booleanParam(name: 'DEPLOY_MOS_CHILD_CLUSTER', value: triggers.mosDeployChildEnabled), |
| booleanParam(name: 'DEPLOY_OS_ON_MOS', value: triggers.deployOsOnMosEnabled), |
| booleanParam(name: 'RUN_UI_E2E', value: triggers.runUie2eEnabled), |
| booleanParam(name: 'RUN_MGMT_CFM', value: triggers.runMgmtConformanceEnabled), |
| booleanParam(name: 'RUN_MGMT_CFM_NETWORK_POLICY', value: triggers.runMgmtConformanceNetworkPolicyEnabled), |
| booleanParam(name: 'RUN_MAINTENANCE_TEST', value: triggers.runMaintenanceTestEnabled), |
| booleanParam(name: 'RUN_CONTAINER_REGISTRY_TEST', value: triggers.runContainerregistryTestEnabled), |
| booleanParam(name: 'RUN_GRACEFUL_REBOOT_TEST', value: triggers.runGracefulRebootTestEnabled), |
| booleanParam(name: 'RUN_MGMT_DELETE_MASTER_TEST', value: triggers.runMgmtDeleteMasterTestEnabled), |
| booleanParam(name: 'RUN_RGNL_DELETE_MASTER_TEST', value: triggers.runRgnlDeleteMasterTestEnabled), |
| booleanParam(name: 'RUN_CHILD_DELETE_MASTER_TEST', value: triggers.runChildDeleteMasterTestEnabled), |
| booleanParam(name: 'RUN_CHILD_CUSTOM_CERT_TEST', value: triggers.runChildCustomCertTestEnabled), |
| booleanParam(name: 'RUN_MGMT_CUSTOM_CACHE_CERT_TEST', value: triggers.runMgmtCustomCacheCertTestEnabled), |
| booleanParam(name: 'RUN_MKE_CUSTOM_CERT_TEST', value: triggers.runMkeCustomCertTestEnabled), |
| booleanParam(name: 'RUN_CUSTOM_HOSTNAMES', value: triggers.runCustomHostnamesEnabled), |
| booleanParam(name: 'SL_LATEST', value: triggers.slLatestEnabled), |
| booleanParam(name: 'RUN_BYO_CHILD_CUSTOM_CERT_TEST', value: triggers.runByoChildCustomCertTestEnabled), |
| booleanParam(name: 'RUN_CHILD_MACHINE_DELETION_POLICY_TEST', value: triggers.runChildMachineDeletionPolicyTestEnabled), |
| booleanParam(name: 'RUN_LMA_TEST', value: triggers.runLMATestEnabled), |
| booleanParam(name: 'RUN_MGMT_USER_CONTROLLER_TEST', value: triggers.runMgmtUserControllerTestEnabled), |
| booleanParam(name: 'DEPLOY_CHILD_CLUSTER', value: triggers.deployChildEnabled), |
| booleanParam(name: 'UPGRADE_CHILD_CLUSTER', value: triggers.upgradeChildEnabled), |
| booleanParam(name: 'FULL_UPGRADE_CHILD_CLUSTER', value: triggers.fullUpgradeChildEnabled), |
| booleanParam(name: 'RUN_PROXY_CHILD_TEST', value: triggers.runProxyChildTestEnabled), |
| booleanParam(name: 'ATTACH_BYO', value: triggers.attachBYOEnabled), |
| booleanParam(name: 'UPGRADE_BYO', value: triggers.upgradeBYOEnabled), |
| booleanParam(name: 'RUN_BYO_MATRIX', value: triggers.runBYOMatrixEnabled), |
| booleanParam(name: 'RUN_CHILD_CFM', value: triggers.runChildConformanceEnabled), |
| booleanParam(name: 'RUN_CHILD_CFM_NETPOLICY', value: triggers.runChildConformanceNetworkPolicyEnabled), |
| booleanParam(name: 'RUN_CHILD_HPA', value: triggers.runChildHPAEnabled), |
| booleanParam(name: 'RUN_STACKLIGHT_CHILD_HA', value: triggers.runChildStacklightHaEnabled), |
| booleanParam(name: 'ALLOW_AWS_ON_DEMAND', value: triggers.awsOnDemandDemoEnabled), |
| booleanParam(name: 'ALLOW_EQUINIX_ON_DEMAND', value: triggers.equinixOnDemandDemoEnabled), |
| booleanParam(name: 'ALLOW_EQUINIXMETALV2_ON_DEMAND', value: triggers.equinixMetalV2OnDemandDemoEnabled), |
| booleanParam(name: 'EQUINIXMETALV2_CHILD_DIFF_METRO', value: triggers.equinixMetalV2ChildDiffMetroEnabled), |
| booleanParam(name: 'EQUINIX_ON_AWS_DEMO', value: triggers.equinixOnAwsDemoEnabled), |
| booleanParam(name: 'ALLOW_AZURE_ON_DEMAND', value: triggers.azureOnDemandDemoEnabled), |
| booleanParam(name: 'AZURE_ON_AWS_DEMO', value: triggers.azureOnAwsDemoEnabled), |
| booleanParam(name: 'ALLOW_BM_CORE_ON_DEMAND', value: triggers.bmCoreDemoEnabled), |
| booleanParam(name: 'VSPHERE_DEPLOY_UBUNTU', value: triggers.vsphereUbuntuEnabled), |
| booleanParam(name: 'PAUSE_FOR_DEBUG', value: triggers.pauseForDebugEnabled), |
| booleanParam(name: 'ENABLE_FIPS', value: triggers.enableFips), |
| booleanParam(name: 'ENABLE_MKE_DUBUG', value: triggers.enableMkeDebugEnabled), |
| booleanParam(name: 'AIO_CLUSTER', value: triggers.aioCluster), |
| booleanParam(name: 'DOCKER_SERVICES_CHECK_SKIP', value: triggers.dockerServicesCheckSkip), |
| booleanParam(name: 'BM_CORE_CLEANUP', value: triggers.bmCoreCleanup), |
| booleanParam(name: 'DISABLE_KUBE_API_AUDIT', value: triggers.disableKubeApiAudit), |
| booleanParam(name: "AUDITD_ENABLE", value: triggers.auditdEnabled), |
| booleanParam(name: 'CORE_KEYCLOAK_LDAP_ENABLED', value: triggers.coreKeycloakLdapEnabled), |
| booleanParam(name: 'CORE_KAAS_NTP_ENABLED', value: triggers.internalNTPServersEnabled), |
| booleanParam(name: 'RUN_NTP_UPDATE_TEST', value: triggers.runNTPUpdateTestEnabled), |
| booleanParam(name: 'RUN_MCC_MARIA_BACKUP_RESTORE_TEST', value: triggers.runMCCMariaBackupRestoreTestEnabled), |
| booleanParam(name: 'RUN_MGMT_RUNTIME_MIGRATE_EXTENDED_TEST', value: triggers.runtimeMigrateExtendedMgmtEnabled), |
| booleanParam(name: 'RUN_MGMT_RUNTIME_MIGRATE_QUICK_TEST', value: triggers.runtimeMigrateQuickMgmtEnabled), |
| booleanParam(name: 'RUN_MGMT_RUNTIME_MIGRATE_AND_ROLLBACK_TEST', value: triggers.runtimeMigrateMgmtAndRollbackEnabled), |
| booleanParam(name: 'RUN_CHILD_RUNTIME_MIGRATE_EXTENDED_TEST', value: triggers.runtimeMigrateExtendedChildEnabled), |
| booleanParam(name: 'RUN_CHILD_RUNTIME_MIGRATE_QUICK_TEST', value: triggers.runtimeMigrateQuickChildEnabled), |
| booleanParam(name: 'RUN_CHILD_RUNTIME_MIGRATE_AND_ROLLBACK_TEST', value: triggers.runtimeMigrateChildAndRollbackEnabled), |
| booleanParam(name: 'UPGRADE_CHILD_PLAN_SEQ', value: triggers.upgradeChildPlanSeqEnabled), |
| booleanParam(name: 'UPGRADE_CHILD_PLAN_BULK', value: triggers.upgradeChildPlanBulkEnabled), |
| ] |
| |
| // customize multiregional demo |
| if (triggers.multiregionalConfiguration.enabled) { |
| parameters.add(string(name: 'MULTIREGION_SETUP', |
| value: "${triggers.multiregionalConfiguration.managementLocation},${triggers.multiregionalConfiguration.regionLocation}" |
| )) |
| } |
| |
| // Determine component team custom context |
| if (coreContext != '') { |
| common.infoMsg('Additional KaaS Core context detected, will be forwarded into kaas core cicd...') |
| def additionalParameters = generateKaaSVarsFromContext(coreContext) |
| parameters.addAll(additionalParameters) |
| } |
| |
| def jobResults = [] |
| |
| platforms.each { platform -> |
| jobs["kaas-core-${platform}-patched-${component}"] = { |
| try { |
| common.infoMsg("Deploy: patched KaaS demo with ${platform} provider") |
| def job_info = build job: "kaas-testing-core-${platform}-workflow-${component}", parameters: parameters, wait: true |
| def build_description = job_info.getDescription() |
| def build_result = job_info.getResult() |
| jobResults.add(build_result) |
| |
| if (build_description) { |
| currentBuild.description += build_description |
| } |
| } finally { |
| common.infoMsg("Patched KaaS demo with ${platform} provider finished") |
| } |
| } |
| } |
| |
| common.infoMsg('Trigger KaaS demo deployments according to defined provider set') |
| if (jobs.size() == 0) { |
| error('No demo jobs matched with keywords, execution will be aborted, at least 1 provider should be enabled') |
| } |
| // Limit build concurency workaround examples: https://issues.jenkins-ci.org/browse/JENKINS-44085 |
| parallel jobs |
| |
| if (jobResults.contains('FAILURE')) { |
| common.infoMsg('One of parallel downstream jobs is failed, mark executor job as failed') |
| currentBuild.result = 'FAILURE' |
| } |
| } |
| |
| |
| /** |
| * Function currently supported to be called from aws or vsphere demos. It gets particular demo context |
| * and generate proper lockResources data and netMap data for vsphere,equinix related clusters. |
| * |
| * @param: callBackDemo (string) Demo which requested to generate lockResources [aws or vsphere] |
| * @param: triggers (map) Custom trigger keywords forwarded from gerrit |
| * @param: multiregionalConfiguration (map) Multiregional configuration |
| * @return (map) Return aggregated map with lockResources and netMap |
| */ |
| |
| |
| def generateLockResources(callBackDemo, triggers) { |
| def common = new com.mirantis.mk.Common() |
| def netMap = [ |
| vsphere: [:], |
| equinix: [:], |
| ] |
| // Define vsphere locklabels with initial quantity |
| def lockLabels = [ |
| vsphere_networking_core_ci: 0, |
| vsphere_offline_networking_core_ci: 0, |
| ] |
| def deployChild = triggers.deployChildEnabled |
| def testUiVsphere = triggers.runUie2eEnabled || triggers.runUie2eNewEnabled |
| def vsphereByo = triggers.attachBYOEnabled |
| def multiregionConfig = triggers.multiregionalConfiguration |
| def runMultiregion = multiregionConfig.enabled |
| |
| // Generate vsphere netMap and lockLabels based on demo context |
| switch (callBackDemo) { |
| case 'aws': |
| // Add aws specific lock label with quantity calculated based on single mgmt deploy or mgmt + child |
| lockLabels['aws_core_ci_queue'] = triggers.demoWeight |
| if (triggers.runBYOMatrixEnabled) { lockLabels['aws_core_ci_queue'] += 6 } |
| |
| // Define netMap for Vsphere region |
| if (runMultiregion && multiregionConfig.managementLocation == 'aws') { |
| if (multiregionConfig.regionLocation == 'vsphere') { |
| if (deployChild) { |
| addToProviderNetMap(netMap, 'vsphere', 'regional-child') |
| } |
| addToProviderNetMap(netMap, 'vsphere', 'region') |
| } |
| |
| if (multiregionConfig.regionLocation == 'azure') { |
| lockLabels['azure_core_ci_queue'] = 1 |
| if (deployChild) { |
| lockLabels['azure_core_ci_queue'] += 1 |
| } |
| } |
| } |
| if (triggers.azureOnAwsDemoEnabled) { |
| lockLabels['azure_core_ci_queue'] = 1 |
| } |
| |
| if (triggers.equinixOnAwsDemoEnabled) { |
| lockLabels['equinix_core_ci_queue'] = 1 |
| } |
| break |
| case 'vsphere': |
| addToProviderNetMap(netMap, 'vsphere', 'mgmt') |
| if (deployChild || testUiVsphere || vsphereByo) { |
| addToProviderNetMap(netMap, 'vsphere', 'child') |
| } |
| if (runMultiregion && multiregionConfig.managementLocation == 'vsphere' && |
| multiregionConfig.regionLocation == 'vsphere') { |
| if (deployChild) { |
| addToProviderNetMap(netMap, 'vsphere', 'regional-child') |
| } |
| addToProviderNetMap(netMap, 'vsphere', 'region') |
| } |
| break |
| case 'azure': |
| lockLabels['azure_core_ci_queue'] = triggers.demoWeight |
| if (runMultiregion && multiregionConfig.managementLocation == 'azure') { |
| if (multiregionConfig.regionLocation == 'aws') { |
| lockLabels['aws_core_ci_queue'] = 1 |
| if (deployChild) { |
| lockLabels['aws_core_ci_queue'] += 1 |
| } |
| } |
| |
| if (multiregionConfig.regionLocation == 'equinix') { |
| lockLabels['equinix_core_ci_queue'] = 1 |
| if (deployChild) { |
| lockLabels['equinix_core_ci_queue'] +=1 |
| } |
| } |
| } |
| default: |
| error('Supposed to be called from aws, azure or vsphere demos only') |
| } |
| |
| // Checking gerrit triggers and manage lock label quantity and network types in case of Offline deployment |
| // Vsphere labels only |
| netMap['vsphere'].each { clusterType, netConfig -> |
| if (triggers.proxyConfig["${clusterType}Offline"] == true || |
| (clusterType == 'regional-child' && triggers.proxyConfig['childOffline'] == true) || |
| (clusterType == 'region' && triggers.proxyConfig['mgmtOffline'])) { |
| |
| netMap['vsphere'][clusterType]['netName'] = 'offline' |
| lockLabels['vsphere_offline_networking_core_ci']++ |
| } else { |
| lockLabels['vsphere_networking_core_ci']++ |
| } |
| } |
| |
| // generate lock metadata |
| def lockResources = [] |
| lockLabels.each { label, quantity -> |
| if (quantity > 0) { |
| def res = [ |
| label: label, |
| quantity: quantity, |
| ] |
| lockResources.add(res) |
| } |
| } |
| |
| common.infoMsg("""Generated vsphere netMap: ${netMap} |
| Generated lockResources: ${lockResources}""") |
| |
| return [ |
| netMap: netMap, |
| lockResources: lockResources, |
| ] |
| } |
| |
| /** |
| * Function gets vsphere netMap or empty map and adds new vsphere clusterType with default netName |
| * and empty rangeConfig to the this map. |
| * |
| * @param: netMap (string) vsphere, equinix netMap or empty map |
| * @param: provider (string) provider type |
| * @param: clusterType (string) Vsphere cluster type |
| */ |
| |
| def addToProviderNetMap (netMap, provider, clusterType) { |
| switch (provider) { |
| case 'equinix': |
| netMap[provider][clusterType] = [ |
| vlanConfig: '', |
| ] |
| break |
| case 'vsphere': |
| netMap[provider][clusterType] = [ |
| netName: 'default', |
| rangeConfig: '', |
| ] |
| break |
| default: |
| error('Net map locks supported for Equinix/Vsphere providers only') |
| } |
| } |
| |
| /** |
| * getCIKeywordsFromCommitMsg parses commit message and returns all gerrit keywords with their values as a list of maps. |
| * Each element (map) contains keys 'key' for keyword name and 'value' for its value. |
| * If keyword contains only 'key' part then 'value' is boolean True. |
| * This function does not perform keywords validation. |
| * First line of a commit message is ignored. |
| * To use '[' or ']' characters inside keyword prepend it with backslash '\'. |
| * TODO: Remove backslash chars from values if they prepend '[' or ']'. |
| **/ |
| |
| List getCIKeywordsFromCommitMsg() { |
| String commitMsg = env.GERRIT_CHANGE_COMMIT_MESSAGE ? new String(env.GERRIT_CHANGE_COMMIT_MESSAGE.decodeBase64()) : '' |
| List commitMsgLines = commitMsg.split('\n') |
| List keywords = [] |
| if (commitMsgLines.size() < 2) { |
| return keywords |
| } |
| |
| String commitMsgBody = commitMsgLines[1..-1].join('\n') |
| |
| // Split commit message body to chunks using '[' or ']' as delimiter, |
| // ignoring them if prepended by backslash (regex negative lookbehind). |
| // Resulting list will have chunks between '[' and ']' at odd indexes. |
| List parts = commitMsgBody.split(/(?<!\\)[\[\]]/) |
| |
| // Iterate chunks by odd indexes only, trim values and split to |
| // <key> / <value> pair where <key> is the part of a sting before the first |
| // whitespace delimiter, and <value> is the rest (may include whitespaces). |
| // If there is no whitespace in the string then this is a 'switch' |
| // and <value> will be boolean True. |
| for (i = 1; i < parts.size(); i += 2) { |
| def (key, value) = (parts[i].trim().split(/\s+/, 2) + [true, ])[0..1] |
| keywords.add(['key': key, 'value': value]) |
| } |
| |
| return keywords |
| } |
| |
| /** |
| * getJobsParamsFromCommitMsg parses list of CI keywords and returns values of 'job-params' keyword |
| * that were specified for given job name. `job-params` keyword has the following structure |
| * |
| * [job-params <job name> <parameter name> <parameter value>] |
| * |
| * Return value is a Map that contains those parameters using the following structure: |
| * |
| * <job name>: |
| * <parameter name>: <parameter value> |
| * |
| **/ |
| Map getJobsParamsFromCommitMsg() { |
| List keywords = getCIKeywordsFromCommitMsg() |
| |
| List jobsParamsList = [] |
| keywords.findAll{ it.key == 'job-params' }.collect(jobsParamsList) { |
| def (name, params) = (it['value'].split(/\s+/, 2) + [null, ])[0..1] |
| def (key, value) = params.split(/\s+/, 2) |
| ['name': name, 'key': key, 'value': value] |
| } |
| |
| Map jobsParams = jobsParamsList.inject([:]) { result, it -> |
| if (!result.containsKey(it.name)) { |
| result[it.name] = [:] |
| } |
| result[it.name][it.key] = it.value |
| result |
| } |
| |
| return jobsParams |
| } |
| |
| |
| /** |
| * getJobParamsFromCommitMsg returns key:value Map of parameters set for a job in commit message. |
| * It uses getJobsParamsFromCommitMsg to get all parameters from commit message and then |
| * uses only those parametes that were set to all jobs (with <job name> == '*') or to |
| * a particular job. Parameters set to a particular job have higher precedence. |
| * |
| * Return value is a Map that contains those parameters: |
| * |
| * <parameter name>: <parameter value> |
| * |
| **/ |
| Map getJobParamsFromCommitMsg(String jobName) { |
| jobsParams = getJobsParamsFromCommitMsg() |
| jobParams = jobsParams.getOrDefault('*', [:]) |
| if (jobName) { |
| jobParams.putAll(jobsParams.getOrDefault(jobName, [:])) |
| } |
| return jobParams |
| } |
| |
| /** Getting test scheme from text, which should be |
| Imput example: |
| text=""" |
| DATA |
| |
| kaas_bm_test_schemas: |
| KAAS_RELEASES_REFSPEC: '' |
| KEY: VAL |
| |
| DATA |
| """ |
| |
| Call: parseTextForTestSchemas(['text' : text,'keyLine' : 'kaas_bm_test_schemas']) |
| |
| Return: |
| ['KAAS_RELEASES_REFSPEC': '', 'KEY' : 'VAL'] |
| **/ |
| def parseTextForTestSchemas(Map opts) { |
| String text = opts.getOrDefault('text', '') |
| String keyLine = opts.getOrDefault('keyLine', '') |
| Map testScheme = [:] |
| if (!text || !keyLine) { |
| return testScheme |
| } |
| if (text =~ /\n$keyLine\n.*/) { |
| def common = new com.mirantis.mk.Common() |
| try { |
| String regExp = '\\n' + keyLine + '\\n' |
| // regexep block must be followed by empty line |
| testScheme = readYaml text: "${text.split(regExp)[1].split('\n\n')[0]}" |
| common.infoMsg("parseTextForTestSchemas result:\n" + testScheme) |
| common.mergeEnv(env, toJson(testScheme)) |
| } |
| catch (Exception e) { |
| common.errorMsg("There is an error occured during parseTextForTestSchemas execution:\n${e}") |
| throw e |
| } |
| } |
| return testScheme |
| } |
| |
| |
| /** |
| * getEquinixMetroWithCapacity returns list of Equinix metros using specified |
| * instance type (nodeType), desired count of metros (metroCount) and |
| * instances (nodeCount) in a metro using specified matal version. |
| * Function downloads metal CLI from the |
| * https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux |
| * Empty list is returned in case of no metros with specified capacity was found or any other errors. |
| * Non-empty list is shuffled. |
| * |
| * @param: metroCount (int) Desired count of metros |
| * @param: nodeCount (int) Desired count of instances |
| * @param: nodeType (string) Instance type |
| * @param: version (string) Metal version to use |
| * @return ([]string) List of selected metros |
| * |
| **/ |
| def getEquinixMetroWithCapacity(metroCount = 1, nodeCount = 50, nodeType = 'c3.small.x86', version = '0.9.0') { |
| def common = new com.mirantis.mk.Common() |
| def metalUrl = "https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux" |
| def metal = './metal --config metal.yaml' |
| def metro = [] |
| def out = '' |
| def retries = 3 // number of retries |
| def i = 0 |
| def delay = 60 // 1 minute sleep |
| def excludeMetro = [] // list of metros to exclude from selection |
| try { |
| if (excludeMetro.size() > 0) { |
| common.infoMsg("Excluded metros: ${excludeMetros}") |
| } |
| sh "curl -o metal -# ${metalUrl} && chmod +x metal" |
| withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) { |
| sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml' |
| } |
| while (metro.size() < metroCount && i < retries) { |
| common.infoMsg("Selecting ${metroCount} available Equinix metros with free ${nodeCount} ${nodeType} hosts, try ${i+1}/${retries} ...") |
| if (i > 0) { // skip sleep on first step |
| sleep(delay) |
| } |
| 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() |
| metro = out.tokenize(',') |
| metro -= excludeMetro |
| if (metro.size() < metroCount) { |
| nodeCount -= 10 |
| // We need different metros for the [equinixmetalv2-child-diff-metro] case |
| } else if (metro.size() == 2 && metro[0][0, 1] == metro[1][0, 1]) { |
| nodeCount -= 10 |
| } |
| i++ |
| } |
| if (metro.size() > 0) { |
| m = metro.size() > 1 ? "${metro[0]},${metro[1]}" : "${metro[0]}" |
| sh "${metal} capacity check -P ${nodeType} -m ${m} -q ${nodeCount}" |
| } |
| } catch (Exception e) { |
| common.errorMsg "Exception: '${e}'" |
| return [] |
| } finally { |
| sh 'rm metal.yaml' |
| } |
| if (metro.size() > 0) { |
| Collections.shuffle(metro) |
| common.infoMsg("Selected metros: ${metro}") |
| } else { |
| common.warningMsg('No any metros have been selected !!! :(') |
| } |
| return metro |
| } |
| |
| |
| /** |
| * getEquinixFacilityWithCapacity returns list of Equinix facilities using specified |
| * instance type (nodeType), desired count of facilities (facilityCount) and |
| * instances (nodeCount) in a facility using specified matal version. |
| * Function downloads metal CLI from the |
| * https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux |
| * Empty list is returned in case of no facilities with specified capacity was found or any other errors. |
| * Non-empty list is shuffled. |
| * |
| * @param: facilityCount (int) Desired count of facilities |
| * @param: nodeCount (int) Desired count of instances |
| * @param: nodeType (string) Instance type |
| * @param: version (string) Metal version to use |
| * @return ([]string) List of selected facilities |
| * |
| **/ |
| @Deprecated |
| def getEquinixFacilityWithCapacity(facilityCount = 1, nodeCount = 50, nodeType = 'c3.small.x86', version = '0.9.0') { |
| def common = new com.mirantis.mk.Common() |
| common.warningMsg('You are using deprecated method getEquinixFacilityWithCapacity. Use getEquinixMetroWithCapacity instead') |
| def metalUrl = "https://artifactory.mcp.mirantis.net:443/artifactory/binary-dev-kaas-local/core/bin/mirror/metal-${version}-linux" |
| def metal = './metal --config metal.yaml' |
| def facility = [] |
| def out = '' |
| def retries = 3 // number of retries |
| def i = 0 |
| def delay = 60 // 1 minute sleep |
| def excludeFacility = [] // list of facilities to exclude from selection |
| try { |
| if (excludeFacility.size() > 0) { |
| common.infoMsg("Excluded facilities: ${excludeFacility}") |
| } |
| sh "curl -o metal -# ${metalUrl} && chmod +x metal" |
| withCredentials([string(credentialsId: env.KAAS_EQUINIX_API_TOKEN, variable: 'KAAS_EQUINIX_API_TOKEN')]) { |
| sh 'echo "project-id: ${KAAS_EQUINIX_PROJECT_ID}\ntoken: ${KAAS_EQUINIX_API_TOKEN}" >metal.yaml' |
| } |
| while (facility.size() < facilityCount && i < retries) { |
| common.infoMsg("Selecting ${facilityCount} available Equinix facilities with free ${nodeCount} ${nodeType} hosts, try ${i+1}/${retries} ...") |
| if (i > 0 ) { // skip sleep on first step |
| sleep(delay) |
| } |
| 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() |
| facility = out.tokenize(',') |
| facility -= excludeFacility |
| if (facility.size() < facilityCount) { |
| nodeCount -= 10 |
| // We need different metros for the [equinixmetalv2-child-diff-metro] case, facility[][0, 1] contains a metro name |
| } else if (facility.size() == 2 && facility[0][0, 1] == facility[1][0, 1]) { |
| nodeCount -= 10 |
| } |
| i++ |
| } |
| if (facility.size() > 0) { |
| f = facility.size() > 1 ? "${facility[0]},${facility[1]}" : "${facility[0]}" |
| sh "${metal} capacity check -P ${nodeType} -f ${f} -q ${nodeCount}" |
| } |
| } catch (Exception e) { |
| common.errorMsg "Exception: '${e}'" |
| return [] |
| } finally { |
| sh 'rm metal.yaml' |
| } |
| if (facility.size() > 0) { |
| Collections.shuffle(facility) |
| common.infoMsg("Selected facilities: ${facility}") |
| } else { |
| common.warningMsg('No any facilities have been selected !!! :(') |
| } |
| return facility |
| } |
| |
| |
| /** |
| * genCommandLine prepares command line for artifactory-replication |
| * command using legacy environment variables |
| * |
| * @return: (string) Prepared command line |
| */ |
| def genCommandLine() { |
| def envToParam = [ |
| 'DESTINATION_USER': '-dst-user', |
| 'ARTIFACT_FILTER': '-artifact-filter', |
| 'ARTIFACT_FILTER_PROD': '-artifact-filter-prod', |
| 'ARTIFACT_TYPE': '-artifact-type', |
| 'BINARY_CLEAN': '-bin-cleanup', |
| 'BINARY_CLEAN_KEEP_DAYS': '-bin-clean-keep-days', |
| 'BINARY_CLEAN_PREFIX': '-bin-clean-prefix', |
| 'BUILD_URL': '-slack-build-url', |
| 'CHECK_REPOS': '-check-repos', |
| 'DESTINATION_REGISTRY': '-dst-repo', |
| 'DESTINATION_REGISTRY_TYPE': '-dst-repo-type', |
| 'SIGNED_IMAGES_PATH': '-signed-images-path', |
| 'DOCKER_CLEAN': '-cleanup', |
| 'DOCKER_OLDER_THAN_DAYS': '-older-than-days', |
| 'DOCKER_REPO_PREFIX': '-docker-repo-prefix', |
| 'DOCKER_TAG': '-docker-tag', |
| 'FORCE': '-force', |
| 'HELM_CDN_DOMAIN': '-helm-cdn-domain', |
| 'SLACK_CHANNEL': '-slack-channel', |
| 'SLACK_CHANNELS': '-slack-channels', |
| 'SLACK_USER': '-slack-user', |
| 'SOURCE_REGISTRY': '-src-repo', |
| 'SOURCE_REGISTRY_TYPE': '-src-repo-type', |
| 'SYNC_PATTERN': '-sync-pattern' |
| ] |
| def cmdParams = '' |
| def isCheckClean = false |
| for (e in envToParam) { |
| if (env[e.key] == null) { |
| continue |
| } |
| if (e.key == 'CHECK_REPOS' || e.key == 'DOCKER_CLEAN') { |
| // Avoid CHECK_REPOS=true and DOCKER_CLEAN=true |
| if (env[e.key].toBoolean() && !isCheckClean) { |
| cmdParams += e.value + ' ' |
| isCheckClean = true |
| } |
| } else if (e.key == 'FORCE') { |
| if (env[e.key].toBoolean()) { |
| cmdParams += e.value + ' ' |
| } |
| } else { |
| cmdParams += "${e.value} '${env[e.key]}' " |
| } |
| } |
| // No any check or clean was specified - take a default action |
| if (!isCheckClean) { |
| cmdParams += '-replicate' |
| } |
| return cmdParams |
| } |
| |
| /** |
| * custom scheduling algorithm |
| * it ensures that builds of the same job are distributed as much as possible between different nodes |
| * @param label (string) desired node label |
| * @return: (string) node name |
| */ |
| def schedule (label='docker') { |
| def common = new com.mirantis.mk.Common() |
| def freeNodes = [] |
| def nodesMap = [:] |
| |
| // filter nodes with the specified label and at least one free executor |
| timeout(time: 30, unit: 'MINUTES') { |
| while (!freeNodes) { |
| freeNodes = jenkins.model.Jenkins.instance.computers.findAll { node -> |
| label in node.getAssignedLabels().collect { it.name } && |
| node.isPartiallyIdle() && |
| node.isOnline() |
| } |
| if (!freeNodes) { |
| echo 'No nodes available for scheduling, retrying...' |
| sleep 30 |
| } |
| } |
| } |
| |
| // generate a map of nodes matching other criteria |
| for (node in freeNodes) { |
| // sameJobExecutors is the number of executors running the same job as the calling one |
| sameJobExecutors = node.getExecutors() // get all executors |
| .collect { executor -> executor.getCurrentExecutable() } // get running "threads" |
| .collect { thread -> thread?.displayName } // filter job names from threads |
| .minus(null) // null = empty executors, remove them from the list |
| .findAll { it.contains(env.JOB_NAME) } // filter the same jobs as the calling one |
| .size() |
| |
| // calculate busy executors, we don't want to count "sameJobExecutors" twice |
| totalBusyExecutors = node.countBusy() - sameJobExecutors |
| // generate the final map which contains nodes matching criteria with their load score |
| // builds of the same jobs have x10 score, all others x1 |
| nodesMap += ["${node.getName()}" : sameJobExecutors * 10 + totalBusyExecutors] |
| } |
| |
| // return the least loaded node |
| return common.SortMapByValueAsc(nodesMap).collect { it.key }[0] |
| } |
| |
| |
| /** |
| * Get latest tag for test/frontend & equinix-private-infra images |
| * @param version (str) default tag value from main workflow |
| * @param isChanged (bool) is dependent directory files were changed |
| * @param imageName (string) image name for information message |
| * @return: (string) tag name |
| */ |
| def getImageTag(version, isChanged, imageName) { |
| def common = new com.mirantis.mk.Common() |
| def latestTag = '' |
| if (env.GERRIT_EVENT_TYPE && !(env.GERRIT_EVENT_TYPE in ['change-merged', 'ref-updated']) && isChanged) { |
| latestTag = version |
| } else { |
| if (env.GERRIT_EVENT_TYPE == 'ref-updated') { |
| latestTag = env.GERRIT_REFNAME.replace('refs/tags/v', '').trim() |
| } else { |
| latestTag = env.GERRIT_BRANCH ? env.GERRIT_BRANCH : env.GERRIT_REFSPEC ? env.GERRIT_REFSPEC : 'master' |
| if (latestTag != 'master') { |
| latestTag = latestTag.replaceAll('/', '_') |
| } |
| } |
| } |
| common.infoMsg("${imageName} image will use tag '${latestTag}'") |
| return latestTag |
| } |
| |
| /** |
| * Get actual branch version for os deployment job |
| * @param mosChildPreviouseComplexRelease (string) kaas_previous_complex_mosk_cluster_release_version.txt |
| * @param mosChildLatestComplexRelease (string) kaas_latest_complex_mosk_cluster_release_version.txt |
| * @param upgradeFlag (boolean) |
| * all parametrs get from si-test-release-sanity-check-prepare-configuration job |
| * @return: (string) branch verison |
| */ |
| def getOpenstackbranchVersion(mosChildPreviouseComplexRelease, mosChildLatestComplexRelease, upgradeFlag) { |
| def common = new com.mirantis.mk.Common() |
| def regex = Pattern.compile('([a-z]+)-([0-9]+-[0-9]+-[0-9]+)-([a-z]*)-?([0-9]+-[0-9]+-?[0-9]*)') |
| |
| def mosVersionBranch = upgradeFlag ? mosChildPreviouseComplexRelease : mosChildLatestComplexRelease |
| def matcherComplexVersion = regex.matcher((mosVersionBranch).toString()) |
| def releaseOpenstackK8sBranch = 'master' |
| |
| if (matcherComplexVersion.find()) { |
| def matcherComplexVersionParts = matcherComplexVersion.group(2).split('-') |
| releaseOpenstackK8sBranch = String.format('%s.%s.%s', matcherComplexVersionParts[0], matcherComplexVersionParts[1], '0') |
| } |
| common.infoMsg("Use: OPENSTACK_DEPLOY_RELEASE_DIR ${releaseOpenstackK8sBranch}") |
| return releaseOpenstackK8sBranch |
| } |
| |
| |
| |
| /** |
| * Translates set of environment vars into actual replicator command line |
| * @return: (string cmdParams, string jobDescription) |
| * cmdParams - generated command line |
| * jobDescription - job description |
| */ |
| def genReplicatorCommandLine() { |
| def mainModes = ['REPLICATE', 'CLEANUP', 'CHECK_REPOS', 'BIN_CLEANUP'] |
| def parameterWithoutArgument = mainModes |
| def parametersList = parameterWithoutArgument + [ |
| 'ARTIFACT_FILTER', |
| 'ARTIFACT_TYPE', |
| 'BIN_CLEAN_KEEP_DAYS', |
| 'BIN_CLEAN_PREFIX', |
| 'DOCKER_TAG', |
| // DST_ will be changed to TARGET_ |
| 'DST_REPO', |
| 'DST_REPO_TYPE', |
| 'DST_USER', |
| 'OLDER_THAN_DAYS', |
| 'SLACK_BUILD_URL', |
| 'SLACK_CHANNEL', |
| 'SLACK_USER', |
| 'SRC_REPO', |
| 'SRC_REPO_TYPE', |
| 'SRC_USER', |
| 'SYNC_PATTERN', |
| 'THREAD_COUNT' |
| ] |
| def mainModesDescriptions = [ |
| 'REPLICATE': 'Replicating binaries/Docker images', |
| 'CLEANUP': 'Cleaning Docker images', |
| 'BIN_CLEANUP': 'Cleaning binaries', |
| 'CHECK_REPOS': 'Checking binaries' |
| ] |
| |
| def cmdParams = '' |
| def jobDescription = '' |
| for (e in parametersList) { |
| if (env[e] == null || env[e] == '') { |
| continue |
| } |
| if (e in mainModes) { |
| jobDescription = mainModesDescriptions[e] |
| } |
| cmdParams += "-${e.replaceAll('_', '-').toLowerCase()} " |
| if (!(e in parameterWithoutArgument)) { |
| cmdParams += "'${env[e]}' " |
| } |
| } |
| return [cmdParams, jobDescription] |
| } |