blob: 4a5cac087a5781e642a16d5c68e155e2a8626ad2 [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}"
8 }
9
10 stages {
11
12 stage ("Clean workspace") {
13 steps {
Kailash3f6b9ac2019-02-04 10:32:20 -080014 sh 'cd $WORKSPACE; rm -rf *'
Kailash31961642019-02-04 09:07:26 -080015 }
16 }
17
18 stage('repo') {
19 steps {
20 checkout(changelog: false, \
21 poll: false,
22 scm: [$class: 'RepoScm', \
Kailash3f6b9ac2019-02-04 10:32:20 -080023 manifestRepositoryUrl: "https://gerrit.opencord.org/manifest.git", \
24 manifestBranch: "master", \
Kailash31961642019-02-04 09:07:26 -080025 currentBranch: true, \
26 destinationDir: 'cord', \
27 forceSync: true,
28 resetFirst: true, \
29 quiet: true, \
30 jobs: 4, \
31 showAllChanges: true] \
32 )
33 }
34 }
35
36 stage('patch') {
37 steps {
38 sh """
39 pushd $WORKSPACE/cord
40 repo download helm-charts "${gerritChangeNumber}/${gerritPatchsetNumber}"
41 popd
42 """
43 }
44 }
45
46
47 stage ('Reset Kubeadm') {
48 steps {
49 sh """
50 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
51 make reset-kubeadm
52 popd
53 """
54 }
55 }
56
57 stage ('Install SEBA') {
58 steps {
59 sh """
60 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
61 make
62 popd
63 """
64 }
65 }
66
67 stage ('Run E2E Tests') {
68 steps {
69 sh """
70 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
71 make run-tests ${params.Test_Tags} || true
72 popd
73 """
74 }
75 }
76
77 stage ('Display Kafka Events') {
78 steps {
79 sh """
80 pushd $WORKSPACE/cord/automation-tools/seba-in-a-box
81 CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192)
82 kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
83 kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
84 kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0'
85 popd
86 """
87 }
88 }
89
90 stage('Publish') {
91 steps {
92 sh """
93 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs
94 cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/WorkflowValidations/*ml ./RobotLogs
95 """
96 step([$class: 'RobotPublisher',
97 disableArchiveOutput: false,
98 logFileName: 'RobotLogs/log*.html',
99 otherFiles: '',
100 outputFileName: 'RobotLogs/output*.xml',
101 outputPath: '.',
102 passThreshold: 100,
103 reportFileName: 'RobotLogs/report*.html',
104 unstableThreshold: 0]);
105 }
106 }
107
108 }
109
110 post {
111 always {
112 sh '''
113 sudo cp /var/log/containers/*.log $WORKSPACE/
114 sudo chown cord:cord $WORKSPACE/*log
115 '''
116 archiveArtifacts artifacts: '*.log'
117 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "andy@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false])
118 }
119 failure {
120 sh '''
121 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices
122 curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices/of:0000000000000001/ports
123 curl -X GET http://127.0.0.1:30125/api/v1/devices
124 curl -X GET http://127.0.0.1:30125/api/v1/logical_devices
125 '''
126 }
127 }
128}