blob: 3f2339faa9d4dc8c613418a58ea199cbc15e6395 [file] [log] [blame]
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +03001/**
2 *
3 * Service test pipeline
4 *
5 * Expected parameters:
6 * SALT_MASTER_URL URL of Salt master
7 * SALT_MASTER_CREDENTIALS Credentials to the Salt API
8 * Test settings:
9 * IMAGE_LINK Link to docker image with Rally
10 * RALLY_SCENARIO Rally test scenario
11 * TEST_TARGET Salt target for Rally node
Ievgeniia Zadorozhna0d09cf42017-10-31 16:30:38 +030012 * CONTAINER_NAME Name of the Docker container which runs Rally
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030013 * CLEANUP_REPORTS_AND_CONTAINER Cleanup reports from rally,tempest container, remove all containers started the IMAGE_LINK
14 * DO_CLEANUP_RESOURCES If "true": runs clean-up script for removing Rally and Tempest resources
15 */
16
17
18common = new com.mirantis.mk.Common()
19salt = new com.mirantis.mk.Salt()
20test = new com.mirantis.mk.Test()
chnyda625f4b42017-10-11 14:10:31 +020021def python = new com.mirantis.mk.Python()
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030022
chnyda625f4b42017-10-11 14:10:31 +020023def pepperEnv = "pepperEnv"
Jakub Josefa63f9862018-01-11 17:58:38 +010024timeout(time: 12, unit: 'HOURS') {
25 node("python") {
26 try {
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030027
Jakub Josefa63f9862018-01-11 17:58:38 +010028 //
29 // Prepare connection
30 //
31 stage('Setup virtualenv for Pepper') {
32 python.setupPepperVirtualenv(pepperEnv, SALT_MASTER_URL, SALT_MASTER_CREDENTIALS)
33 }
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030034
Jakub Josefa63f9862018-01-11 17:58:38 +010035 //
36 // Test
37 //
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030038
Jakub Josefa63f9862018-01-11 17:58:38 +010039 stage('Run OpenStack Rally scenario') {
40 test.runRallyScenarios(pepperEnv, IMAGE_LINK, TEST_TARGET, RALLY_SCENARIO, "/home/rally/rally_reports/",
41 DO_CLEANUP_RESOURCES)
42 }
43 stage('Copy test reports') {
44 test.copyTempestResults(pepperEnv, TEST_TARGET)
45 }
46 stage('Archiving test artifacts') {
47 test.archiveRallyArtifacts(pepperEnv, TEST_TARGET)
48 }
49 } catch (Throwable e) {
50 currentBuild.result = 'FAILURE'
51 throw e
52 } finally {
53 if (CLEANUP_REPORTS_AND_CONTAINER.toBoolean()) {
54 stage('Cleanup reports and container') {
55 test.removeReports(pepperEnv, TEST_TARGET, "rally_reports", 'rally_reports.tar')
56 test.removeDockerContainer(pepperEnv, TEST_TARGET, CONTAINER_NAME)
57 }
Ievgeniia Zadorozhna14c20f32017-08-31 13:35:57 +030058 }
59 }
60 }
61}