blob: e4f743183d9eb32d486cc3a15f58625a7cdd7d51 [file] [log] [blame]
Kailash Khalasif005fcb2018-10-02 12:52:03 -07001/* seba-in-a-box build+test */
2
3pipeline {
4
5 /* no label, executor is determined by JJB */
6 agent {
7 label "${params.executorNode}"
8 }
9
Kailash Khalasif005fcb2018-10-02 12:52:03 -070010 stages {
11
12 stage ("Clean workspace") {
13 steps {
14 sh 'rm -rf *'
15 }
16 }
17
18 stage ('Checkout Automation-Tools Repo') {
19 steps {
20 sh '''
21 pushd $WORKSPACE
22 git clone https://gerrit.opencord.org/automation-tools
23 popd
24 '''
25 }
26 }
27
28 stage ('Reset Kubeadm') {
29 steps {
30 sh """
31 pushd $WORKSPACE/automation-tools/seba-in-a-box
32 make reset-kubeadm
33 popd
34 """
35 }
36 }
37
38 stage ('Install SEBA') {
39 steps {
40 sh """
41 pushd $WORKSPACE/automation-tools/seba-in-a-box
Kailash Khalasidaa056e2018-10-12 09:58:26 -070042 make ${params.version} -j2
Kailash Khalasif005fcb2018-10-02 12:52:03 -070043 popd
44 """
45 }
46 }
47
48 stage ('Run E2E Tests') {
49 steps {
50 sh """
51 pushd $WORKSPACE/automation-tools/seba-in-a-box
Kailash Khalasi2a1e24b2018-10-02 14:15:59 -070052 make run-tests || true
Kailash Khalasif005fcb2018-10-02 12:52:03 -070053 popd
54 """
55 }
56 }
57
Kailash Khalasidaa056e2018-10-12 09:58:26 -070058 stage ('Display Kafka Events') {
59 steps {
60 sh """
61 pushd $WORKSPACE/automation-tools/seba-in-a-box
62 CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
63 kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
64 kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
65 kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
66 popd
67 """
68 }
69 }
70
Kailash Khalasif005fcb2018-10-02 12:52:03 -070071 stage('Publish') {
72 steps {
73 sh """
74 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
75 cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/WorkflowValidations/*ml ./RobotLogs
76 """
77 step([$class: 'RobotPublisher',
78 disableArchiveOutput: false,
79 logFileName: 'RobotLogs/log*.html',
80 otherFiles: '',
81 outputFileName: 'RobotLogs/output*.xml',
82 outputPath: '.',
83 passThreshold: 100,
84 reportFileName: 'RobotLogs/report*.html',
85 unstableThreshold: 0]);
86 }
87 }
88
89 }
90
91 post {
92 always {
93 sh '''
Kailash Khalasi2a1e24b2018-10-02 14:15:59 -070094 sudo cp /var/log/containers/*.log $WORKSPACE/
95 sudo chown cord:cord $WORKSPACE/*log
Kailash Khalasif005fcb2018-10-02 12:52:03 -070096 '''
Kailash Khalasi2a1e24b2018-10-02 14:15:59 -070097 archiveArtifacts artifacts: '*.log'
Kailash Khalasif005fcb2018-10-02 12:52:03 -070098 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "andy@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false])
99 }
Kailash Khalasibb2042e2018-10-04 09:41:49 -0700100 failure {
101 sh '''
102 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices
103 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices/of:0000000000000001/ports
104 curl -X GET http://127.0.0.1:30125/api/v1/devices
105 curl -X GET http://127.0.0.1:30125/api/v1/logical_devices
106 '''
107 }
Kailash Khalasif005fcb2018-10-02 12:52:03 -0700108 }
109}