azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 1 | /* |
| 2 | Able to be triggered from Gerrit if : |
| 3 | Variators: |
| 4 | Modes: |
| 5 | 1) manual run via job-build , possible to pass refspec |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 6 | TODO: currently impossible to use custom COOKIECUTTER_TEMPLATE_URL| RECLASS_SYSTEM_URL Gerrit-one always used. |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 7 | - for CC |
| 8 | - Reclass |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 9 | |
| 10 | 2) gerrit trigger |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 11 | Automatically switches if GERRIT_PROJECT variable detected |
| 12 | Always test GERRIT_REFSPEC VS GERRIT_BRANCH-master version of opposite project |
| 13 | */ |
| 14 | |
Alexander Evseev | 02fe5eb | 2018-11-15 13:58:36 +0100 | [diff] [blame] | 15 | import groovy.json.JsonOutput |
| 16 | |
chnyda | e80bb92 | 2017-05-29 17:48:40 +0200 | [diff] [blame] | 17 | common = new com.mirantis.mk.Common() |
azvyagintsev | 1385db9 | 2019-03-22 16:05:10 +0200 | [diff] [blame] | 18 | mcpCommon = new com.mirantis.mcp.Common() |
chnyda | bc63c9a | 2017-05-30 15:37:54 +0200 | [diff] [blame] | 19 | gerrit = new com.mirantis.mk.Gerrit() |
chnyda | e80bb92 | 2017-05-29 17:48:40 +0200 | [diff] [blame] | 20 | python = new com.mirantis.mk.Python() |
chnyda | e80bb92 | 2017-05-29 17:48:40 +0200 | [diff] [blame] | 21 | |
Denis Egorenko | d67a6d2 | 2018-10-18 16:00:46 +0400 | [diff] [blame] | 22 | extraVarsYAML = env.EXTRA_VARIABLES_YAML.trim() ?: '' |
Denis Egorenko | 535d5b6 | 2018-09-28 11:28:10 +0400 | [diff] [blame] | 23 | if (extraVarsYAML) { |
| 24 | common.mergeEnv(env, extraVarsYAML) |
Alexander Evseev | 02fe5eb | 2018-11-15 13:58:36 +0100 | [diff] [blame] | 25 | extraVars = readYaml text: extraVarsYAML |
| 26 | } else { |
| 27 | extraVars = [:] |
Denis Egorenko | 535d5b6 | 2018-09-28 11:28:10 +0400 | [diff] [blame] | 28 | } |
| 29 | |
Vladimir Khlyunev | 30411c2 | 2021-05-31 16:38:57 +0000 | [diff] [blame] | 30 | slaveNode = env.SLAVE_NODE ?: 'virtual' |
azvyagintsev | e7b8e79 | 2018-09-21 17:27:01 +0300 | [diff] [blame] | 31 | checkIncludeOrder = env.CHECK_INCLUDE_ORDER ?: false |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 32 | |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 33 | // Global var's |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 34 | gerritConData = [credentialsId : env.CREDENTIALS_ID, |
| 35 | gerritName : env.GERRIT_NAME ?: 'mcp-jenkins', |
Roman Vyalov | f0c596e | 2018-10-01 17:56:09 +0300 | [diff] [blame] | 36 | gerritHost : env.GERRIT_HOST ?: 'gerrit.mcp.mirantis.com', |
azvyagintsev | b266ad2 | 2018-09-11 12:11:11 +0300 | [diff] [blame] | 37 | gerritScheme : env.GERRIT_SCHEME ?: 'ssh', |
| 38 | gerritPort : env.GERRIT_PORT ?: '29418', |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 39 | gerritRefSpec : null, |
| 40 | gerritProject : null, |
| 41 | withWipeOut : true, |
| 42 | GERRIT_CHANGE_NUMBER: null] |
| 43 | // |
Roman Vyalov | f0c596e | 2018-10-01 17:56:09 +0300 | [diff] [blame] | 44 | //ccTemplatesRepo = env.COOKIECUTTER_TEMPLATE_URL ?: 'ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/mk/cookiecutter-templates' |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 45 | gerritDataCCHEAD = [:] |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 46 | gerritDataCC = [:] |
| 47 | gerritDataCC << gerritConData |
| 48 | gerritDataCC['gerritBranch'] = env.COOKIECUTTER_TEMPLATE_BRANCH ?: 'master' |
azvyagintsev | 458278c | 2018-09-25 18:38:30 +0300 | [diff] [blame] | 49 | gerritDataCC['gerritRefSpec'] = env.COOKIECUTTER_TEMPLATE_REF ?: null |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 50 | gerritDataCC['gerritProject'] = 'mk/cookiecutter-templates' |
| 51 | // |
Roman Vyalov | f0c596e | 2018-10-01 17:56:09 +0300 | [diff] [blame] | 52 | //reclassSystemRepo = env.RECLASS_SYSTEM_URL ?: 'ssh://mcp-jenkins@gerrit.mcp.mirantis.com:29418/salt-models/reclass-system' |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 53 | gerritDataRSHEAD = [:] |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 54 | gerritDataRS = [:] |
| 55 | gerritDataRS << gerritConData |
Denis Egorenko | e7040ac | 2018-10-24 20:11:04 +0400 | [diff] [blame] | 56 | gerritDataRS['gerritBranch'] = env.RECLASS_SYSTEM_BRANCH ?: 'master' |
azvyagintsev | 458278c | 2018-09-25 18:38:30 +0300 | [diff] [blame] | 57 | gerritDataRS['gerritRefSpec'] = env.RECLASS_SYSTEM_GIT_REF ?: null |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 58 | gerritDataRS['gerritProject'] = 'salt-models/reclass-system' |
| 59 | |
azvyagintsev | ec055b4 | 2018-10-11 12:59:05 +0300 | [diff] [blame] | 60 | // version of debRepos, aka formulas|reclass|ubuntu |
azvyagintsev | 10e2401 | 2018-09-10 21:36:32 +0300 | [diff] [blame] | 61 | testDistribRevision = env.DISTRIB_REVISION ?: 'nightly' |
Denis Egorenko | 14f0f0f | 2019-11-19 13:50:25 +0400 | [diff] [blame] | 62 | updatesVersion = '' |
Denis Egorenko | 086aff1 | 2018-10-18 17:54:59 +0400 | [diff] [blame] | 63 | |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 64 | // Name of sub-test chunk job |
| 65 | chunkJobName = "test-mk-cookiecutter-templates-chunk" |
| 66 | testModelBuildsData = [:] |
Vasyl Saienko | 772e123 | 2018-07-23 14:42:24 +0300 | [diff] [blame] | 67 | |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 68 | def getAndUnpackNodesInfoArtifact(jobName, copyTo, build) { |
| 69 | return { |
| 70 | dir(copyTo) { |
| 71 | copyArtifacts(projectName: jobName, selector: specific(build), filter: "nodesinfo.tar.gz") |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 72 | sh "tar -xf nodesinfo.tar.gz" |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 73 | sh "rm -v nodesinfo.tar.gz" |
| 74 | } |
| 75 | } |
| 76 | } |
azvyagintsev | 8798553 | 2018-07-10 20:49:38 +0300 | [diff] [blame] | 77 | |
Denis Egorenko | 086aff1 | 2018-10-18 17:54:59 +0400 | [diff] [blame] | 78 | def testModel(modelFile, reclassArtifactName, artifactCopyPath, useExtraRepos = false) { |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 79 | // modelFile - `modelfiname` from model/modelfiname/modelfiname.yaml |
| 80 | //* Grub all models and send it to check in paralell - by one in thread. |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 81 | def _uuid = "${env.JOB_NAME.toLowerCase()}_${env.BUILD_TAG.toLowerCase()}_${modelFile.toLowerCase()}_" + UUID.randomUUID().toString().take(8) |
Alexander Evseev | 02fe5eb | 2018-11-15 13:58:36 +0100 | [diff] [blame] | 82 | def _values = [ |
azvyagintsev | 4220bff | 2019-01-09 21:32:11 +0200 | [diff] [blame] | 83 | MODELS_TARGZ : "${env.BUILD_URL}/artifact/${reclassArtifactName}", |
| 84 | DockerCName : _uuid, |
| 85 | testReclassEnv : "model/${modelFile}/", |
| 86 | modelFile : "contexts/${modelFile}.yml", |
Alexander Evseev | 02fe5eb | 2018-11-15 13:58:36 +0100 | [diff] [blame] | 87 | DISTRIB_REVISION: testDistribRevision, |
azvyagintsev | 4220bff | 2019-01-09 21:32:11 +0200 | [diff] [blame] | 88 | useExtraRepos : useExtraRepos, |
Denis Egorenko | 19a793d | 2019-11-18 20:50:59 +0400 | [diff] [blame] | 89 | updatesVersion : updatesVersion, |
Alexander Evseev | 02fe5eb | 2018-11-15 13:58:36 +0100 | [diff] [blame] | 90 | ] |
| 91 | def _values_string = JsonOutput.toJson(_values << extraVars) |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 92 | def chunkJob = build job: chunkJobName, parameters: [ |
azvyagintsev | 08b34e3 | 2018-09-12 12:29:42 +0300 | [diff] [blame] | 93 | [$class: 'TextParameterValue', name: 'EXTRA_VARIABLES_YAML', |
azvyagintsev | 30bc82e | 2018-08-22 12:26:06 +0300 | [diff] [blame] | 94 | value : _values_string.stripIndent()], |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 95 | ] |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 96 | // Put sub-job info into global map. |
| 97 | testModelBuildsData.put(_uuid, ['jobname' : chunkJob.fullProjectName, |
| 98 | 'copyToDir': "${artifactCopyPath}/${modelFile}", |
| 99 | 'buildId' : "${chunkJob.number}"]) |
chnyda | bc63c9a | 2017-05-30 15:37:54 +0200 | [diff] [blame] | 100 | } |
| 101 | |
azvyagintsev | 0e503c7 | 2019-04-08 18:13:58 +0300 | [diff] [blame] | 102 | def StepTestModel(_basename, _reclassArtifactName, _artifactCopyPath, _useExtraRepos = false) { |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 103 | // We need to wrap what we return in a Groovy closure, or else it's invoked |
| 104 | // when this method is called, not when we pass it to parallel. |
| 105 | // To do this, you need to wrap the code below in { }, and either return |
| 106 | // that explicitly, or use { -> } syntax. |
| 107 | // return node object |
| 108 | return { |
| 109 | node(slaveNode) { |
azvyagintsev | 0e503c7 | 2019-04-08 18:13:58 +0300 | [diff] [blame] | 110 | testModel(_basename, _reclassArtifactName, _artifactCopyPath, _useExtraRepos) |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 111 | } |
chnyda | e80bb92 | 2017-05-29 17:48:40 +0200 | [diff] [blame] | 112 | } |
azvyagintsev | 8798553 | 2018-07-10 20:49:38 +0300 | [diff] [blame] | 113 | } |
| 114 | |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 115 | def StepPrepareGit(templateEnvFolder, gerrit_data) { |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 116 | // return git clone object |
| 117 | return { |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 118 | common.infoMsg("StepPrepareGit: ${gerrit_data}") |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 119 | // fetch needed sources |
| 120 | dir(templateEnvFolder) { |
azvyagintsev | 4f34f7a | 2019-02-26 18:47:37 +0200 | [diff] [blame] | 121 | if (!gerrit_data['gerritRefSpec']) { |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 122 | // Get clean HEAD |
| 123 | gerrit_data['useGerritTriggerBuildChooser'] = false |
Denis Egorenko | 80d45b2 | 2019-01-31 22:28:38 +0400 | [diff] [blame] | 124 | } |
| 125 | def checkouted = gerrit.gerritPatchsetCheckout(gerrit_data) |
| 126 | if (!checkouted) { |
| 127 | error("Failed to get repo:${gerrit_data}") |
azvyagintsev | 8798553 | 2018-07-10 20:49:38 +0300 | [diff] [blame] | 128 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 129 | } |
azvyagintsev | 8798553 | 2018-07-10 20:49:38 +0300 | [diff] [blame] | 130 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | def StepGenerateModels(_contextFileList, _virtualenv, _templateEnvDir) { |
| 134 | return { |
azvyagintsev | 0e503c7 | 2019-04-08 18:13:58 +0300 | [diff] [blame] | 135 | if (fileExists(new File(_templateEnvDir, 'tox.ini').toString())) { |
| 136 | // Merge contexts for nice base.yml based diff |
| 137 | dir(_templateEnvDir) { |
| 138 | sh('tox -ve merge_contexts') |
| 139 | } |
| 140 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 141 | for (contextFile in _contextFileList) { |
Denis Egorenko | f346909 | 2018-10-17 17:05:50 +0400 | [diff] [blame] | 142 | def basename = common.GetBaseName(contextFile, '.yml') |
azvyagintsev | 1385db9 | 2019-03-22 16:05:10 +0200 | [diff] [blame] | 143 | def contextYaml = readYaml text: readFile(file: "${_templateEnvDir}/contexts/${contextFile}") |
| 144 | // secrets_encryption overcomplicated for expected 'fast syntax tests' |
| 145 | // So, lets disable it. It would be tested only in generate-cookiecutter-products.groovy pipeline |
| 146 | if (contextYaml['default_context'].get('secrets_encryption_enabled')) { |
| 147 | common.warningMsg('Disabling secrets_encryption_enabled for tests!') |
| 148 | contextYaml['default_context']['secrets_encryption_enabled'] = 'False' |
| 149 | } |
azvyagintsev | 0e503c7 | 2019-04-08 18:13:58 +0300 | [diff] [blame] | 150 | |
Denis Egorenko | 5a7339c | 2019-09-26 12:14:59 +0400 | [diff] [blame] | 151 | // disabling strong_usernames for tests to reduce diff between head and patched model |
| 152 | common.warningMsg('Disabling strong_usernames for tests!') |
| 153 | contextYaml['default_context']['strong_usernames'] = 'False' |
| 154 | |
azvyagintsev | 0e503c7 | 2019-04-08 18:13:58 +0300 | [diff] [blame] | 155 | def context = mcpCommon.dumpYAML(contextYaml) |
azvyagintsev | 4f34f7a | 2019-02-26 18:47:37 +0200 | [diff] [blame] | 156 | if (!fileExists(new File(_templateEnvDir, 'tox.ini').toString())) { |
| 157 | common.warningMsg('Forming NEW reclass-root structure...') |
| 158 | python.generateModel(context, basename, 'cfg01', _virtualenv, "${_templateEnvDir}/model", _templateEnvDir) |
| 159 | } else { |
| 160 | // tox-based CC generated structure of reclass,from the root. Otherwise for bw compat, modelEnv |
| 161 | // still expect only lower lvl of project, aka model/classes/cluster/XXX/. So,lets dump result into |
| 162 | // temp dir, and then copy it over initial structure. |
| 163 | def reclassTempRootDir = sh(script: "mktemp -d -p ${env.WORKSPACE}", returnStdout: true).trim() |
| 164 | python.generateModel(context, basename, 'cfg01', _virtualenv, reclassTempRootDir, _templateEnvDir) |
| 165 | dir("${_templateEnvDir}/model/${basename}/") { |
| 166 | if (fileExists(new File(reclassTempRootDir, 'reclass').toString())) { |
| 167 | common.warningMsg('Forming NEW reclass-root structure...') |
| 168 | sh("cp -ra ${reclassTempRootDir}/reclass/* .") |
| 169 | } else { |
| 170 | // those hack needed only for period release/2019.2.0 => current patch. |
| 171 | common.warningMsg('Forming OLD reclass-root structure...') |
| 172 | sh("mkdir -p classes/cluster/ ; cd classes/cluster/; cp -ra ${reclassTempRootDir}/* .") |
| 173 | } |
| 174 | } |
| 175 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 176 | } |
| 177 | } |
| 178 | } |
| 179 | |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 180 | def globalVariatorsUpdate() { |
| 181 | // Simple function, to check and define branch-around variables |
| 182 | // In general, simply make transition updates for non-master branch |
| 183 | // based on magic logic |
Denis Egorenko | fe9a336 | 2018-10-17 15:33:25 +0400 | [diff] [blame] | 184 | def newline = '<br/>' |
| 185 | def messages = [] |
azvyagintsev | b266ad2 | 2018-09-11 12:11:11 +0300 | [diff] [blame] | 186 | if (env.GERRIT_PROJECT) { |
Denis Egorenko | fe9a336 | 2018-10-17 15:33:25 +0400 | [diff] [blame] | 187 | messages.add("<font color='red'>GerritTrigger detected! We are in auto-mode:</font>") |
| 188 | messages.add("Test env variables has been changed:") |
azvyagintsev | e0eb6cd | 2018-09-12 13:00:40 +0300 | [diff] [blame] | 189 | // TODO are we going to have such branches? |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 190 | if (!['nightly', 'testing', 'stable', 'proposed', 'master'].contains(env.GERRIT_BRANCH)) { |
| 191 | gerritDataCC['gerritBranch'] = env.GERRIT_BRANCH |
| 192 | gerritDataRS['gerritBranch'] = env.GERRIT_BRANCH |
azvyagintsev | 458278c | 2018-09-25 18:38:30 +0300 | [diff] [blame] | 193 | testDistribRevision = env.GERRIT_BRANCH |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 194 | } |
Denis Egorenko | 60e45c1 | 2018-11-12 12:00:11 +0400 | [diff] [blame] | 195 | messages.add("COOKIECUTTER_TEMPLATE_BRANCH => ${gerritDataCC['gerritBranch']}") |
| 196 | messages.add("RECLASS_SYSTEM_BRANCH => ${gerritDataRS['gerritBranch']}") |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 197 | // Identify, who triggered. To whom we should pass refspec |
| 198 | if (env.GERRIT_PROJECT == 'salt-models/reclass-system') { |
| 199 | gerritDataRS['gerritRefSpec'] = env.GERRIT_REFSPEC |
| 200 | gerritDataRS['GERRIT_CHANGE_NUMBER'] = env.GERRIT_CHANGE_NUMBER |
Denis Egorenko | fe9a336 | 2018-10-17 15:33:25 +0400 | [diff] [blame] | 201 | messages.add("RECLASS_SYSTEM_GIT_REF => ${gerritDataRS['gerritRefSpec']}") |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 202 | } else if (env.GERRIT_PROJECT == 'mk/cookiecutter-templates') { |
| 203 | gerritDataCC['gerritRefSpec'] = env.GERRIT_REFSPEC |
| 204 | gerritDataCC['GERRIT_CHANGE_NUMBER'] = env.GERRIT_CHANGE_NUMBER |
Denis Egorenko | fe9a336 | 2018-10-17 15:33:25 +0400 | [diff] [blame] | 205 | messages.add("COOKIECUTTER_TEMPLATE_REF => ${gerritDataCC['gerritRefSpec']}") |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 206 | } else { |
| 207 | error("Unsuported gerrit-project triggered:${env.GERRIT_PROJECT}") |
| 208 | } |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 209 | } else { |
Denis Egorenko | fe9a336 | 2018-10-17 15:33:25 +0400 | [diff] [blame] | 210 | messages.add("<font color='red'>Non-gerrit trigger run detected!</font>") |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 211 | } |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 212 | gerritDataCCHEAD << gerritDataCC |
| 213 | gerritDataCCHEAD['gerritRefSpec'] = null |
| 214 | gerritDataCCHEAD['GERRIT_CHANGE_NUMBER'] = null |
| 215 | gerritDataRSHEAD << gerritDataRS |
| 216 | gerritDataRSHEAD['gerritRefSpec'] = null |
| 217 | gerritDataRSHEAD['GERRIT_CHANGE_NUMBER'] = null |
azvyagintsev | 7d98281 | 2019-04-15 23:21:35 +0300 | [diff] [blame] | 218 | // check for test XXX vs RELEASE branch, to get correct formulas |
| 219 | if (gerritDataCC['gerritBranch'].contains('release/')) { |
| 220 | testDistribRevision = gerritDataCC['gerritBranch'] |
| 221 | } else if (gerritDataRS['gerritBranch'].contains('release')) { |
| 222 | testDistribRevision = gerritDataRS['gerritBranch'] |
| 223 | } |
azvyagintsev | 458278c | 2018-09-25 18:38:30 +0300 | [diff] [blame] | 224 | // 'binary' branch logic w\o 'release/' prefix |
| 225 | if (testDistribRevision.contains('/')) { |
Denis Egorenko | 19a793d | 2019-11-18 20:50:59 +0400 | [diff] [blame] | 226 | if (testDistribRevision.contains('proposed')) { |
| 227 | updatesVersion = 'proposed' |
| 228 | } |
Denis Egorenko | 14f0f0f | 2019-11-19 13:50:25 +0400 | [diff] [blame] | 229 | testDistribRevision = testDistribRevision.split('/')[-1] |
azvyagintsev | 458278c | 2018-09-25 18:38:30 +0300 | [diff] [blame] | 230 | } |
| 231 | // Check if we are going to test bleeding-edge release, which doesn't have binary release yet |
azvyagintsev | 5c200e7 | 2018-12-28 15:58:09 +0200 | [diff] [blame] | 232 | // After 2018q4 releases, need to also check 'static' repo, for example ubuntu. |
azvyagintsev | 4220bff | 2019-01-09 21:32:11 +0200 | [diff] [blame] | 233 | binTest = common.checkRemoteBinary(['mcp_version': testDistribRevision]) |
azvyagintsev | 5c200e7 | 2018-12-28 15:58:09 +0200 | [diff] [blame] | 234 | if (!binTest.linux_system_repo_url || !binTest.linux_system_repo_ubuntu_url) { |
| 235 | common.errorMsg("Binary release: ${testDistribRevision} not exist or not full. Fallback to 'proposed'! ") |
azvyagintsev | 458278c | 2018-09-25 18:38:30 +0300 | [diff] [blame] | 236 | testDistribRevision = 'proposed' |
azvyagintsev | 458278c | 2018-09-25 18:38:30 +0300 | [diff] [blame] | 237 | } |
azvyagintsev | 7d98281 | 2019-04-15 23:21:35 +0300 | [diff] [blame] | 238 | messages.add("DISTRIB_REVISION => ${testDistribRevision}") |
Denis Egorenko | fe9a336 | 2018-10-17 15:33:25 +0400 | [diff] [blame] | 239 | def message = messages.join(newline) + newline |
azvyagintsev | 458278c | 2018-09-25 18:38:30 +0300 | [diff] [blame] | 240 | currentBuild.description = currentBuild.description ? message + currentBuild.description : message |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 241 | } |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 242 | |
Denis Egorenko | a6117fc | 2018-09-11 13:40:00 +0400 | [diff] [blame] | 243 | def replaceGeneratedValues(path) { |
| 244 | def files = sh(script: "find ${path} -name 'secrets.yml'", returnStdout: true) |
| 245 | def stepsForParallel = [:] |
| 246 | stepsForParallel.failFast = true |
| 247 | files.tokenize().each { |
| 248 | stepsForParallel.put("Removing generated passwords/secrets from ${it}", |
| 249 | { |
| 250 | def secrets = readYaml file: it |
azvyagintsev | 08b34e3 | 2018-09-12 12:29:42 +0300 | [diff] [blame] | 251 | for (String key in secrets['parameters']['_param'].keySet()) { |
Denis Egorenko | a6117fc | 2018-09-11 13:40:00 +0400 | [diff] [blame] | 252 | secrets['parameters']['_param'][key] = 'generated' |
| 253 | } |
| 254 | // writeYaml can't write to already existing file |
| 255 | writeYaml file: "${it}.tmp", data: secrets |
| 256 | sh "mv ${it}.tmp ${it}" |
| 257 | }) |
| 258 | } |
| 259 | parallel stepsForParallel |
| 260 | } |
| 261 | |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 262 | def linkReclassModels(contextList, envPath, archiveName) { |
| 263 | // to be able share reclass for all subenvs |
| 264 | // Also, makes artifact test more solid - use one reclass for all of sub-models. |
| 265 | // Archive Structure will be: |
| 266 | // tar.gz |
| 267 | // ├── contexts |
| 268 | // │  └── ceph.yml |
Denis Egorenko | 7aa5ac5 | 2018-10-17 15:14:56 +0400 | [diff] [blame] | 269 | // ├── classes-system <<< reclass system |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 270 | // ├── model |
| 271 | // │  └── ceph <<< from `context basename` |
| 272 | // │  ├── classes |
| 273 | // │  │  ├── cluster |
Denis Egorenko | 7aa5ac5 | 2018-10-17 15:14:56 +0400 | [diff] [blame] | 274 | // │  │  └── system -> ../../../classes-system |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 275 | // │  └── nodes |
| 276 | // │  └── cfg01.ceph-cluster-domain.local.yml |
Denis Egorenko | 7aa5ac5 | 2018-10-17 15:14:56 +0400 | [diff] [blame] | 277 | def archiveBaseName = common.GetBaseName(archiveName, '.tar.gz') |
| 278 | def classesSystemDir = 'classes-system' |
| 279 | // copy reclass system under envPath with -R and trailing / to support symlinks direct copy |
| 280 | sh("cp -R ${archiveBaseName}/ ${envPath}/${classesSystemDir}") |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 281 | dir(envPath) { |
azvyagintsev | 0e503c7 | 2019-04-08 18:13:58 +0300 | [diff] [blame] | 282 | for (String _context : contextList) { |
| 283 | def basename = common.GetBaseName(_context, '.yml') |
Denis Egorenko | 7aa5ac5 | 2018-10-17 15:14:56 +0400 | [diff] [blame] | 284 | dir("${envPath}/model/${basename}/classes") { |
| 285 | sh(script: "ln -sfv ../../../${classesSystemDir} system ") |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 286 | } |
| 287 | } |
Denis Egorenko | a6117fc | 2018-09-11 13:40:00 +0400 | [diff] [blame] | 288 | // replace all generated passwords/secrets/keys with hardcode value for infra/secrets.yaml |
| 289 | replaceGeneratedValues("${envPath}/model") |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 290 | // Save all models and all contexts. Warning! `h` flag must be used! |
Denis Egorenko | 7aa5ac5 | 2018-10-17 15:14:56 +0400 | [diff] [blame] | 291 | sh(script: "set -ex; tar -czhf ${env.WORKSPACE}/${archiveName} --exclude='*@tmp' contexts model ${classesSystemDir}", returnStatus: true) |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 292 | } |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 293 | archiveArtifacts artifacts: archiveName |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 294 | } |
| 295 | |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 296 | timeout(time: 1, unit: 'HOURS') { |
| 297 | node(slaveNode) { |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 298 | globalVariatorsUpdate() |
azvyagintsev | 30bc82e | 2018-08-22 12:26:06 +0300 | [diff] [blame] | 299 | def templateEnvHead = "${env.WORKSPACE}/EnvHead/" |
| 300 | def templateEnvPatched = "${env.WORKSPACE}/EnvPatched/" |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 301 | def contextFileListHead = [] |
| 302 | def contextFileListPatched = [] |
| 303 | def vEnv = "${env.WORKSPACE}/venv" |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 304 | def headReclassArtifactName = "head_reclass.tar.gz" |
| 305 | def patchedReclassArtifactName = "patched_reclass.tar.gz" |
| 306 | def reclassNodeInfoDir = "${env.WORKSPACE}/reclassNodeInfo_compare/" |
| 307 | def reclassInfoHeadPath = "${reclassNodeInfoDir}/old" |
| 308 | def reclassInfoPatchedPath = "${reclassNodeInfoDir}/new" |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 309 | try { |
| 310 | sh(script: 'find . -mindepth 1 -delete > /dev/null || true') |
| 311 | stage('Download and prepare CC env') { |
| 312 | // Prepare 2 env - for patchset, and for HEAD |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 313 | def paralellEnvs = [:] |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 314 | paralellEnvs.failFast = true |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 315 | paralellEnvs['downloadEnvHead'] = StepPrepareGit(templateEnvHead, gerritDataCCHEAD) |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 316 | if (gerritDataCC.get('gerritRefSpec', null)) { |
| 317 | paralellEnvs['downloadEnvPatched'] = StepPrepareGit(templateEnvPatched, gerritDataCC) |
| 318 | parallel paralellEnvs |
| 319 | } else { |
| 320 | paralellEnvs['downloadEnvPatched'] = { common.warningMsg('No need to process: downloadEnvPatched') } |
| 321 | parallel paralellEnvs |
| 322 | sh("rsync -a --exclude '*@tmp' ${templateEnvHead} ${templateEnvPatched}") |
| 323 | } |
Denis Egorenko | 3de070c | 2018-11-20 13:57:35 +0400 | [diff] [blame] | 324 | if (env.CUSTOM_COOKIECUTTER_CONTEXT) { |
| 325 | // readYaml to check custom context structure |
| 326 | def customContext = readYaml text: env.CUSTOM_COOKIECUTTER_CONTEXT |
| 327 | writeYaml file: "${templateEnvHead}/contexts/custom_context.yml", data: customContext |
| 328 | writeYaml file: "${templateEnvPatched}/contexts/custom_context.yml", data: customContext |
| 329 | common.infoMsg("Using custom context provided from job parameter 'CUSTOM_COOKIECUTTER_CONTEXT'") |
| 330 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 331 | } |
azvyagintsev | 8ab34fd | 2019-01-10 15:32:26 +0200 | [diff] [blame] | 332 | stage('Check workflow_definition') { |
| 333 | // Prepare venv for old env's, aka non-tox based |
| 334 | if (!fileExists(new File(templateEnvPatched, 'tox.ini').toString()) || !fileExists(new File(templateEnvHead, 'tox.ini').toString())) { |
| 335 | python.setupVirtualenv(vEnv, 'python2', [], "${templateEnvPatched}/requirements.txt") |
| 336 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 337 | // Check only for patchset |
azvyagintsev | 1037fb4 | 2019-01-10 13:52:38 +0200 | [diff] [blame] | 338 | if (fileExists(new File(templateEnvPatched, 'tox.ini').toString())) { |
| 339 | dir(templateEnvPatched) { |
| 340 | output = sh(returnStdout: true, script: "tox -ve test") |
| 341 | common.infoMsg("[Cookiecutter test] Result: ${output}") |
azvyagintsev | 4220bff | 2019-01-09 21:32:11 +0200 | [diff] [blame] | 342 | } |
azvyagintsev | 1037fb4 | 2019-01-10 13:52:38 +0200 | [diff] [blame] | 343 | |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 344 | } else { |
azvyagintsev | 1037fb4 | 2019-01-10 13:52:38 +0200 | [diff] [blame] | 345 | common.warningMsg('Old Cookiecutter env detected!') |
azvyagintsev | 1037fb4 | 2019-01-10 13:52:38 +0200 | [diff] [blame] | 346 | common.infoMsg(python.runVirtualenvCommand(vEnv, "python ${templateEnvPatched}/workflow_definition_test.py")) |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 347 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 348 | } |
| 349 | |
azvyagintsev | 8ab34fd | 2019-01-10 15:32:26 +0200 | [diff] [blame] | 350 | stage('generate models') { |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 351 | dir("${templateEnvHead}/contexts") { |
| 352 | for (String x : findFiles(glob: "*.yml")) { |
| 353 | contextFileListHead.add(x) |
| 354 | } |
| 355 | } |
| 356 | dir("${templateEnvPatched}/contexts") { |
| 357 | for (String x : findFiles(glob: "*.yml")) { |
| 358 | contextFileListPatched.add(x) |
| 359 | } |
| 360 | } |
| 361 | // Generate over 2env's - for patchset, and for HEAD |
azvyagintsev | 9df82e5 | 2018-09-06 19:17:18 +0300 | [diff] [blame] | 362 | def paralellEnvs = [:] |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 363 | paralellEnvs.failFast = true |
azvyagintsev | 30bc82e | 2018-08-22 12:26:06 +0300 | [diff] [blame] | 364 | paralellEnvs['GenerateEnvHead'] = StepGenerateModels(contextFileListHead, vEnv, templateEnvHead) |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 365 | if (gerritDataCC.get('gerritRefSpec', null)) { |
| 366 | paralellEnvs['GenerateEnvPatched'] = StepGenerateModels(contextFileListPatched, vEnv, templateEnvPatched) |
| 367 | parallel paralellEnvs |
| 368 | } else { |
| 369 | paralellEnvs['GenerateEnvPatched'] = { common.warningMsg('No need to process: GenerateEnvPatched') } |
| 370 | parallel paralellEnvs |
| 371 | sh("rsync -a --exclude '*@tmp' ${templateEnvHead} ${templateEnvPatched}") |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 372 | } |
| 373 | |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 374 | // We need 2 git's, one for HEAD, one for PATCHed. |
| 375 | // if no patch, use head for both |
| 376 | RSHeadDir = common.GetBaseName(headReclassArtifactName, '.tar.gz') |
| 377 | RSPatchedDir = common.GetBaseName(patchedReclassArtifactName, '.tar.gz') |
| 378 | common.infoMsg("gerritDataRS= ${gerritDataRS}") |
| 379 | common.infoMsg("gerritDataRSHEAD= ${gerritDataRSHEAD}") |
| 380 | if (gerritDataRS.get('gerritRefSpec', null)) { |
| 381 | StepPrepareGit("${env.WORKSPACE}/${RSPatchedDir}/", gerritDataRS).call() |
| 382 | StepPrepareGit("${env.WORKSPACE}/${RSHeadDir}/", gerritDataRSHEAD).call() |
| 383 | } else { |
| 384 | StepPrepareGit("${env.WORKSPACE}/${RSHeadDir}/", gerritDataRS).call() |
| 385 | sh("cd ${env.WORKSPACE} ; ln -svf ${RSHeadDir} ${RSPatchedDir}") |
| 386 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 387 | // link all models, to use one global reclass |
| 388 | // For HEAD |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 389 | linkReclassModels(contextFileListHead, templateEnvHead, headReclassArtifactName) |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 390 | // For patched |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 391 | linkReclassModels(contextFileListPatched, templateEnvPatched, patchedReclassArtifactName) |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 392 | } |
| 393 | |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 394 | stage("Compare cluster lvl Head/Patched") { |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 395 | // Compare patched and HEAD reclass pillars |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 396 | compareRoot = "${env.WORKSPACE}/cluster_compare/" |
Denis Egorenko | 7aa5ac5 | 2018-10-17 15:14:56 +0400 | [diff] [blame] | 397 | // extract archive and drop all copied classes/system before comparing |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 398 | sh(script: """ |
| 399 | mkdir -pv ${compareRoot}/new ${compareRoot}/old |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 400 | tar -xzf ${patchedReclassArtifactName} --directory ${compareRoot}/new |
| 401 | tar -xzf ${headReclassArtifactName} --directory ${compareRoot}/old |
Denis Egorenko | 7aa5ac5 | 2018-10-17 15:14:56 +0400 | [diff] [blame] | 402 | find ${compareRoot} -name classes -type d -exec rm -rf '{}/system' \\; |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 403 | """) |
| 404 | common.warningMsg('infra/secrets.yml has been skipped from compare!') |
azvyagintsev | 3a80e34 | 2018-09-19 19:22:48 +0300 | [diff] [blame] | 405 | result = '\n' + common.comparePillars(compareRoot, env.BUILD_URL, "-Ev \'infra/secrets.yml|\\.git\'") |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 406 | currentBuild.description = currentBuild.description ? currentBuild.description + result : result |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 407 | } |
azvyagintsev | 7d98281 | 2019-04-15 23:21:35 +0300 | [diff] [blame] | 408 | stage('TestContexts Head/Patched') { |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 409 | def stepsForParallel = [:] |
| 410 | stepsForParallel.failFast = true |
| 411 | common.infoMsg("Found: ${contextFileListHead.size()} HEAD contexts to test.") |
| 412 | for (String context : contextFileListHead) { |
| 413 | def basename = common.GetBaseName(context, '.yml') |
| 414 | stepsForParallel.put("ContextHeadTest:${basename}", StepTestModel(basename, headReclassArtifactName, reclassInfoHeadPath)) |
| 415 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 416 | common.infoMsg("Found: ${contextFileListPatched.size()} patched contexts to test.") |
| 417 | for (String context : contextFileListPatched) { |
| 418 | def basename = common.GetBaseName(context, '.yml') |
Denis Egorenko | 086aff1 | 2018-10-18 17:54:59 +0400 | [diff] [blame] | 419 | stepsForParallel.put("ContextPatchedTest:${basename}", StepTestModel(basename, patchedReclassArtifactName, reclassInfoPatchedPath, true)) |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 420 | } |
| 421 | parallel stepsForParallel |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 422 | common.infoMsg('All TestContexts tests done') |
| 423 | } |
azvyagintsev | 7d98281 | 2019-04-15 23:21:35 +0300 | [diff] [blame] | 424 | stage('Compare NodesInfo Head/Patched') { |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 425 | // Download all artifacts |
| 426 | def stepsForParallel = [:] |
| 427 | stepsForParallel.failFast = true |
| 428 | common.infoMsg("Found: ${testModelBuildsData.size()} nodeinfo artifacts to download.") |
| 429 | testModelBuildsData.each { bname, bdata -> |
| 430 | stepsForParallel.put("FetchData:${bname}", |
| 431 | getAndUnpackNodesInfoArtifact(bdata.jobname, bdata.copyToDir, bdata.buildId)) |
| 432 | } |
| 433 | parallel stepsForParallel |
Denis Egorenko | a6117fc | 2018-09-11 13:40:00 +0400 | [diff] [blame] | 434 | // remove timestamp field from rendered files |
| 435 | sh("find ${reclassNodeInfoDir} -type f -exec sed -i '/ timestamp: .*/d' {} \\;") |
Denis Egorenko | d874894 | 2018-09-07 12:26:20 +0400 | [diff] [blame] | 436 | // Compare patched and HEAD reclass pillars |
| 437 | result = '\n' + common.comparePillars(reclassNodeInfoDir, env.BUILD_URL, '') |
| 438 | currentBuild.description = currentBuild.description ? currentBuild.description + result : result |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 439 | } |
Denis Egorenko | 04ca9f2 | 2018-09-19 16:06:49 +0400 | [diff] [blame] | 440 | stage('Check include order') { |
azvyagintsev | e7b8e79 | 2018-09-21 17:27:01 +0300 | [diff] [blame] | 441 | if (!checkIncludeOrder) { |
| 442 | common.infoMsg('Check include order require to much time, and currently disabled!') |
| 443 | |
| 444 | } else { |
| 445 | def correctIncludeOrder = ["service", "system", "cluster"] |
| 446 | dir(reclassInfoPatchedPath) { |
| 447 | def nodeInfoFiles = findFiles(glob: "**/*.reclass.nodeinfo") |
| 448 | def messages = ["<b>Wrong include ordering found</b><ul>"] |
| 449 | def stepsForParallel = [:] |
| 450 | nodeInfoFiles.each { nodeInfo -> |
| 451 | stepsForParallel.put("Checking ${nodeInfo.path}:", { |
| 452 | def node = readYaml file: nodeInfo.path |
| 453 | def classes = node['classes'] |
| 454 | def curClassID = 0 |
| 455 | def prevClassID = 0 |
| 456 | def wrongOrder = false |
| 457 | for (String className in classes) { |
| 458 | def currentClass = className.tokenize('.')[0] |
| 459 | curClassID = correctIncludeOrder.indexOf(currentClass) |
| 460 | if (currentClass != correctIncludeOrder[prevClassID]) { |
| 461 | if (prevClassID > curClassID) { |
| 462 | wrongOrder = true |
| 463 | common.warningMsg("File ${nodeInfo.path} contains wrong order of classes including: Includes for ${className} should be declared before ${correctIncludeOrder[prevClassID]} includes") |
| 464 | } else { |
| 465 | prevClassID = curClassID |
| 466 | } |
Denis Egorenko | 04ca9f2 | 2018-09-19 16:06:49 +0400 | [diff] [blame] | 467 | } |
| 468 | } |
azvyagintsev | e7b8e79 | 2018-09-21 17:27:01 +0300 | [diff] [blame] | 469 | if (wrongOrder) { |
| 470 | messages.add("<li>${nodeInfo.path} contains wrong order of classes including</li>") |
| 471 | } |
| 472 | }) |
| 473 | } |
| 474 | parallel stepsForParallel |
| 475 | def includerOrder = '<b>No wrong include order</b>' |
| 476 | if (messages.size() != 1) { |
| 477 | includerOrder = messages.join('') |
| 478 | } |
| 479 | currentBuild.description = currentBuild.description ? currentBuild.description + includerOrder : includerOrder |
Denis Egorenko | 04ca9f2 | 2018-09-19 16:06:49 +0400 | [diff] [blame] | 480 | } |
Denis Egorenko | 04ca9f2 | 2018-09-19 16:06:49 +0400 | [diff] [blame] | 481 | } |
| 482 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 483 | sh(script: 'find . -mindepth 1 -delete > /dev/null || true') |
| 484 | |
| 485 | } catch (Throwable e) { |
| 486 | currentBuild.result = "FAILURE" |
| 487 | currentBuild.description = currentBuild.description ? e.message + " " + currentBuild.description : e.message |
| 488 | throw e |
| 489 | } finally { |
Denis Egorenko | 34c4a3b | 2019-03-12 12:48:15 +0400 | [diff] [blame] | 490 | stage('Save artifacts to Artifactory') { |
| 491 | def artifactory = new com.mirantis.mcp.MCPArtifactory() |
Denis Egorenko | 4be215f | 2021-01-20 13:35:22 +0400 | [diff] [blame] | 492 | def artifactoryLink = artifactory.uploadJobArtifactsToArtifactory(['artifactory': 'mcp-ci', 'artifactoryRepo': "artifactory/drivetrain-local/${JOB_NAME}/${BUILD_NUMBER}"]) |
Denis Egorenko | 34c4a3b | 2019-03-12 12:48:15 +0400 | [diff] [blame] | 493 | currentBuild.description += "<br/>${artifactoryLink}" |
| 494 | } |
azvyagintsev | 5c0313d | 2018-08-13 17:13:35 +0300 | [diff] [blame] | 495 | } |
| 496 | } |
chnyda | e80bb92 | 2017-05-29 17:48:40 +0200 | [diff] [blame] | 497 | } |
azvyagintsev | 7d98281 | 2019-04-15 23:21:35 +0300 | [diff] [blame] | 498 | |