blob: 79385726cf7d0b0a4ce1b90a9da4e90ed885e614 [file] [log] [blame]
Oleksii Zhurba546a5602017-12-12 16:18:05 -06001/**
2 *
Oleksii Zhurba713a5d22018-10-11 14:23:04 +03003 * Launch CVP Rally performance testing of the cloud
Oleksii Zhurba546a5602017-12-12 16:18:05 -06004 *
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/'
Oleksii Zhurba713a5d22018-10-11 14:23:04 +030024def container_name = "${env.JOB_NAME}"
Oleksii Zhurba546a5602017-12-12 16:18:05 -060025def saltMaster
26
27node() {
28 try{
29 stage('Initialization') {
Oleksii Zhurba546a5602017-12-12 16:18:05 -060030 sh "rm -rf ${artifacts_dir}"
Oleksii Zhurba713a5d22018-10-11 14:23:04 +030031 saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
Oleksii Zhurba49275882018-03-21 15:41:57 -050032 salt.cmdRun(saltMaster, TARGET_NODE, "rm -rf ${remote_artifacts_dir}")
Oleksii Zhurba546a5602017-12-12 16:18:05 -060033 salt.cmdRun(saltMaster, TARGET_NODE, "mkdir -p ${remote_artifacts_dir}")
Oleksii Zhurba713a5d22018-10-11 14:23:04 +030034 keystone_creds = validate._get_keystone_creds_v3(saltMaster)
35 if (!keystone_creds) {
36 keystone_creds = validate._get_keystone_creds_v2(saltMaster)
37 }
38 validate.runContainer(saltMaster, TARGET_NODE, TEST_IMAGE, container_name, keystone_creds)
Oleksii Zhurba546a5602017-12-12 16:18:05 -060039 validate.configureContainer(saltMaster, TARGET_NODE, PROXY, TOOLS_REPO, "")
40 }
41
42 stage('Run Rally tests') {
43 sh "mkdir -p ${artifacts_dir}"
44 validate.runCVPrally(saltMaster, TARGET_NODE, RALLY_SCENARIO_FILE, remote_artifacts_dir)
45 }
46
47 stage('Collect results') {
48 validate.addFiles(saltMaster, TARGET_NODE, remote_artifacts_dir, artifacts_dir)
49 archiveArtifacts artifacts: "${artifacts_dir}/*"
50 junit "${artifacts_dir}/*.xml"
Oleksii Zhurbae23f94c2018-04-30 16:08:18 -050051 perfReport configType: 'PRT', graphType: 'PRT', sourceDataFiles: "${artifacts_dir}/docker-rally.xml"
Oleksii Zhurba546a5602017-12-12 16:18:05 -060052 }
53 } catch (Throwable e) {
54 // If there was an error or exception thrown, the build failed
55 currentBuild.result = "FAILURE"
56 throw e
57 } finally {
58 if (DEBUG_MODE == 'false') {
59 validate.runCleanup(saltMaster, TARGET_NODE)
60 salt.cmdRun(saltMaster, TARGET_NODE, "rm -rf ${remote_artifacts_dir}")
61 }
62 }
63}
64