systest jenkins pipeline
[osm/devops.git] / systest / Jenkinsfile
diff --git a/systest/Jenkinsfile b/systest/Jenkinsfile
new file mode 100644 (file)
index 0000000..8e290e8
--- /dev/null
@@ -0,0 +1,59 @@
+// input parameters:
+//   string:  UPSTREAM_PROJECT
+//   string:  NODE
+//
+//   OpenStack VIM Credentials
+//   string:  OS_AUTH_URL
+//   string:  OS_USERNAME
+//   string:  OS_PASSWORD
+//   string:  OS_PROJECT_NAME
+
+node("${params.NODE}") {
+
+    // grab the upstream artifact name
+    step ([$class: 'CopyArtifact',
+          projectName: params.UPSTREAM_PROJECT])
+
+    container_name = sh(returnStdout: true, script: 'cat build_version.txt').trim()
+
+    stage("get osm") {
+        // get the IP of the osm container
+        OSM_IP = sh(returnStdout: true, script: "lxc list ${container_name} -c 4|grep eth0 |awk '{print \$2}'").trim()
+    }
+
+    stage("checkout") {
+        checkout scm
+    }
+
+    // build the pytest container
+    stage("build-docker") {
+        sh 'docker build -t osmclient systest/.'
+    }
+
+    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}"
+
+    // now run the built container.
+    withDockerContainer('osmclient') {
+
+        // install the osmclient
+        stage("install-osmclient") {
+            sh 'pip install git+https://osm.etsi.org/gerrit/osm/osmclient'
+        }
+
+        stage("build-descriptors") {
+            sh "make -C systest descriptors"
+        }
+
+        stage("smoke-test") {
+            sh "make -C systest OSM_HOSTNAME=${OSM_IP} smoke"
+            junit 'systest/reports/pytest-smoke.xml'
+        }
+
+        stage("cirros-test") {
+            sh """
+               make -C systest OSM_HOSTNAME=${OSM_IP} ${os_credentials} cirros
+               """
+            junit 'systest/reports/pytest-cirros.xml'
+        }
+    }
+}