Add ability to run cookiecutter tests against packaging/sources/reclass repo
Add ability to test patches to packaging/sources/reclass repo
Change-Id: Icd2d0c78ff18ac90791a935fc9e58935bb9f3af6
Related-bug: PROD-21847
diff --git a/test-cookiecutter-reclass.groovy b/test-cookiecutter-reclass.groovy
index 8826bc1..fd09fe5 100644
--- a/test-cookiecutter-reclass.groovy
+++ b/test-cookiecutter-reclass.groovy
@@ -17,7 +17,7 @@
git = new com.mirantis.mk.Git()
python = new com.mirantis.mk.Python()
-def extraVarsYAML = env.EXTRA_VARIABLES_YAML ?: false
+def extraVarsYAML = env.EXTRA_VARIABLES_YAML.trim() ?: ''
if (extraVarsYAML) {
common.mergeEnv(env, extraVarsYAML)
}
@@ -55,6 +55,7 @@
// version of debRepos, aka formulas|reclass|ubuntu
testDistribRevision = env.DISTRIB_REVISION ?: 'nightly'
+
// Name of sub-test chunk job
chunkJobName = "test-mk-cookiecutter-templates-chunk"
testModelBuildsData = [:]
@@ -142,7 +143,7 @@
}
}
-def testModel(modelFile, reclassArtifactName, artifactCopyPath) {
+def testModel(modelFile, reclassArtifactName, artifactCopyPath, useExtraRepos = false) {
// 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)
@@ -153,6 +154,8 @@
testReclassEnv: "model/${modelFile}/"
modelFile: "contexts/${modelFile}.yml"
DISTRIB_REVISION: "${testDistribRevision}"
+ useExtraRepos: ${useExtraRepos}
+ ${extraVarsYAML}
"""
def chunkJob = build job: chunkJobName, parameters: [
[$class: 'TextParameterValue', name: 'EXTRA_VARIABLES_YAML',
@@ -164,7 +167,7 @@
'buildId' : "${chunkJob.number}"])
}
-def StepTestModel(basename, reclassArtifactName, artifactCopyPath) {
+def StepTestModel(basename, reclassArtifactName, artifactCopyPath, useExtraRepos = false) {
// We need to wrap what we return in a Groovy closure, or else it's invoked
// when this method is called, not when we pass it to parallel.
// To do this, you need to wrap the code below in { }, and either return
@@ -172,7 +175,7 @@
// return node object
return {
node(slaveNode) {
- testModel(basename, reclassArtifactName, artifactCopyPath)
+ testModel(basename, reclassArtifactName, artifactCopyPath, useExtraRepos)
}
}
}
@@ -430,7 +433,7 @@
common.infoMsg("Found: ${contextFileListPatched.size()} patched contexts to test.")
for (String context : contextFileListPatched) {
def basename = common.GetBaseName(context, '.yml')
- stepsForParallel.put("ContextPatchedTest:${basename}", StepTestModel(basename, patchedReclassArtifactName, reclassInfoPatchedPath))
+ stepsForParallel.put("ContextPatchedTest:${basename}", StepTestModel(basename, patchedReclassArtifactName, reclassInfoPatchedPath, true))
}
parallel stepsForParallel
common.infoMsg('All TestContexts tests done')