blob: 1ab109e366d85771b560ec60f351b7d11695fbf0 [file] [log] [blame]
Kailash31961642019-02-04 09:07:26 -08001/* seba-in-a-box build+test */
2
3pipeline {
4
5 /* no label, executor is determined by JJB */
6 agent {
Zack Williamsb3292082019-10-11 17:15:18 -07007 label "${params.buildNode}"
Kailash31961642019-02-04 09:07:26 -08008 }
9
Kailasha2ee5fa2019-02-19 09:14:34 -080010 options {
11 timeout(time: 1, unit: 'HOURS')
12 }
13
Kailash31961642019-02-04 09:07:26 -080014 stages {
15
16 stage ("Clean workspace") {
17 steps {
Kailash3f6b9ac2019-02-04 10:32:20 -080018 sh 'cd $WORKSPACE; rm -rf *'
Kailash31961642019-02-04 09:07:26 -080019 }
20 }
21
22 stage('repo') {
23 steps {
24 checkout(changelog: false, \
25 poll: false,
26 scm: [$class: 'RepoScm', \
Kailash3f6b9ac2019-02-04 10:32:20 -080027 manifestRepositoryUrl: "https://gerrit.opencord.org/manifest.git", \
28 manifestBranch: "master", \
Kailash31961642019-02-04 09:07:26 -080029 currentBranch: true, \
30 destinationDir: 'cord', \
31 forceSync: true,
32 resetFirst: true, \
33 quiet: true, \
34 jobs: 4, \
35 showAllChanges: true] \
36 )
37 }
38 }
39
40 stage('patch') {
41 steps {
42 sh """
43 pushd $WORKSPACE/cord
44 repo download helm-charts "${gerritChangeNumber}/${gerritPatchsetNumber}"
45 popd
46 """
47 }
48 }
49
Kailash31961642019-02-04 09:07:26 -080050 stage ('Reset Kubeadm') {
51 steps {
52 sh """
53 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
54 make reset-kubeadm
55 popd
56 """
57 }
58 }
59
60 stage ('Install SEBA') {
61 steps {
62 sh """
63 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
Kailash4853bb02019-02-12 12:53:14 -080064 make ${params.version}
Kailash31961642019-02-04 09:07:26 -080065 popd
66 """
67 }
68 }
69
70 stage ('Run E2E Tests') {
71 steps {
72 sh """
73 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
Andy Bavier5e92df62019-05-09 16:11:24 -070074 make ${params.Test_Target} ${params.Test_Tags} || true
Kailash31961642019-02-04 09:07:26 -080075 popd
76 """
77 }
78 }
79
80 stage ('Display Kafka Events') {
81 steps {
82 sh """
83 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
84 CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
85 kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
86 kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
87 kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
88 popd
89 """
90 }
91 }
92
93 stage('Publish') {
94 steps {
95 sh """
96 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
97 cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/WorkflowValidations/*ml ./RobotLogs
98 """
99 step([$class: 'RobotPublisher',
100 disableArchiveOutput: false,
101 logFileName: 'RobotLogs/log*.html',
102 otherFiles: '',
103 outputFileName: 'RobotLogs/output*.xml',
104 outputPath: '.',
105 passThreshold: 100,
106 reportFileName: 'RobotLogs/report*.html',
107 unstableThreshold: 0]);
108 }
109 }
110
111 }
112
113 post {
114 always {
115 sh '''
Kailash842cd872019-03-13 13:56:38 -0700116 kubectl describe pods > $WORKSPACE/kube_pods.log
117 kubectl describe pods -n voltha > $WORKSPACE/kube_voltha_pods.log
Kailash31961642019-02-04 09:07:26 -0800118 sudo cp /var/log/containers/*.log $WORKSPACE/
119 sudo chown cord:cord $WORKSPACE/*log
120 '''
121 archiveArtifacts artifacts: '*.log'
122 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "andy@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false])
123 }
124 failure {
125 sh '''
126 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices
127 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices/of:0000000000000001/ports
128 curl -X GET http://127.0.0.1:30125/api/v1/devices
129 curl -X GET http://127.0.0.1:30125/api/v1/logical_devices
130 '''
131 }
132 }
133}