blob: 20b905f99b8c2dd188fd40d039f1bc4f9e0afe13 [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
50
51 stage ('Reset Kubeadm') {
52 steps {
53 sh """
54 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
55 make reset-kubeadm
56 popd
57 """
58 }
59 }
60
61 stage ('Install SEBA') {
62 steps {
63 sh """
64 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
Kailash4853bb02019-02-12 12:53:14 -080065 make ${params.version}
Kailash31961642019-02-04 09:07:26 -080066 popd
67 """
68 }
69 }
70
71 stage ('Run E2E Tests') {
72 steps {
73 sh """
74 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
Andy Bavier5e92df62019-05-09 16:11:24 -070075 make ${params.Test_Target} ${params.Test_Tags} || true
Kailash31961642019-02-04 09:07:26 -080076 popd
77 """
78 }
79 }
80
81 stage ('Display Kafka Events') {
82 steps {
83 sh """
84 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
85 CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
86 kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
87 kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
88 kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
89 popd
90 """
91 }
92 }
93
94 stage('Publish') {
95 steps {
96 sh """
97 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
98 cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/WorkflowValidations/*ml ./RobotLogs
99 """
100 step([$class: 'RobotPublisher',
101 disableArchiveOutput: false,
102 logFileName: 'RobotLogs/log*.html',
103 otherFiles: '',
104 outputFileName: 'RobotLogs/output*.xml',
105 outputPath: '.',
106 passThreshold: 100,
107 reportFileName: 'RobotLogs/report*.html',
108 unstableThreshold: 0]);
109 }
110 }
111
112 }
113
114 post {
115 always {
116 sh '''
Kailash842cd872019-03-13 13:56:38 -0700117 kubectl describe pods > $WORKSPACE/kube_pods.log
118 kubectl describe pods -n voltha > $WORKSPACE/kube_voltha_pods.log
Kailash31961642019-02-04 09:07:26 -0800119 sudo cp /var/log/containers/*.log $WORKSPACE/
120 sudo chown cord:cord $WORKSPACE/*log
121 '''
122 archiveArtifacts artifacts: '*.log'
123 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "andy@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false])
124 }
125 failure {
126 sh '''
127 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices
128 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices/of:0000000000000001/ports
129 curl -X GET http://127.0.0.1:30125/api/v1/devices
130 curl -X GET http://127.0.0.1:30125/api/v1/logical_devices
131 '''
132 }
133 }
134}