blob: e0c9710c1c84fd301883406c91fc1aef0f1fd563 [file] [log] [blame]
azvyagintsev4eb89ea2018-08-07 17:48:19 +02001package com.mirantis.mk
azvyagintsev5c0313d2018-08-13 17:13:35 +03002
azvyagintsev4eb89ea2018-08-07 17:48:19 +02003def common = new com.mirantis.mk.Common()
4def saltModelTesting = new com.mirantis.mk.SaltModelTesting()
5
6/**
7 * Test CC model wrapper
8 * EXTRA_VARIABLES_YAML: yaml based string, to be directly passed into testCCModel
azvyagintsev5c0313d2018-08-13 17:13:35 +03009 * SLAVE_NODE:
azvyagintsev4eb89ea2018-08-07 17:48:19 +020010 */
11
azvyagintsev2a4ad372019-02-07 18:43:12 +020012slaveNode = env.SLAVE_NODE ?: 'docker'
azvyagintsev5c0313d2018-08-13 17:13:35 +030013
azvyagintsev4eb89ea2018-08-07 17:48:19 +020014timeout(time: 1, unit: 'HOURS') {
azvyagintseva381cc32018-09-11 15:36:23 +030015 node(slaveNode) {
16 stage("RunTest") {
17 try {
18 extraVars = readYaml text: EXTRA_VARIABLES_YAML
19 currentBuild.description = extraVars.modelFile
Denis Egorenko032b8ca2018-09-13 17:00:23 +040020 sh(script: 'find . -mindepth 1 -delete || true', returnStatus: true)
21 sh(script: """
22 wget --progress=dot:mega --auth-no-challenge -O models.tar.gz ${extraVars.MODELS_TARGZ}
23 tar -xzf models.tar.gz
24 """)
25 common.infoMsg("Going to test exactly one context: ${extraVars.modelFile}\n, with params: ${extraVars}")
26
27 def content = readFile(file: extraVars.modelFile)
28 def templateContext = readYaml text: content
29 def config = [
Denis Egorenko926bc7d2019-02-19 14:27:34 +040030 'dockerHostname': "cfg01",
31 'domain': "${templateContext.default_context.cluster_domain}",
Denis Egorenko032b8ca2018-09-13 17:00:23 +040032 'clusterName': templateContext.default_context.cluster_name,
33 'reclassEnv': extraVars.testReclassEnv,
azvyagintsev1bcadc42018-10-05 20:13:15 +030034 'distribRevision': extraVars.DISTRIB_REVISION,
Denis Egorenko032b8ca2018-09-13 17:00:23 +040035 'dockerContainerName': extraVars.DockerCName,
Denis Egorenkod87490e2019-02-26 20:00:41 +040036 'testContext': extraVars.modelFile,
37 'dockerExtraOpts': [ '--memory=3g' ]
Denis Egorenko032b8ca2018-09-13 17:00:23 +040038 ]
Denis Egorenko086aff12018-10-18 17:54:59 +040039 if (extraVars.useExtraRepos) {
40 config['extraRepos'] = extraVars.extraRepos ? extraVars.extraRepos : [:]
41 config['extraRepoMergeStrategy'] = extraVars.extraRepoMergeStrategy ? extraVars.extraRepoMergeStrategy : ''
42 }
Denis Egorenko032b8ca2018-09-13 17:00:23 +040043 saltModelTesting.testNode(config)
azvyagintseva381cc32018-09-11 15:36:23 +030044 } catch (Throwable e) {
45 // If there was an error or exception thrown, the build failed
46 currentBuild.result = "FAILURE"
47 currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message
48 throw e
49 }
50 }
azvyagintsev4eb89ea2018-08-07 17:48:19 +020051 }
azvyagintsev5c0313d2018-08-13 17:13:35 +030052}