Refactor collecting YAML with params for child jobs

Jenkins doesn't have shipped groovy/java modules to handle YAML, but JSON
is a subset of YAML.

So let's use standard JSON handling modules to serialize gerrit environment
variables to JSON, and parse it as YAML.

Change-Id: I79a9ba5dd8ec9559581cec3e294b1336ccee85dd
See: https://mirantis.jira.com/browse/PROD-24467
See: https://en.wikipedia.org/wiki/YAML#Comparison_with_JSON
diff --git a/test-cookiecutter-reclass.groovy b/test-cookiecutter-reclass.groovy
index 33ab3f5..cee90d1 100644
--- a/test-cookiecutter-reclass.groovy
+++ b/test-cookiecutter-reclass.groovy
@@ -12,6 +12,8 @@
    Always test GERRIT_REFSPEC VS GERRIT_BRANCH-master version of opposite project
  */
 
+import groovy.json.JsonOutput
+
 common = new com.mirantis.mk.Common()
 gerrit = new com.mirantis.mk.Gerrit()
 git = new com.mirantis.mk.Git()
@@ -20,6 +22,9 @@
 extraVarsYAML = env.EXTRA_VARIABLES_YAML.trim() ?: ''
 if (extraVarsYAML) {
     common.mergeEnv(env, extraVarsYAML)
+    extraVars = readYaml text: extraVarsYAML
+} else {
+    extraVars = [:]
 }
 
 slaveNode = env.SLAVE_NODE ?: 'docker'
@@ -74,16 +79,15 @@
     // modelFile - `modelfiname` from model/modelfiname/modelfiname.yaml
     //* Grub all models and send it to check in paralell - by one in thread.
     def _uuid = "${env.JOB_NAME.toLowerCase()}_${env.BUILD_TAG.toLowerCase()}_${modelFile.toLowerCase()}_" + UUID.randomUUID().toString().take(8)
-    def _values_string = """
----
-MODELS_TARGZ: "${env.BUILD_URL}/artifact/${reclassArtifactName}"
-DockerCName: "${_uuid}"
-testReclassEnv: "model/${modelFile}/"
-modelFile: "contexts/${modelFile}.yml"
-DISTRIB_REVISION: "${testDistribRevision}"
-useExtraRepos: ${useExtraRepos}
-${extraVarsYAML.replaceAll('---', '')}
-"""
+    def _values = [
+        MODELS_TARGZ: "${env.BUILD_URL}/artifact/${reclassArtifactName}",
+        DockerCName: _uuid,
+        testReclassEnv: "model/${modelFile}/",
+        modelFile: "contexts/${modelFile}.yml",
+        DISTRIB_REVISION: testDistribRevision,
+        useExtraRepos: useExtraRepos,
+    ]
+    def _values_string = JsonOutput.toJson(_values << extraVars)
     def chunkJob = build job: chunkJobName, parameters: [
         [$class: 'TextParameterValue', name: 'EXTRA_VARIABLES_YAML',
          value : _values_string.stripIndent()],