Revert "Improve parallelism of testing jobs"
This reverts commit 134ac92b096b09bbd4abf7769b88953a87cdde0f.
Change-Id: I66e05bec1a6b1beda36e903ec6f207b95a4eb6d2
diff --git a/test-salt-formulas-pipeline.groovy b/test-salt-formulas-pipeline.groovy
index 1494aca..4422ca6 100644
--- a/test-salt-formulas-pipeline.groovy
+++ b/test-salt-formulas-pipeline.groovy
@@ -3,6 +3,7 @@
* DEFAULT_GIT_REF
* DEFAULT_GIT_URL
* CREDENTIALS_ID
+ * KITCHEN_TESTS_PARALLEL
*/
def common = new com.mirantis.mk.Common()
def gerrit = new com.mirantis.mk.Gerrit()
@@ -15,6 +16,13 @@
gerritRef = null
}
+def parallelGroupSize
+try {
+ parallelGroupSize = Integer.valueOf(PARALLEL_GROUP_SIZE)
+} catch (MissingPropertyException e) {
+ parallelGroupSize = 8
+}
+
def defaultGitRef, defaultGitUrl
try {
defaultGitRef = DEFAULT_GIT_REF
@@ -84,9 +92,15 @@
common.infoMsg("CUSTOM_KITCHEN_ENVS not empty. Running with custom enviroments: ${kitchenEnvs}")
}
if (kitchenEnvs != null && kitchenEnvs != '') {
+ def acc = 0
def kitchenTestRuns = [:]
common.infoMsg("Found " + kitchenEnvs.size() + " environment(s)")
for (int i = 0; i < kitchenEnvs.size(); i++) {
+ if (acc >= parallelGroupSize) {
+ parallel kitchenTestRuns
+ kitchenTestRuns = [:]
+ acc = 0
+ }
def testEnv = kitchenEnvs[i]
kitchenTestRuns[testEnv] = {
build job: "test-salt-formulas-env", parameters: [
@@ -98,8 +112,11 @@
[$class: 'StringParameterValue', name: 'SALT_VERSION', value: SALT_VERSION]
]
}
+ acc++;
}
- parallel kitchenTestRuns
+ if (acc != 0) {
+ parallel kitchenTestRuns
+ }
} else {
common.warningMsg(".kitchen.yml file not found, no kitchen tests triggered.")
}
diff --git a/test-salt-models-pipeline.groovy b/test-salt-models-pipeline.groovy
index 7099954..2ff76d2 100644
--- a/test-salt-models-pipeline.groovy
+++ b/test-salt-models-pipeline.groovy
@@ -82,6 +82,7 @@
if(checkouted) {
def infraYMLs = sh(script: "find ./classes/ -regex '.*cluster/[-_a-zA-Z0-9]*/[infra/]*init\\.yml' -exec grep -il 'cluster_name' {} \\;", returnStdout: true).tokenize()
def branches = [:]
+ def acc = 0
for (int i = 0; i < infraYMLs.size(); i++) {
def infraYMLConfig = readYaml(file: infraYMLs[i])
if(!infraYMLConfig["parameters"].containsKey("_param")){
@@ -97,6 +98,11 @@
def clusterDomain = infraParams["cluster_domain"]
def configHostname = infraParams["infra_config_hostname"]
def testTarget = String.format("%s.%s", configHostname, clusterDomain)
+ if (acc >= PARALLEL_NODE_GROUP_SIZE.toInteger()) {
+ parallel branches
+ branches = [:]
+ acc = 0
+ }
branches[testTarget] = {
build job: "test-salt-model-node", parameters: [
@@ -112,8 +118,11 @@
[$class: 'StringParameterValue', name: 'MAX_CPU_PER_JOB', value: MAX_CPU_PER_JOB],
[$class: 'StringParameterValue', name: 'SYSTEM_GIT_REF', value: SYSTEM_GIT_REF]
]}
+ acc++;
}
- parallel branches
+ if (acc != 0) {
+ parallel branches
+ }
}
}
} catch (Throwable e) {