blob: b13ca114bbf883223ff188588e10844ecf10b9f8 [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
Carmelo Casconeafc46472020-01-16 15:25:00 -080050 // FIXME: remove once Zack completes cord-tester refactoring, as master is
51 // currently broken for siab tests.
52 stage('Cord-tester fix') {
53 steps {
54 sh """
55 pushd $WORKSPACE/cord/test/cord-tester
56 git checkout -b foo 7b3f901659a22c09e4759e343ad693b80125e06b
57 popd
58 """
59 }
60 }
Kailash31961642019-02-04 09:07:26 -080061
62 stage ('Reset Kubeadm') {
63 steps {
64 sh """
65 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
66 make reset-kubeadm
67 popd
68 """
69 }
70 }
71
72 stage ('Install SEBA') {
73 steps {
74 sh """
75 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
Kailash4853bb02019-02-12 12:53:14 -080076 make ${params.version}
Kailash31961642019-02-04 09:07:26 -080077 popd
78 """
79 }
80 }
81
82 stage ('Run E2E Tests') {
83 steps {
84 sh """
85 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
Andy Bavier5e92df62019-05-09 16:11:24 -070086 make ${params.Test_Target} ${params.Test_Tags} || true
Kailash31961642019-02-04 09:07:26 -080087 popd
88 """
89 }
90 }
91
92 stage ('Display Kafka Events') {
93 steps {
94 sh """
95 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
96 CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
97 kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
98 kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
99 kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
100 popd
101 """
102 }
103 }
104
105 stage('Publish') {
106 steps {
107 sh """
108 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
109 cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/WorkflowValidations/*ml ./RobotLogs
110 """
111 step([$class: 'RobotPublisher',
112 disableArchiveOutput: false,
113 logFileName: 'RobotLogs/log*.html',
114 otherFiles: '',
115 outputFileName: 'RobotLogs/output*.xml',
116 outputPath: '.',
117 passThreshold: 100,
118 reportFileName: 'RobotLogs/report*.html',
119 unstableThreshold: 0]);
120 }
121 }
122
123 }
124
125 post {
126 always {
127 sh '''
Kailash842cd872019-03-13 13:56:38 -0700128 kubectl describe pods > $WORKSPACE/kube_pods.log
129 kubectl describe pods -n voltha > $WORKSPACE/kube_voltha_pods.log
Kailash31961642019-02-04 09:07:26 -0800130 sudo cp /var/log/containers/*.log $WORKSPACE/
131 sudo chown cord:cord $WORKSPACE/*log
132 '''
133 archiveArtifacts artifacts: '*.log'
134 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "andy@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false])
135 }
136 failure {
137 sh '''
138 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices
139 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices/of:0000000000000001/ports
140 curl -X GET http://127.0.0.1:30125/api/v1/devices
141 curl -X GET http://127.0.0.1:30125/api/v1/logical_devices
142 '''
143 }
144 }
145}