blob: 38774c06bc50f226aa086f28c1cebf4b0473874d [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 {
7 label "${params.executorNode}"
Kailashf2fde622019-02-15 21:38:43 -08008 options {
9 timeout(time: 1, unit: 'HOURS')
10 }
Kailash31961642019-02-04 09:07:26 -080011 }
12
13 stages {
14
15 stage ("Clean workspace") {
16 steps {
Kailash3f6b9ac2019-02-04 10:32:20 -080017 sh 'cd $WORKSPACE; rm -rf *'
Kailash31961642019-02-04 09:07:26 -080018 }
19 }
20
21 stage('repo') {
22 steps {
23 checkout(changelog: false, \
24 poll: false,
25 scm: [$class: 'RepoScm', \
Kailash3f6b9ac2019-02-04 10:32:20 -080026 manifestRepositoryUrl: "https://gerrit.opencord.org/manifest.git", \
27 manifestBranch: "master", \
Kailash31961642019-02-04 09:07:26 -080028 currentBranch: true, \
29 destinationDir: 'cord', \
30 forceSync: true,
31 resetFirst: true, \
32 quiet: true, \
33 jobs: 4, \
34 showAllChanges: true] \
35 )
36 }
37 }
38
39 stage('patch') {
40 steps {
41 sh """
42 pushd $WORKSPACE/cord
43 repo download helm-charts "${gerritChangeNumber}/${gerritPatchsetNumber}"
44 popd
45 """
46 }
47 }
48
49
50 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
74 make run-tests ${params.Test_Tags} || true
75 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 '''
116 sudo cp /var/log/containers/*.log $WORKSPACE/
117 sudo chown cord:cord $WORKSPACE/*log
118 '''
119 archiveArtifacts artifacts: '*.log'
120 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "andy@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false])
121 }
122 failure {
123 sh '''
124 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices
125 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices/of:0000000000000001/ports
126 curl -X GET http://127.0.0.1:30125/api/v1/devices
127 curl -X GET http://127.0.0.1:30125/api/v1/logical_devices
128 '''
129 }
130 }
131}