blob: 2d8c8e874533f0245b7064c948176865bcd4ed78 [file] [log] [blame]
Petr Lomakin47fee0a2017-08-01 10:46:05 -07001package com.mirantis.mcp
2
3/**
4 *
5 * Tests providing functions
6 *
7 */
8
9/**
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -060010 * Run docker container with basic (keystone) parameters
Petr Lomakin47fee0a2017-08-01 10:46:05 -070011 *
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -060012 * @param target Host to run container
13 * @param dockerImageLink Docker image link. May be custom or default rally image
Petr Lomakin47fee0a2017-08-01 10:46:05 -070014 */
Oleksii Zhurba1bf9be12018-01-17 15:20:00 -060015def runBasicContainer(master, target, dockerImageLink="xrally/xrally-openstack:0.9.1"){
Petr Lomakin47fee0a2017-08-01 10:46:05 -070016 def salt = new com.mirantis.mk.Salt()
17 def common = new com.mirantis.mk.Common()
Sam Stoelinga28bdb722017-09-25 18:29:59 -070018 def _pillar = salt.getPillar(master, 'I@keystone:server', 'keystone:server')
19 def keystone = _pillar['return'][0].values()[0]
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -060020 if ( salt.cmdRun(master, target, "docker ps -f name=cvp -q", false, null, false)['return'][0].values()[0] ) {
21 salt.cmdRun(master, target, "docker rm -f cvp")
22 }
23 salt.cmdRun(master, target, "docker run -tid --net=host --name=cvp " +
24 "-u root -e OS_USERNAME=${keystone.admin_name} " +
Petr Lomakin47fee0a2017-08-01 10:46:05 -070025 "-e OS_PASSWORD=${keystone.admin_password} -e OS_TENANT_NAME=${keystone.admin_tenant} " +
26 "-e OS_AUTH_URL=http://${keystone.bind.private_address}:${keystone.bind.private_port}/v2.0 " +
Oleksii Zhurba1bf9be12018-01-17 15:20:00 -060027 "-e OS_REGION_NAME=${keystone.region} -e OS_ENDPOINT_TYPE=admin --entrypoint /bin/bash ${dockerImageLink}")
Petr Lomakin47fee0a2017-08-01 10:46:05 -070028}
29
30/**
Dmitrii Kabanov23901c22017-10-20 10:25:36 -070031 * Get file content (encoded). The content encoded by Base64.
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -070032 *
33 * @param target Compound target (should target only one host)
34 * @param file File path to read
Dmitrii Kabanov23901c22017-10-20 10:25:36 -070035 * @return The encoded content of the file
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -070036 */
Dmitrii Kabanov23901c22017-10-20 10:25:36 -070037def getFileContentEncoded(master, target, file) {
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -070038 def salt = new com.mirantis.mk.Salt()
Dmitrii Kabanov23901c22017-10-20 10:25:36 -070039 def file_content = ''
40 def cmd = "base64 -w0 ${file} > ${file}_encoded; " +
41 "split -b 1MB -d ${file}_encoded ${file}__; " +
42 "rm ${file}_encoded"
43 salt.cmdRun(master, target, cmd, false, null, false)
44 def filename = file.tokenize('/').last()
45 def folder = file - filename
46 def parts = salt.runSaltProcessStep(master, target, 'file.find', ["${folder}", "type=f", "name=${filename}__*"])
47 for ( part in parts['return'][0].values()[0]) {
48 def _result = salt.cmdRun(master, target, "cat ${part}", false, null, false)
49 file_content = file_content + _result['return'][0].values()[0].replaceAll('Salt command execution success','')
50 }
51 salt.runSaltProcessStep(master, target, 'file.find', ["${folder}", "type=f", "name=${filename}__*", "delete"])
52 return file_content
53}
54
55/**
56 * Copy files from remote to local directory. The content of files will be
57 * decoded by Base64.
58 *
59 * @param target Compound target (should target only one host)
60 * @param folder The path to remote folder.
61 * @param output_dir The path to local folder.
62 */
63def addFiles(master, target, folder, output_dir) {
64 def salt = new com.mirantis.mk.Salt()
65 def _result = salt.runSaltProcessStep(master, target, 'file.find', ["${folder}", "type=f"])
66 def files = _result['return'][0].values()[0]
67 for (file in files) {
68 def file_content = getFileContentEncoded(master, target, "${file}")
69 def fileName = file.tokenize('/').last()
70 writeFile file: "${output_dir}${fileName}_encoded", text: file_content
71 def cmd = "base64 -d ${output_dir}${fileName}_encoded > ${output_dir}${fileName}; " +
72 "rm ${output_dir}${fileName}_encoded"
73 sh(script: cmd)
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -070074 }
75}
76
77/**
78 * Get reclass value
79 *
80 * @param target The host for which the values will be provided
81 * @param filter Parameters divided by dots
82 * @return The pillar data
83 */
84def getReclassValue(master, target, filter) {
85 def common = new com.mirantis.mk.Common()
86 def salt = new com.mirantis.mk.Salt()
87 def items = filter.tokenize('.')
Dmitrii Kabanov23901c22017-10-20 10:25:36 -070088 def _result = salt.cmdRun(master, 'I@salt:master', "reclass-salt -o json -p ${target}", false, null, false)
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -070089 _result = common.parseJSON(_result['return'][0].values()[0])
Dmitrii Kabanov23901c22017-10-20 10:25:36 -070090 for (int k = 0; k < items.size(); k++) {
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -070091 if ( _result ) {
Dmitrii Kabanov23901c22017-10-20 10:25:36 -070092 _result = _result["${items[k]}"]
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -070093 }
94 }
95 return _result
96}
97
98/**
99 * Create list of nodes in JSON format.
100 *
101 * @param filter The Salt's matcher
102 * @return JSON list of nodes
103 */
104def getNodeList(master, filter = null) {
105 def salt = new com.mirantis.mk.Salt()
106 def common = new com.mirantis.mk.Common()
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700107 def nodes = []
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700108 def filtered_list = null
109 def controllers = salt.getMinions(master, 'I@nova:controller')
110 def hw_nodes = salt.getMinions(master, 'G@virtual:physical')
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700111 if ( filter ) {
112 filtered_list = salt.getMinions(master, filter)
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700113 }
114 def _result = salt.cmdRun(master, 'I@salt:master', "reclass-salt -o json -t", false, null, false)
115 def reclass_top = common.parseJSON(_result['return'][0].values()[0])
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700116 def nodesList = reclass_top['base'].keySet()
117 for (int i = 0; i < nodesList.size(); i++) {
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700118 if ( filtered_list ) {
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700119 if ( ! filtered_list.contains(nodesList[i]) ) {
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700120 continue
121 }
122 }
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700123 def ip = getReclassValue(master, nodesList[i], '_param.linux_single_interface.address')
124 def network_data = [ip: ip, name: 'management']
125 def roles = [nodesList[i].tokenize('.')[0]]
126 if ( controllers.contains(nodesList[i]) ) {
127 roles.add('controller')
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700128 }
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700129 if ( hw_nodes.contains(nodesList[i]) ) {
130 roles.add('hw_node')
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700131 }
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700132 nodes.add([id: i+1, ip: ip, roles: roles, network_data: [network_data]])
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700133 }
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700134 return common.prettify(nodes)
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700135}
136
Oleksii Zhurbabcb97e22017-10-05 14:10:39 -0500137/**
138 * Execute mcp sanity tests
139 *
140 * @param salt_url Salt master url
141 * @param salt_credentials Salt credentials
142 * @param test_set Test set for mcp sanity framework
Oleksii Zhurba0a7b0702017-11-10 16:02:16 -0600143 * @param env_vars Additional environment variables for cvp-sanity-checks
Oleksii Zhurbabcb97e22017-10-05 14:10:39 -0500144 * @param output_dir Directory for results
145 */
Oleksii Zhurba0a7b0702017-11-10 16:02:16 -0600146def runSanityTests(salt_url, salt_credentials, test_set="", output_dir="validation_artifacts/", env_vars="") {
Oleksii Zhurbabcb97e22017-10-05 14:10:39 -0500147 def common = new com.mirantis.mk.Common()
Oleksii Zhurba0a7b0702017-11-10 16:02:16 -0600148 def creds = common.getCredentials(salt_credentials)
149 def username = creds.username
150 def password = creds.password
151 def settings = ""
152 if ( env_vars != "" ) {
153 for (var in env_vars.tokenize(";")) {
154 settings += "export ${var}; "
155 }
156 }
157 def script = ". ${env.WORKSPACE}/venv/bin/activate; ${settings}" +
Oleksii Zhurba5250a9c2018-03-21 15:47:03 -0500158 "pytest --junitxml ${output_dir}cvp_sanity.xml --tb=short -sv ${env.WORKSPACE}/cvp-sanity-checks/cvp_checks/tests/${test_set}"
Oleksii Zhurbabcb97e22017-10-05 14:10:39 -0500159 withEnv(["SALT_USERNAME=${username}", "SALT_PASSWORD=${password}", "SALT_URL=${salt_url}"]) {
160 def statusCode = sh script:script, returnStatus:true
161 }
162}
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700163
164/**
Oleksii Zhurba4e366ff2018-02-16 20:06:52 -0600165 * Execute pytest framework tests
166 *
167 * @param salt_url Salt master url
168 * @param salt_credentials Salt credentials
169 * @param test_set Test set to run
170 * @param env_vars Additional environment variables for cvp-sanity-checks
171 * @param output_dir Directory for results
172 */
173def runTests(salt_url, salt_credentials, test_set="", output_dir="validation_artifacts/", env_vars="") {
174 def common = new com.mirantis.mk.Common()
175 def creds = common.getCredentials(salt_credentials)
176 def username = creds.username
177 def password = creds.password
178 def settings = ""
179 if ( env_vars != "" ) {
180 for (var in env_vars.tokenize(";")) {
181 settings += "export ${var}; "
182 }
183 }
184 def script = ". ${env.WORKSPACE}/venv/bin/activate; ${settings}" +
185 "pytest --junitxml ${output_dir}report.xml --tb=short -sv ${env.WORKSPACE}/${test_set}"
186 withEnv(["SALT_USERNAME=${username}", "SALT_PASSWORD=${password}", "SALT_URL=${salt_url}"]) {
187 def statusCode = sh script:script, returnStatus:true
188 }
189}
190
191/**
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700192 * Execute tempest tests
193 *
194 * @param target Host to run tests
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700195 * @param dockerImageLink Docker image link
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700196 * @param pattern If not false, will run only tests matched the pattern
197 * @param output_dir Directory for results
Dmitrii Kabanov999fda92017-11-10 00:18:30 -0800198 * @param confRepository Git repository with configuration files for Tempest
199 * @param confBranch Git branch which will be used during the checkout
200 * @param repository Git repository with Tempest
201 * @param version Version of Tempest (tag, branch or commit)
Sergey Galkind1068e22018-02-13 13:59:32 +0400202 * @param results The reports directory
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700203 */
Sergey Galkind1068e22018-02-13 13:59:32 +0400204def runTempestTests(master, target, dockerImageLink, output_dir, confRepository, confBranch, repository, version, pattern = "false", results = '/root/qa_results') {
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700205 def salt = new com.mirantis.mk.Salt()
206 def output_file = 'docker-tempest.log'
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700207 def dest_folder = '/home/rally/qa_results'
Dmitrii Kabanov999fda92017-11-10 00:18:30 -0800208 def skip_list = '--skip-list /opt/devops-qa-tools/deployment/skip_contrail.list'
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700209 salt.runSaltProcessStep(master, target, 'file.remove', ["${results}"])
210 salt.runSaltProcessStep(master, target, 'file.mkdir', ["${results}", "mode=777"])
211 def _pillar = salt.getPillar(master, 'I@keystone:server', 'keystone:server')
212 def keystone = _pillar['return'][0].values()[0]
Dmitry Tsapikovb6911922018-07-24 15:21:23 +0000213 def env_vars = ['tempest_version=15.0.0',
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700214 "OS_USERNAME=${keystone.admin_name}",
215 "OS_PASSWORD=${keystone.admin_password}",
216 "OS_TENANT_NAME=${keystone.admin_tenant}",
217 "OS_AUTH_URL=http://${keystone.bind.private_address}:${keystone.bind.private_port}/v2.0",
218 "OS_REGION_NAME=${keystone.region}",
219 'OS_ENDPOINT_TYPE=admin'].join(' -e ')
220 def cmd = '/opt/devops-qa-tools/deployment/configure.sh; '
Dmitrii Kabanov999fda92017-11-10 00:18:30 -0800221 if (confRepository != '' ) {
222 cmd = "git clone -b ${confBranch ?: 'master'} ${confRepository} test_config; " +
223 'rally deployment create --fromenv --name=tempest; rally deployment config; ' +
224 'rally verify create-verifier --name tempest_verifier --type tempest ' +
Dmitry Tsapikovb6911922018-07-24 15:21:23 +0000225 "--source ${repository ?: '/tmp/tempest/'} --version ${version: '15.0.0'}; " +
Dmitrii Kabanov999fda92017-11-10 00:18:30 -0800226 'rally verify configure-verifier --extend test_config/tempest/tempest.conf --show; '
227 skip_list = '--skip-list test_config/tempest/skip-list.yaml'
228 }
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700229 if (pattern == 'false') {
Dmitrii Kabanov999fda92017-11-10 00:18:30 -0800230 cmd += "rally verify start --pattern set=full ${skip_list} --detailed; "
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700231 }
232 else {
Dmitrii Kabanov999fda92017-11-10 00:18:30 -0800233 cmd += "rally verify start --pattern set=${pattern} ${skip_list} --detailed; "
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700234 }
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700235 cmd += "rally verify report --type json --to ${dest_folder}/report-tempest.json; " +
236 "rally verify report --type html --to ${dest_folder}/report-tempest.html"
mkraynovd49daf52018-07-12 16:11:14 +0400237 salt.cmdRun(master, target, "docker run -w /home/rally -i --rm --net=host -e ${env_vars} " +
Sergey Galkin193ef872017-11-29 14:20:35 +0400238 "-v ${results}:${dest_folder} --entrypoint /bin/bash ${dockerImageLink} " +
239 "-c \"${cmd}\" > ${results}/${output_file}")
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700240 addFiles(master, target, results, output_dir)
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700241}
242
243/**
244 * Execute rally tests
245 *
246 * @param target Host to run tests
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700247 * @param dockerImageLink Docker image link
Oleg Basov20afb152018-06-10 03:09:25 +0200248 * @param platform What do we have underneath (openstack/k8s)
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700249 * @param output_dir Directory for results
Dmitrii Kabanov999fda92017-11-10 00:18:30 -0800250 * @param repository Git repository with files for Rally
251 * @param branch Git branch which will be used during the checkout
Oleg Basov20afb152018-06-10 03:09:25 +0200252 * @param scenarios Directory inside repo with specific scenarios
253 * @param tasks_args_file Argument file that is used for throttling settings
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700254 * @param ext_variables The list of external variables
Sergey Galkind1068e22018-02-13 13:59:32 +0400255 * @param results The reports directory
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700256 */
mkraynovc6e0bb62018-08-07 11:01:23 +0400257def runRallyTests(master, target, dockerImageLink, platform, output_dir, repository, branch, scenarios = '', tasks_args_file = '', ext_variables = [], results = '/root/qa_results', skip_list = '') {
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700258 def salt = new com.mirantis.mk.Salt()
259 def output_file = 'docker-rally.log'
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700260 def dest_folder = '/home/rally/qa_results'
Oleg Basov20afb152018-06-10 03:09:25 +0200261 def env_vars = []
262 def rally_extra_args = ''
263 def cmd_rally_init = ''
264 def cmd_rally_checkout = ''
265 def cmd_rally_start = ''
266 def cmd_rally_task_args = ''
267 def cmd_report = "rally task export --type junit-xml --to ${dest_folder}/report-rally.xml; " +
268 "rally task report --out ${dest_folder}/report-rally.html"
mkraynovc6e0bb62018-08-07 11:01:23 +0400269 def cmd_skip_names = ''
270 def cmd_skip_dirs = ''
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700271 salt.runSaltProcessStep(master, target, 'file.remove', ["${results}"])
272 salt.runSaltProcessStep(master, target, 'file.mkdir', ["${results}", "mode=777"])
Oleg Basov20afb152018-06-10 03:09:25 +0200273 if (platform == 'openstack') {
274 def _pillar = salt.getPillar(master, 'I@keystone:server', 'keystone:server')
275 def keystone = _pillar['return'][0].values()[0]
276 env_vars = ( ['tempest_version=15.0.0',
277 "OS_USERNAME=${keystone.admin_name}",
278 "OS_PASSWORD=${keystone.admin_password}",
279 "OS_TENANT_NAME=${keystone.admin_tenant}",
280 "OS_AUTH_URL=http://${keystone.bind.private_address}:${keystone.bind.private_port}/v2.0",
281 "OS_REGION_NAME=${keystone.region}",
282 'OS_ENDPOINT_TYPE=admin'] + ext_variables ).join(' -e ')
283 if (repository == '' ) {
284 cmd_rally_init = ''
285 cmd_rally_start = '/opt/devops-qa-tools/deployment/configure.sh; ' +
286 "rally $rally_extra_args task start combined_scenario.yaml " +
287 '--task-args-file /opt/devops-qa-tools/rally-scenarios/task_arguments.yaml; '
288 cmd_rally_checkout = ''
289 } else {
290 cmd_rally_init = 'rally db create; ' +
Sergey Galkinf89509d2018-03-19 15:24:17 +0400291 'rally deployment create --fromenv --name=existing; ' +
Sergey Galkinea53f922017-11-29 19:11:54 +0400292 'rally deployment config; '
Oleg Basov20afb152018-06-10 03:09:25 +0200293 cmd_rally_checkout = "git clone -b ${branch ?: 'master'} ${repository} test_config; "
mkraynovc6e0bb62018-08-07 11:01:23 +0400294 if (skip_list != ''){
295 for ( scen in skip_list.split(',') ) {
296 if ( scen.contains('yaml')) {
297 cmd_skip_names += "! -name ${scen} "
298 }
299 else {
300 cmd_skip_dirs += "-path ${scenarios}/${scen} -prune -o "
301 }
302 }
303 }
Sergey Galkinea53f922017-11-29 19:11:54 +0400304 if (scenarios == '') {
Oleg Basov20afb152018-06-10 03:09:25 +0200305 cmd_rally_start = "rally $rally_extra_args task start test_config/rally/scenario.yaml "
Sergey Galkinea53f922017-11-29 19:11:54 +0400306 } else {
Oleg Basov20afb152018-06-10 03:09:25 +0200307 cmd_rally_start = "rally $rally_extra_args task start scenarios.yaml "
308 cmd_rally_checkout += "if [ -f ${scenarios} ]; then cp ${scenarios} scenarios.yaml; " +
309 "else " +
mkraynovc6e0bb62018-08-07 11:01:23 +0400310 "find -L ${scenarios} " + cmd_skip_dirs +
311 " -name '*.yaml' " + cmd_skip_names +
312 "-exec cat {} >> scenarios.yaml \\; ; " +
Oleg Basov20afb152018-06-10 03:09:25 +0200313 "sed -i '/---/d' scenarios.yaml; fi; "
Sergey Galkinea53f922017-11-29 19:11:54 +0400314 }
Oleg Basov20afb152018-06-10 03:09:25 +0200315 }
316 } else if (platform == 'k8s') {
317 rally_extra_args = "--debug --log-file ${dest_folder}/task.log"
Oleg Basov20afb152018-06-10 03:09:25 +0200318 def plugins_repo = ext_variables.plugins_repo
319 def plugins_branch = ext_variables.plugins_branch
Oleg Basov3e050d32018-07-03 22:10:56 +0200320 def _pillar = salt.getPillar(master, 'I@kubernetes:master and *01*', 'kubernetes:master')
321 def kubernetes = _pillar['return'][0].values()[0]
322 env_vars = [
323 "KUBERNETES_HOST=${kubernetes.apiserver.vip_address}" +
324 ":${kubernetes.apiserver.insecure_port}",
325 "KUBERNETES_CERT_AUTH=${dest_folder}/k8s-ca.crt",
326 "KUBERNETES_CLIENT_KEY=${dest_folder}/k8s-client.key",
327 "KUBERNETES_CLIENT_CERT=${dest_folder}/k8s-client.crt"].join(' -e ')
328 def k8s_ca = salt.getReturnValues(salt.runSaltProcessStep(master,
Oleg Basov20afb152018-06-10 03:09:25 +0200329 'I@kubernetes:master and *01*', 'cmd.run',
Oleg Basov3e050d32018-07-03 22:10:56 +0200330 ["cat /etc/kubernetes/ssl/ca-kubernetes.crt"]))
331 def k8s_client_key = salt.getReturnValues(salt.runSaltProcessStep(master,
332 'I@kubernetes:master and *01*', 'cmd.run',
333 ["cat /etc/kubernetes/ssl/kubelet-client.key"]))
334 def k8s_client_crt = salt.getReturnValues(salt.runSaltProcessStep(master,
335 'I@kubernetes:master and *01*', 'cmd.run',
336 ["cat /etc/kubernetes/ssl/kubelet-client.crt"]))
Oleg Basov20afb152018-06-10 03:09:25 +0200337 def tmp_dir = '/tmp/kube'
338 salt.runSaltProcessStep(master, target, 'file.mkdir', ["${tmp_dir}", "mode=777"])
Oleg Basov3e050d32018-07-03 22:10:56 +0200339 writeFile file: "${tmp_dir}/k8s-ca.crt", text: k8s_ca
340 writeFile file: "${tmp_dir}/k8s-client.key", text: k8s_client_key
341 writeFile file: "${tmp_dir}/k8s-client.crt", text: k8s_client_crt
Oleg Basov20afb152018-06-10 03:09:25 +0200342 salt.cmdRun(master, target, "mv ${tmp_dir}/* ${results}/")
343 salt.runSaltProcessStep(master, target, 'file.rmdir', ["${tmp_dir}"])
Oleg Basov1fade2f2018-08-07 14:52:10 +0200344 cmd_rally_init = 'set -e ; set -x; cd /tmp/; ' +
Oleg Basov20afb152018-06-10 03:09:25 +0200345 "git clone -b ${plugins_branch ?: 'master'} ${plugins_repo} plugins; " +
346 "sudo pip install --upgrade ./plugins; " +
Oleg Basov1fade2f2018-08-07 14:52:10 +0200347 "rally db recreate; " +
Oleg Basov3e050d32018-07-03 22:10:56 +0200348 "rally env create --name k8s --from-sysenv; " +
Oleg Basov20afb152018-06-10 03:09:25 +0200349 "rally env check k8s; "
350 if (repository == '' ) {
351 cmd_rally_start = "rally $rally_extra_args task start " +
Oleg Basov3e050d32018-07-03 22:10:56 +0200352 "./plugins/samples/scenarios/kubernetes/create-and-delete-pod.yaml; "
Oleg Basov20afb152018-06-10 03:09:25 +0200353 cmd_rally_checkout = ''
354 } else {
355 cmd_rally_checkout = "git clone -b ${branch ?: 'master'} ${repository} test_config; "
356 if (scenarios == '') {
Oleg Basov3e050d32018-07-03 22:10:56 +0200357 cmd_rally_start = "rally $rally_extra_args task start test_config/rally-k8s/create-and-delete-pod.yaml "
Oleg Basov20afb152018-06-10 03:09:25 +0200358 } else {
359 cmd_rally_start = "rally $rally_extra_args task start scenarios.yaml "
360 cmd_rally_checkout += "if [ -f ${scenarios} ]; then cp ${scenarios} scenarios.yaml; " +
361 "else " +
362 "find -L ${scenarios} -name '*.yaml' -exec cat {} >> scenarios.yaml \\; ; " +
363 "sed -i '/---/d' scenarios.yaml; fi; "
Sergey Galkinea53f922017-11-29 19:11:54 +0400364 }
Oleg Basov20afb152018-06-10 03:09:25 +0200365 }
366 } else {
367 throw new Exception("Platform ${platform} is not supported yet")
Dmitrii Kabanov999fda92017-11-10 00:18:30 -0800368 }
Oleg Basov20afb152018-06-10 03:09:25 +0200369 if (repository != '' ) {
370 switch(tasks_args_file) {
371 case 'none':
372 cmd_rally_task_args = '; '
373 break
374 case '':
375 cmd_rally_task_args = '--task-args-file test_config/job-params-light.yaml; '
376 break
377 default:
378 cmd_rally_task_args = "--task-args-file ${tasks_args_file}; "
379 break
380 }
381 }
382 full_cmd = cmd_rally_init + cmd_rally_checkout + cmd_rally_start + cmd_rally_task_args + cmd_report
Sergey Galkinf89509d2018-03-19 15:24:17 +0400383 salt.runSaltProcessStep(master, target, 'file.touch', ["${results}/rally.db"])
384 salt.cmdRun(master, target, "chmod 666 ${results}/rally.db")
mkraynovd49daf52018-07-12 16:11:14 +0400385 salt.cmdRun(master, target, "docker run -w /home/rally -i --rm --net=host -e ${env_vars} " +
Sergey Galkin3c1e9e22018-01-12 16:31:53 +0400386 "-v ${results}:${dest_folder} " +
mkraynovd49daf52018-07-12 16:11:14 +0400387 "-v ${results}/rally.db:/home/rally/data/rally.db " +
Sergey Galkin3c1e9e22018-01-12 16:31:53 +0400388 "--entrypoint /bin/bash ${dockerImageLink} " +
389 "-c \"${full_cmd}\" > ${results}/${output_file}")
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700390 addFiles(master, target, results, output_dir)
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700391}
392
393/**
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700394 * Generate test report
395 *
396 * @param target Host to run script from
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700397 * @param dockerImageLink Docker image link
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700398 * @param output_dir Directory for results
Sergey Galkind1068e22018-02-13 13:59:32 +0400399 * @param results The reports directory
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700400 */
Sergey Galkind1068e22018-02-13 13:59:32 +0400401def generateTestReport(master, target, dockerImageLink, output_dir, results = '/root/qa_results') {
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700402 def report_file = 'jenkins_test_report.html'
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700403 def salt = new com.mirantis.mk.Salt()
404 def common = new com.mirantis.mk.Common()
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700405 def dest_folder = '/opt/devops-qa-tools/generate_test_report/test_results'
406 salt.runSaltProcessStep(master, target, 'file.remove', ["${results}"])
407 salt.runSaltProcessStep(master, target, 'file.mkdir', ["${results}", "mode=777"])
408 def reports = ['report-tempest.json',
409 'report-rally.xml',
410 'report-k8s-e2e-tests.txt',
411 'report-ha.json',
412 'report-spt.txt']
413 for ( report in reports ) {
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700414 if ( fileExists("${output_dir}${report}") ) {
415 common.infoMsg("Copying ${report} to docker container")
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700416 def items = sh(script: "base64 -w0 ${output_dir}${report} > ${output_dir}${report}_encoded; " +
417 "split -b 100KB -d -a 4 ${output_dir}${report}_encoded ${output_dir}${report}__; " +
418 "rm ${output_dir}${report}_encoded; " +
419 "find ${output_dir} -type f -name ${report}__* -printf \'%f\\n\' | sort", returnStdout: true)
420 for ( item in items.tokenize() ) {
421 def content = sh(script: "cat ${output_dir}${item}", returnStdout: true)
422 salt.cmdRun(master, target, "echo \"${content}\" >> ${results}/${report}_encoded", false, null, false)
423 sh(script: "rm ${output_dir}${item}")
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700424 }
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700425 salt.cmdRun(master, target, "base64 -d ${results}/${report}_encoded > ${results}/${report}; " +
426 "rm ${results}/${report}_encoded", false, null, false)
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700427 }
428 }
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700429
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700430 def cmd = "jenkins_report.py --path /opt/devops-qa-tools/generate_test_report/; " +
431 "cp ${report_file} ${dest_folder}/${report_file}"
432 salt.cmdRun(master, target, "docker run -i --rm --net=host " +
433 "-v ${results}:${dest_folder} ${dockerImageLink} " +
434 "/bin/bash -c \"${cmd}\"")
435 def report_content = salt.getFileContent(master, target, "${results}/${report_file}")
Tetiana Korchak3383cc92017-08-25 09:36:19 -0700436 writeFile file: "${output_dir}${report_file}", text: report_content
437}
438
439/**
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700440 * Execute SPT tests
441 *
442 * @param target Host to run tests
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700443 * @param dockerImageLink Docker image link
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700444 * @param output_dir Directory for results
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700445 * @param ext_variables The list of external variables
Sergey Galkind1068e22018-02-13 13:59:32 +0400446 * @param results The reports directory
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700447 */
Sergey Galkind1068e22018-02-13 13:59:32 +0400448def runSptTests(master, target, dockerImageLink, output_dir, ext_variables = [], results = '/root/qa_results') {
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700449 def salt = new com.mirantis.mk.Salt()
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700450 def dest_folder = '/home/rally/qa_results'
451 salt.runSaltProcessStep(master, target, 'file.remove', ["${results}"])
452 salt.runSaltProcessStep(master, target, 'file.mkdir', ["${results}", "mode=777"])
453 def nodes = getNodeList(master)
454 def nodes_hw = getNodeList(master, 'G@virtual:physical')
455 def _pillar = salt.getPillar(master, 'I@keystone:server', 'keystone:server')
456 def keystone = _pillar['return'][0].values()[0]
457 def ssh_key = salt.getFileContent(master, 'I@salt:master', '/root/.ssh/id_rsa')
458 def env_vars = ( ['tempest_version=15.0.0',
459 "OS_USERNAME=${keystone.admin_name}",
460 "OS_PASSWORD=${keystone.admin_password}",
461 "OS_TENANT_NAME=${keystone.admin_tenant}",
462 "OS_AUTH_URL=http://${keystone.bind.private_address}:${keystone.bind.private_port}/v2.0",
463 "OS_REGION_NAME=${keystone.region}",
464 'OS_ENDPOINT_TYPE=admin'] + ext_variables ).join(' -e ')
465 salt.runSaltProcessStep(master, target, 'file.write', ["${results}/nodes.json", nodes])
466 salt.runSaltProcessStep(master, target, 'file.write', ["${results}/nodes_hw.json", nodes_hw])
467 def cmd = '/opt/devops-qa-tools/deployment/configure.sh; ' +
468 'sudo mkdir -p /root/.ssh; sudo chmod 700 /root/.ssh; ' +
469 "echo \\\"${ssh_key}\\\" | sudo tee /root/.ssh/id_rsa > /dev/null; " +
470 'sudo chmod 600 /root/.ssh/id_rsa; ' +
471 "sudo timmy -c simplified-performance-testing/config.yaml " +
472 "--nodes-json ${dest_folder}/nodes.json --log-file ${dest_folder}/docker-spt2.log; " +
473 "./simplified-performance-testing/SPT_parser.sh > ${dest_folder}/report-spt.txt; " +
474 "custom_spt_parser.sh ${dest_folder}/nodes_hw.json > ${dest_folder}/report-spt-hw.txt; " +
475 "cp /tmp/timmy/archives/general.tar.gz ${dest_folder}/results-spt.tar.gz"
476 salt.cmdRun(master, target, "docker run -i --rm --net=host -e ${env_vars} " +
477 "-v ${results}:${dest_folder} ${dockerImageLink} /bin/bash -c " +
478 "\"${cmd}\" > ${results}/docker-spt.log")
479 addFiles(master, target, results, output_dir)
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700480}
481
Dmitrii Kabanovd5f1c5f2017-08-30 14:51:41 -0700482/**
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600483 * Configure docker container
484 *
485 * @param target Host to run container
486 * @param proxy Proxy for accessing github and pip
487 * @param testing_tools_repo Repo with testing tools: configuration script, skip-list, etc.
Oleksii Zhurba1579b972017-12-14 15:21:56 -0600488 * @param tempest_repo Tempest repo to clone. Can be upstream tempest (default, recommended), your customized tempest in local/remote repo or path inside container. If not specified, tempest will not be configured.
489 * @param tempest_endpoint_type internalURL or adminURL or publicURL to use in tests
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600490 * @param tempest_version Version of tempest to use
Oleksii Zhurba1579b972017-12-14 15:21:56 -0600491 * @param conf_script_path Path to configuration script.
492 * @param ext_variables Some custom extra variables to add into container
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600493 */
494def configureContainer(master, target, proxy, testing_tools_repo, tempest_repo,
495 tempest_endpoint_type="internalURL", tempest_version="15.0.0",
Oleksii Zhurba1579b972017-12-14 15:21:56 -0600496 conf_script_path="", ext_variables = []) {
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600497 def salt = new com.mirantis.mk.Salt()
498 if (testing_tools_repo != "" ) {
Oleksii Zhurba0cda6e02018-06-20 14:53:19 -0500499 if (testing_tools_repo.contains('http://') || testing_tools_repo.contains('https://')) {
500 salt.cmdRun(master, target, "docker exec cvp git clone ${testing_tools_repo} cvp-configuration")
501 configure_script = conf_script_path != "" ? conf_script_path : "cvp-configuration/configure.sh"
502 }
503 else {
504 configure_script = testing_tools_repo
505 }
506 ext_variables.addAll("PROXY=${proxy}", "TEMPEST_REPO=${tempest_repo}",
507 "TEMPEST_ENDPOINT_TYPE=${tempest_endpoint_type}",
508 "tempest_version=${tempest_version}")
509 salt.cmdRun(master, target, "docker exec -e " + ext_variables.join(' -e ') + " cvp bash -c ${configure_script}")
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600510 }
Oleksii Zhurba0cda6e02018-06-20 14:53:19 -0500511 else {
512 common.infoMsg("TOOLS_REPO is empty, no confguration is needed for container")
513 }
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600514}
515
516/**
517 * Run Tempest
518 *
519 * @param target Host to run container
520 * @param test_pattern Test pattern to run
521 * @param skip_list Path to skip-list
522 * @param output_dir Directory on target host for storing results (containers is not a good place)
523 */
524def runCVPtempest(master, target, test_pattern="set=smoke", skip_list="", output_dir, output_filename="docker-tempest") {
525 def salt = new com.mirantis.mk.Salt()
526 def xml_file = "${output_filename}.xml"
Oleksii Zhurba44045312017-12-12 15:38:26 -0600527 def html_file = "${output_filename}.html"
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600528 def log_file = "${output_filename}.log"
529 skip_list_cmd = ''
530 if (skip_list != '') {
531 skip_list_cmd = "--skip-list ${skip_list}"
532 }
533 salt.cmdRun(master, target, "docker exec cvp rally verify start --pattern ${test_pattern} ${skip_list_cmd} " +
534 "--detailed > ${log_file}", false)
535 salt.cmdRun(master, target, "cat ${log_file}")
536 salt.cmdRun(master, target, "docker exec cvp rally verify report --type junit-xml --to /home/rally/${xml_file}")
Oleksii Zhurba44045312017-12-12 15:38:26 -0600537 salt.cmdRun(master, target, "docker exec cvp rally verify report --type html --to /home/rally/${html_file}")
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600538 salt.cmdRun(master, target, "docker cp cvp:/home/rally/${xml_file} ${output_dir}")
Oleksii Zhurba44045312017-12-12 15:38:26 -0600539 salt.cmdRun(master, target, "docker cp cvp:/home/rally/${html_file} ${output_dir}")
Oleksii Zhurba1bf9be12018-01-17 15:20:00 -0600540 return salt.cmdRun(master, target, "docker exec cvp rally verify show | head -5 | tail -1 | awk '{print \$4}'")['return'][0].values()[0].split()[0]
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600541}
542
543/**
544 * Run Rally
545 *
546 * @param target Host to run container
547 * @param test_pattern Test pattern to run
548 * @param scenarios_path Path to Rally scenarios
549 * @param output_dir Directory on target host for storing results (containers is not a good place)
550 */
551def runCVPrally(master, target, scenarios_path, output_dir, output_filename="docker-rally") {
552 def salt = new com.mirantis.mk.Salt()
553 def xml_file = "${output_filename}.xml"
554 def log_file = "${output_filename}.log"
555 def html_file = "${output_filename}.html"
556 salt.cmdRun(master, target, "docker exec cvp rally task start ${scenarios_path} > ${log_file}", false)
557 salt.cmdRun(master, target, "cat ${log_file}")
558 salt.cmdRun(master, target, "docker exec cvp rally task report --out ${html_file}")
Oleksii Zhurba1bf9be12018-01-17 15:20:00 -0600559 salt.cmdRun(master, target, "docker exec cvp rally task report --junit --out ${xml_file}")
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600560 salt.cmdRun(master, target, "docker cp cvp:/home/rally/${xml_file} ${output_dir}")
561 salt.cmdRun(master, target, "docker cp cvp:/home/rally/${html_file} ${output_dir}")
562}
563
564
565/**
566 * Shutdown node
567 *
568 * @param target Host to run command
569 * @param mode How to shutdown node
570 * @param retries # of retries to make to check node status
571 */
572def shutdown_vm_node(master, target, mode, retries=200) {
573 def salt = new com.mirantis.mk.Salt()
574 def common = new com.mirantis.mk.Common()
575 if (mode == 'reboot') {
576 try {
577 def out = salt.runSaltCommand(master, 'local', ['expression': target, 'type': 'compound'], 'cmd.run', null, ['reboot'], null, 3, 3)
578 } catch (Exception e) {
579 common.warningMsg('Timeout from minion: node must be rebooting now')
580 }
581 common.warningMsg("Checking that minion is down")
582 status = "True"
583 for (i = 0; i < retries; i++) {
584 status = salt.minionsReachable(master, 'I@salt:master', target, null, 5, 1)
585 if (status != "True") {
586 break
587 }
588 }
589 if (status == "True") {
590 throw new Exception("Tired to wait for minion ${target} to stop responding")
591 }
592 }
593 if (mode == 'hard_shutdown' || mode == 'soft_shutdown') {
594 kvm = locate_node_on_kvm(master, target)
595 if (mode == 'soft_shutdown') {
596 salt.cmdRun(master, target, "shutdown -h 0")
597 }
598 if (mode == 'hard_shutdown') {
599 salt.cmdRun(master, kvm, "virsh destroy ${target}")
600 }
601 common.warningMsg("Checking that vm on kvm is in power off state")
602 status = 'running'
603 for (i = 0; i < retries; i++) {
604 status = check_vm_status(master, target, kvm)
605 echo "Current status - ${status}"
606 if (status != 'running') {
607 break
608 }
609 sleep (1)
610 }
611 if (status == 'running') {
612 throw new Exception("Tired to wait for node ${target} to shutdown")
613 }
614 }
615}
616
617
618/**
619 * Locate kvm where target host is located
620 *
621 * @param target Host to check
622 */
623def locate_node_on_kvm(master, target) {
624 def salt = new com.mirantis.mk.Salt()
625 def list = salt.runSaltProcessStep(master, "I@salt:control", 'cmd.run', ["virsh list --all | grep ' ${target}'"])['return'][0]
626 for (item in list.keySet()) {
627 if (list[item]) {
628 return item
629 }
630 }
631}
632
633/**
634 * Check target host status
635 *
636 * @param target Host to check
637 * @param kvm KVM node where target host is located
638 */
639def check_vm_status(master, target, kvm) {
640 def salt = new com.mirantis.mk.Salt()
641 def list = salt.runSaltProcessStep(master, "${kvm}", 'cmd.run', ["virsh list --all | grep ' ${target}'"])['return'][0]
642 for (item in list.keySet()) {
643 if (list[item]) {
644 return list[item].split()[2]
645 }
646 }
647}
648
649/**
650 * Find vip on nodes
651 *
652 * @param target Pattern, e.g. ctl*
653 */
654def get_vip_node(master, target) {
655 def salt = new com.mirantis.mk.Salt()
656 def list = salt.runSaltProcessStep(master, "${target}", 'cmd.run', ["ip a | grep global | grep -v brd"])['return'][0]
657 for (item in list.keySet()) {
658 if (list[item]) {
659 return item
660 }
661 }
662}
663
664/**
665 * Find vip on nodes
666 *
667 * @param target Host with cvp container
668 */
Oleksii Zhurba5250a9c2018-03-21 15:47:03 -0500669def openstack_cleanup(master, target, script_path="/home/rally/cvp-configuration/cleanup.sh") {
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600670 def salt = new com.mirantis.mk.Salt()
671 salt.runSaltProcessStep(master, "${target}", 'cmd.run', ["docker exec cvp bash -c ${script_path}"])
672}
673
674
675/**
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700676 * Cleanup
677 *
678 * @param target Host to run commands
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700679 */
Dmitrii Kabanov23901c22017-10-20 10:25:36 -0700680def runCleanup(master, target) {
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700681 def salt = new com.mirantis.mk.Salt()
Dmitrii Kabanov321405a2017-08-16 16:38:51 -0700682 if ( salt.cmdRun(master, target, "docker ps -f name=qa_tools -q", false, null, false)['return'][0].values()[0] ) {
683 salt.cmdRun(master, target, "docker rm -f qa_tools")
684 }
Oleksii Zhurba7b44ef12017-11-13 17:50:16 -0600685 if ( salt.cmdRun(master, target, "docker ps -f name=cvp -q", false, null, false)['return'][0].values()[0] ) {
686 salt.cmdRun(master, target, "docker rm -f cvp")
687 }
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700688}
Oleksii Zhurbabcb97e22017-10-05 14:10:39 -0500689/**
690 * Prepare venv for any python project
691 * Note: <repo_name>\/requirements.txt content will be used
692 * for this venv
693 *
694 * @param repo_url Repository url to clone
695 * @param proxy Proxy address to use
696 */
697def prepareVenv(repo_url, proxy) {
698 def python = new com.mirantis.mk.Python()
699 repo_name = "${repo_url}".tokenize("/").last()
Oleksii Zhurbae711ebb2018-06-15 16:36:38 -0500700 if (repo_url.tokenize().size() > 1){
701 if (repo_url.tokenize()[1] == '-b'){
702 repo_name = repo_url.tokenize()[0].tokenize("/").last()
703 }
704 }
Oleksii Zhurba83e3e5c2018-06-27 16:59:29 -0500705 path_venv = "${env.WORKSPACE}/venv"
706 path_req = "${env.WORKSPACE}/${repo_name}/requirements.txt"
Oleksii Zhurbabcb97e22017-10-05 14:10:39 -0500707 sh "rm -rf ${repo_name}"
Oleksii Zhurba83e3e5c2018-06-27 16:59:29 -0500708 // this is temporary W/A for offline deployments
709 // Jenkins slave image has /opt/pip-mirror/ folder
710 // where pip wheels for cvp projects are located
711 if (proxy != 'offline') {
712 withEnv(["HTTPS_PROXY=${proxy}", "HTTP_PROXY=${proxy}", "https_proxy=${proxy}", "http_proxy=${proxy}"]) {
713 sh "git clone ${repo_url}"
714 python.setupVirtualenv(path_venv, "python2", [], path_req, true)
715 }
716 }
717 else {
Oleksii Zhurbabcb97e22017-10-05 14:10:39 -0500718 sh "git clone ${repo_url}"
Oleksii Zhurba83e3e5c2018-06-27 16:59:29 -0500719 sh "virtualenv ${path_venv} --python python2"
720 python.runVirtualenvCommand(path_venv, "pip install --no-index --find-links=/opt/pip-mirror/ -r ${path_req}", true)
Oleksii Zhurbabcb97e22017-10-05 14:10:39 -0500721 }
722}
723
Petr Lomakin47fee0a2017-08-01 10:46:05 -0700724/** Install docker if needed
725 *
726 * @param target Target node to install docker pkg
727 */
728def installDocker(master, target) {
729 def salt = new com.mirantis.mk.Salt()
730 if ( ! salt.runSaltProcessStep(master, target, 'pkg.version', ["docker-engine"]) ) {
731 salt.runSaltProcessStep(master, target, 'pkg.install', ["docker.io"])
732 }
733}