Merge "[ci] Use latest image tag for test/frontend and equinix-private-infra images"
diff --git a/src/com/mirantis/mk/Git.groovy b/src/com/mirantis/mk/Git.groovy
index 4c06288..17b0cf3 100644
--- a/src/com/mirantis/mk/Git.groovy
+++ b/src/com/mirantis/mk/Git.groovy
@@ -539,6 +539,7 @@
     def amend = params.get('amend', false)
     def jsonChange = params.get('gerritPatch', [:])
     def changeId = params.get('changeId', '')
+    def remote = params.get('remote', 'origin')
     def commit
 
     if (!jsonChange) {
@@ -572,7 +573,7 @@
     dir(repo){
         commit = getGitCommit()
     }
-    pushForReview(repo, creds, commit, branch, topic)
+    pushForReview(repo, creds, commit, branch, topic, remote)
 }
 
 /**
diff --git a/src/com/mirantis/mk/KaasUtils.groovy b/src/com/mirantis/mk/KaasUtils.groovy
index 74c81c0..329511d 100644
--- a/src/com/mirantis/mk/KaasUtils.groovy
+++ b/src/com/mirantis/mk/KaasUtils.groovy
@@ -73,6 +73,7 @@
     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 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
@@ -84,6 +85,8 @@
     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
     // 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,
@@ -117,6 +120,7 @@
     def enableFips = env.ENABLE_FIPS ? env.ENABLE_FIPS.toBoolean() : false
     def aioCluster = env.AIO_CLUSTER ? env.AIO_CLUSTER.toBoolean() : false
     def useVsphereVvmtObjects = env.VSPHERE_USE_VVMT_OBJECTS ? env.VSPHERE_USE_VVMT_OBJECTS.toBoolean() : false
+    def enableBv2Smoke = true
 
     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.*/) {
@@ -126,7 +130,7 @@
     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) {
+    if (commitMsg ==~ /(?s).*\[child-deploy\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-deploy.*/ || upgradeChild || runChildConformance || runProxyChildTest || runChildHPA) {
         deployChild = true
     }
     if (commitMsg ==~ /(?s).*\[child-upgrade\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-upgrade.*/) {
@@ -218,6 +222,10 @@
         runChildConformance = true
         deployChild = true
     }
+    if (commitMsg ==~ /(?s).*\[child-hpa\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*child-hpa.*/) {
+        runChildHPA = true
+        deployChild = true
+    }
     if (commitMsg ==~ /(?s).*\[lma-test\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*lma-test.*/) {
         runLMATest = true
         enableLMALogging = true
@@ -296,6 +304,13 @@
     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
+        common.errorMsg('vSphere, BM, Openstack demo deployments 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')
@@ -314,6 +329,10 @@
         enableVsphereUbuntu = true
         common.warningMsg('Ubuntu 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).*\[disable-artifacts-build\].*/ || env.GERRIT_EVENT_COMMENT_TEXT ==~ /(?s).*disable-artifacts-build\.*/) {
         enableArtifactsBuild = false
@@ -331,6 +350,18 @@
         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).*\[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) {
@@ -445,6 +476,7 @@
         MOS child deploy scheduled: ${mosDeployChild}
         MOS child upgrade scheduled: ${mosUpgradeChild}
         Child conformance testing scheduled: ${runChildConformance}
+        Child HPA testing scheduled: ${runChildHPA}
         Single BYO cluster attachment scheduled: ${attachBYO}
         Single Attached BYO cluster upgrade test scheduled: ${upgradeBYO}
         BYO test matrix whole suite scheduled: ${runBYOMatrix}
@@ -467,6 +499,8 @@
         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}
         AWS provider deployment scheduled: ${awsOnDemandDemo}
         Equinix provider deployment scheduled: ${equinixOnDemandDemo}
         EquinixmetalV2 provider deployment scheduled: ${equinixMetalV2OnDemandDemo}
@@ -489,6 +523,7 @@
         Pause for debug enabled: ${pauseForDebug}
         AIO cluster: ${aioCluster}
         Use Vsphere VVMT Objects: ${useVsphereVvmtObjects}
+        Bootsrap v2 smoke checks enabled: ${enableBv2Smoke}
         Triggers: https://gerrit.mcp.mirantis.com/plugins/gitiles/kaas/core/+/refs/heads/master/hack/ci-gerrit-keywords.md""")
     return [
         osCloudLocation                          : openstackIMC,
@@ -502,6 +537,7 @@
         mosDeployChildEnabled                    : mosDeployChild,
         mosUpgradeChildEnabled                   : mosUpgradeChild,
         runChildConformanceEnabled               : runChildConformance,
+        runChildHPAEnabled                       : runChildHPA,
         attachBYOEnabled                         : attachBYO,
         upgradeBYOEnabled                        : upgradeBYO,
         runBYOMatrixEnabled                      : runBYOMatrix,
@@ -521,6 +557,8 @@
         runRgnlDeleteMasterTestEnabled           : runRgnlDeleteMasterTest,
         runChildDeleteMasterTestEnabled          : runChildDeleteMasterTest,
         runChildCustomCertTestEnabled            : runChildCustomCertTest,
+        runMgmtCustomCacheCertTestEnabled        : runMgmtCustomCacheCertTest,
+        runByoChildCustomCertTestEnabled         : runByoChildCustomCertTest,
         runChildMachineDeletionPolicyTestEnabled : runChildMachineDeletionPolicyTest,
         runLMATestEnabled                        : runLMATest,
         runMgmtUserControllerTestEnabled         : runMgmtUserControllerTest,
@@ -546,7 +584,8 @@
         equinixMetalV2Metro                      : equinixMetalV2Metro,
         enableFips                               : enableFips,
         aioCluster                               : aioCluster,
-        useVsphereVvmtObjects                    : useVsphereVvmtObjects]
+        useVsphereVvmtObjects                    : useVsphereVvmtObjects,
+        bv2SmokeEnabled                          : enableBv2Smoke]
 }
 
 /**
@@ -828,6 +867,8 @@
         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_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),
@@ -839,6 +880,7 @@
         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_HPA', value: triggers.runChildHPAEnabled),
         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),
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")
+                    }
+                }
             }
         }