Added env OPENMANO_TENANT=osm at RO container
[osm/devops.git] / systest / Jenkinsfile
1 // input parameters:
2 //   string:  UPSTREAM_PROJECT
3 //   string:  NODE
4 //
5 //   OpenStack VIM Credentials
6 //   string:  OS_AUTH_URL
7 //   string:  OS_USERNAME
8 //   string:  OS_PASSWORD
9 //   string:  OS_PROJECT_NAME
10
11 node("${params.NODE}") {
12
13     // grab the upstream artifact name
14     step ([$class: 'CopyArtifact',
15           projectName: params.UPSTREAM_PROJECT])
16
17     container_name = sh(returnStdout: true, script: 'cat build_version.txt').trim()
18
19     stage("get osm") {
20         // get the IP of the osm container
21         OSM_IP = sh(returnStdout: true, script: "lxc list ${container_name} -c 4|grep eth0 |awk '{print \$2}'").trim()
22     }
23
24     stage("checkout") {
25         checkout scm
26     }
27
28     // build the pytest container
29     stage("build-docker") {
30         sh 'docker build -t osmclient systest/.'
31     }
32
33     os_credentials = "OS_AUTH_URL=${params.OS_AUTH_URL} OS_USERNAME=${params.OS_USERNAME} OS_PASSWORD=${params.OS_PASSWORD} OS_PROJECT_NAME=${params.OS_PROJECT_NAME}"
34
35     // now run the built container.
36     withDockerContainer('osmclient') {
37
38         // install the osmclient
39         stage("install-osmclient") {
40             sh 'pip install git+https://osm.etsi.org/gerrit/osm/osmclient'
41         }
42
43         stage("build-descriptors") {
44             sh "make -C systest descriptors"
45         }
46
47         stage("smoke-test") {
48             sh "make -C systest OSM_HOSTNAME=${OSM_IP} smoke"
49             junit 'systest/reports/pytest-smoke.xml'
50         }
51
52         stage("cirros-test") {
53             sh """
54                make -C systest OSM_HOSTNAME=${OSM_IP} ${os_credentials} cirros
55                """
56             junit 'systest/reports/pytest-cirros.xml'
57         }
58     }
59 }