Merge "Add remote parameter to updateChangeRequest method"
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index eabda2f..ee72758 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -84,6 +84,7 @@
     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
     // 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,
@@ -331,6 +332,12 @@
         common.warningMsg('Child cluster deployment will be enabled since custom cert child test suite will be executed')
     }
 
+    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) {
@@ -467,6 +474,7 @@
         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}
         AWS provider deployment scheduled: ${awsOnDemandDemo}
         Equinix provider deployment scheduled: ${equinixOnDemandDemo}
         EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo}
@@ -521,6 +529,7 @@
         runRgnlDeleteMasterTestEnabled           : runRgnlDeleteMasterTest,
         runChildDeleteMasterTestEnabled          : runChildDeleteMasterTest,
         runChildCustomCertTestEnabled            : runChildCustomCertTest,
+        runByoChildCustomCertTestEnabled         : runByoChildCustomCertTest,
         runChildMachineDeletionPolicyTestEnabled : runChildMachineDeletionPolicyTest,
         runLMATestEnabled                        : runLMATest,
         runMgmtUserControllerTestEnabled         : runMgmtUserControllerTest,
@@ -828,6 +837,7 @@
         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_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),
diff --git a/src/com/mirantis/mk/ReleaseWorkflow.groovy b/src/com/mirantis/mk/ReleaseWorkflow.groovy
index 63a3675..a6ac966 100644
--- a/src/com/mirantis/mk/ReleaseWorkflow.groovy
+++ b/src/com/mirantis/mk/ReleaseWorkflow.groovy
@@ -110,7 +110,8 @@
     String changeAuthorName     = params.get('crAuthorName', 'MCP-CI')
     String changeAuthorEmail    = params.get('crAuthorEmail', 'mcp-ci-jenkins@ci.mcp.mirantis.net')
     Boolean valuesFromFile      = params.get('valuesFromFile', false)
-    Boolean catMetadataLog       = params.get('catMetadataLog', false)
+    Boolean catMetadataLog      = params.get('catMetadataLog', false)
+    Boolean validateOnce        = params.get('validateOnce', false)
 
     def cred = common.getCredentials(gitCredentialsId, 'key')
     String gerritUser = cred.username
@@ -166,15 +167,17 @@
                     }
                     try {
                         sh "metadata-app --path /workspace/metadata update --create --key '${keyArr[i]}' ${valueExpression}"
-                        checkResult = sh(script: "metadata-app --path /workspace/metadata validate --structure", returnStatus: true)
-                        def MetadataLogFile = readFile("metadata.log")
-                        if (MetadataLogFile.size() > 0) {
-                            if (catMetadataLog) {
-                                common.errorMsg("Invalid metadata structure, metadata.log file content:\n${MetadataLogFile}")
+                        if (!validateOnce) {
+                            def checkResult = sh(script: "metadata-app --path /workspace/metadata validate --structure", returnStatus: true)
+                            def MetadataLogFile = readFile("metadata.log")
+                            if (MetadataLogFile.size() > 0) {
+                                if (catMetadataLog) {
+                                    common.errorMsg("Invalid metadata structure, metadata.log file content:\n${MetadataLogFile}")
+                                }
                             }
-                        }
-                        if (checkResult != 0) {
-                            throw new Exception("Invalid metadata structure, see errors in the metadata.log file")
+                            if (checkResult != 0) {
+                                throw new Exception("Invalid metadata structure, see errors in the metadata.log file")
+                            }
                         }
                     } finally {
                         if (valuesFromFile) {
@@ -182,6 +185,18 @@
                         }
                     }
                 }
+                if (validateOnce) {
+                    def checkResult = sh(script: "metadata-app --path /workspace/metadata validate --structure", returnStatus: true)
+                    def MetadataLogFile = readFile("metadata.log")
+                    if (MetadataLogFile.size() > 0) {
+                        if (catMetadataLog) {
+                            common.errorMsg("Invalid metadata structure, metadata.log file content:\n${MetadataLogFile}")
+                        }
+                    }
+                    if (checkResult != 0) {
+                        throw new Exception("Invalid metadata structure, see errors in the metadata.log file")
+                    }
+                }
             }
         }