blob: d0c71562bf67b426bfd2fbb033a3f047721a8247 [file] [log] [blame]
Oleksii Zhurba546a5602017-12-12 16:18:05 -06001/**
2 *
3 * Launch validation of the cloud
4 *
5 * Expected parameters:
6 * SALT_MASTER_URL URL of Salt master
7 * SALT_MASTER_CREDENTIALS Credentials that are used in this Jenkins for accessing Salt master (usually "salt")
8 * PROXY Proxy address (if any) for accessing the Internet. It will be used for cloning repos and installing pip dependencies
9 * TEST_IMAGE Docker image link to use for running container with testing tools.
10 * TOOLS_REPO URL of repo where testing tools, scenarios, configs are located
11 *
12 * TARGET_NODE Node to run container with Rally
13 * DEBUG_MODE If you need to debug (keep container after test), please enabled this
14 * RALLY_SCENARIO_FILE Path to Rally scenario file in container
15 *
16 */
17
18common = new com.mirantis.mk.Common()
19salt = new com.mirantis.mk.Salt()
20validate = new com.mirantis.mcp.Validate()
21
22def artifacts_dir = 'validation_artifacts/'
23def remote_artifacts_dir = '/root/qa_results/'
24def saltMaster
25
26node() {
27 try{
28 stage('Initialization') {
29 saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
30 sh "rm -rf ${artifacts_dir}"
31 salt.cmdRun(saltMaster, TARGET_NODE, "mkdir -p ${remote_artifacts_dir}")
32 validate.runBasicContainer(saltMaster, TARGET_NODE, TEST_IMAGE)
33 validate.configureContainer(saltMaster, TARGET_NODE, PROXY, TOOLS_REPO, "")
34 }
35
36 stage('Run Rally tests') {
37 sh "mkdir -p ${artifacts_dir}"
38 validate.runCVPrally(saltMaster, TARGET_NODE, RALLY_SCENARIO_FILE, remote_artifacts_dir)
39 }
40
41 stage('Collect results') {
42 validate.addFiles(saltMaster, TARGET_NODE, remote_artifacts_dir, artifacts_dir)
43 archiveArtifacts artifacts: "${artifacts_dir}/*"
44 junit "${artifacts_dir}/*.xml"
Oleksii Zhurbae23f94c2018-04-30 16:08:18 -050045 perfReport configType: 'PRT', graphType: 'PRT', sourceDataFiles: "${artifacts_dir}/docker-rally.xml"
Oleksii Zhurba546a5602017-12-12 16:18:05 -060046 }
47 } catch (Throwable e) {
48 // If there was an error or exception thrown, the build failed
49 currentBuild.result = "FAILURE"
50 throw e
51 } finally {
52 if (DEBUG_MODE == 'false') {
53 validate.runCleanup(saltMaster, TARGET_NODE)
54 salt.cmdRun(saltMaster, TARGET_NODE, "rm -rf ${remote_artifacts_dir}")
55 }
56 }
57}
58