blob: 6c25071b3054cebe467b1d5a384cf48749b0a66e [file] [log] [blame]
Petr Lomakine700ffd2017-08-01 10:53:15 -07001/**
2 *
3 * Launch validation of the cloud
4 *
5 * Expected parameters:
6 * SALT_MASTER_URL URL of Salt master
7 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
8 *
9 * TEST_IMAGE Docker image link
10 * TARGET_NODE Salt target for tempest node
11 * TEMPEST_TEST_SET If not false, run tests matched to pattern only
12 * RUN_TEMPEST_TESTS If not false, run Tempest tests
13 * RUN_RALLY_TESTS If not false, run Rally tests
14 *
15 */
16
17common = new com.mirantis.mk.Common()
18salt = new com.mirantis.mk.Salt()
19validate = new com.mirantis.mcp.Validate()
20
21def saltMaster
22def artifacts_dir = 'validation_artifacts/'
23
24node() {
25 try{
26 stage('Initialization') {
27 saltMaster = salt.connection(SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
28 }
29
30 stage('Configure') {
31 validate.installDocker(saltMaster, TARGET_NODE)
32 sh "mkdir -p ${artifacts_dir}"
33 validate.runContainerConfiguration(saltMaster, TEST_IMAGE, TARGET_NODE, artifacts_dir)
34 }
35
36 stage('Run Tempest tests') {
37 if (RUN_TEMPEST_TESTS.toBoolean() == true) {
38 validate.runTempestTests(saltMaster, TARGET_NODE, artifacts_dir, TEMPEST_TEST_SET)
39 } else {
40 common.infoMsg("Skipping Tempest tests")
41 }
42 }
43
44 stage('Run Rally tests') {
45 if (RUN_RALLY_TESTS.toBoolean() == true) {
46 validate.runRallyTests(saltMaster, TARGET_NODE, artifacts_dir)
47 } else {
48 common.infoMsg("Skipping Rally tests")
49 }
50 }
51 stage('Collect results') {
52 archiveArtifacts artifacts: "${artifacts_dir}/*"
53 }
54 } catch (Throwable e) {
55 // If there was an error or exception thrown, the build failed
56 currentBuild.result = "FAILURE"
57 throw e
58 } finally {
59 validate.runCleanup(saltMaster, TARGET_NODE, artifacts_dir)
60 }
61}