Revert "Refactor collecting YAML containing gerrit params"

This reverts commit dc339858b95ab930650a68aca844633f7133f4e5.

Change-Id: I198acf89ca0838e606c0490506849a0c159cc32b
diff --git a/gating-pipeline.groovy b/gating-pipeline.groovy
index 15518d4..aeaee9a 100644
--- a/gating-pipeline.groovy
+++ b/gating-pipeline.groovy
@@ -4,7 +4,6 @@
  * JOBS_NAMESPACE - Gerrit gating jobs namespace (mk, contrail, ...)
  *
  **/
-import groovy.json.JsonOutput
 
 def common = new com.mirantis.mk.Common()
 def gerrit = new com.mirantis.mk.Gerrit()
@@ -19,7 +18,12 @@
 }
 
 def callJobWithExtraVars(String jobName) {
-    def gerritVars = JsonOutput.toJson(env.getEnvironment().findAll{ it.key.startsWith('GERRIT_') })
+    def gerritVars = '\n---'
+    for (envVar in env.getEnvironment()) {
+        if (envVar.key.startsWith("GERRIT_")) {
+            gerritVars += "\n${envVar.key}: '${envVar.value}'"
+        }
+    }
     testJob = build job: jobName, parameters: [
         [$class: 'TextParameterValue', name: 'EXTRA_VARIABLES_YAML', value: gerritVars]
     ]
diff --git a/test-system-reclass-pipeline.groovy b/test-system-reclass-pipeline.groovy
index a8e10b7..04eafeb 100644
--- a/test-system-reclass-pipeline.groovy
+++ b/test-system-reclass-pipeline.groovy
@@ -1,5 +1,3 @@
-import groovy.json.JsonOutput
-
 def gerrit = new com.mirantis.mk.Gerrit()
 def common = new com.mirantis.mk.Common()
 
@@ -9,7 +7,12 @@
 if (extraVarsYaml != '') {
     common.mergeEnv(env, extraVarsYaml)
 } else {
-    extraVarsYaml = JsonOutput.toJson(env.getEnvironment().findAll{ it.key.startsWith('GERRIT_') })
+    extraVarsYaml = '\n---'
+    for (envVar in env.getEnvironment()) {
+        if (envVar.key.startsWith("GERRIT_")) {
+            extraVarsYaml += "\n${envVar.key}: '${envVar.value}'"
+        }
+    }
 }
 
 def slaveNode = env.SLAVE_NODE ?: 'python&&docker'