Merge "[ui] refactor test type triggers"
diff --git a/src/com/mirantis/mk/Git.groovy b/src/com/mirantis/mk/Git.groovy
index 1e24aeb..4c06288 100644
--- a/src/com/mirantis/mk/Git.groovy
+++ b/src/com/mirantis/mk/Git.groovy
@@ -17,9 +17,20 @@
  * @param timeout         Set checkout timeout (default 10)
  * @param depth           Git depth param (default 0 means no depth)
  * @param reference       Git reference param to checkout (default empyt, i.e. no reference)
+ * @param withWipeOut     Enable workspace wipe before checkout
  */
-def checkoutGitRepository(path, url, branch, credentialsId = null, poll = true, timeout = 10, depth = 0, reference = ''){
+def checkoutGitRepository(path, url, branch, credentialsId = null, poll = true, timeout = 10, depth = 0, reference = '', withWipeOut = false){
     def branch_name = reference ? 'FETCH_HEAD' : "*/${branch}"
+    def scmExtensions = [
+        [$class: 'CheckoutOption', timeout: timeout],
+        [$class: 'CloneOption', depth: depth, noTags: false, shallow: depth > 0, timeout: timeout]
+    ]
+
+    // wipe workspace before checkout
+    if (withWipeOut) {
+        scmExtensions.add([$class: 'WipeWorkspace'])
+    }
+
     dir(path) {
         checkout(
             changelog:true,
@@ -28,9 +39,7 @@
                 $class: 'GitSCM',
                 branches: [[name: branch_name]],
             doGenerateSubmoduleConfigurations: false,
-            extensions: [
-                [$class: 'CheckoutOption', timeout: timeout],
-                [$class: 'CloneOption', depth: depth, noTags: false, shallow: depth > 0, timeout: timeout]],
+            extensions: scmExtensions,
             submoduleCfg: [],
             userRemoteConfigs: [[url: url, credentialsId: credentialsId, refspec: reference]]]
         )
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index 461d948..eabda2f 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -83,6 +83,7 @@
     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
     // 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,
@@ -324,6 +325,12 @@
         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')
+    }
+
     // TODO (vnaumov) remove below condition after moving all releases to UCP
     def ucpChildMatches = (commitMsg =~ /(\[child-ucp\s*ucp-.*?\])/)
     if (ucpChildMatches.size() > 0) {
@@ -459,6 +466,7 @@
         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}
         AWS provider deployment scheduled: ${awsOnDemandDemo}
         Equinix provider deployment scheduled: ${equinixOnDemandDemo}
         EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo}
@@ -512,6 +520,7 @@
         runMgmtDeleteMasterTestEnabled           : runMgmtDeleteMasterTest,
         runRgnlDeleteMasterTestEnabled           : runRgnlDeleteMasterTest,
         runChildDeleteMasterTestEnabled          : runChildDeleteMasterTest,
+        runChildCustomCertTestEnabled            : runChildCustomCertTest,
         runChildMachineDeletionPolicyTestEnabled : runChildMachineDeletionPolicyTest,
         runLMATestEnabled                        : runLMATest,
         runMgmtUserControllerTestEnabled         : runMgmtUserControllerTest,
@@ -818,6 +827,7 @@
         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_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),