Kailash Khalasi | f005fcb | 2018-10-02 12:52:03 -0700 | [diff] [blame] | 1 | /* seba-in-a-box build+test */ |
| 2 | |
| 3 | pipeline { |
| 4 | |
| 5 | /* no label, executor is determined by JJB */ |
| 6 | agent { |
| 7 | label "${params.executorNode}" |
| 8 | } |
| 9 | |
Kailash | a2ee5fa | 2019-02-19 09:14:34 -0800 | [diff] [blame] | 10 | options { |
| 11 | timeout(time: 1, unit: 'HOURS') |
| 12 | } |
| 13 | |
Kailash Khalasi | f005fcb | 2018-10-02 12:52:03 -0700 | [diff] [blame] | 14 | stages { |
| 15 | |
| 16 | stage ("Clean workspace") { |
| 17 | steps { |
| 18 | sh 'rm -rf *' |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | stage ('Checkout Automation-Tools Repo') { |
| 23 | steps { |
| 24 | sh ''' |
| 25 | pushd $WORKSPACE |
| 26 | git clone https://gerrit.opencord.org/automation-tools |
| 27 | popd |
| 28 | ''' |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | stage ('Reset Kubeadm') { |
| 33 | steps { |
| 34 | sh """ |
| 35 | pushd $WORKSPACE/automation-tools/seba-in-a-box |
| 36 | make reset-kubeadm |
| 37 | popd |
| 38 | """ |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | stage ('Install SEBA') { |
| 43 | steps { |
| 44 | sh """ |
| 45 | pushd $WORKSPACE/automation-tools/seba-in-a-box |
Kailash | 4853bb0 | 2019-02-12 12:53:14 -0800 | [diff] [blame] | 46 | make ${params.version} |
Kailash Khalasi | f005fcb | 2018-10-02 12:52:03 -0700 | [diff] [blame] | 47 | popd |
| 48 | """ |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | stage ('Run E2E Tests') { |
| 53 | steps { |
| 54 | sh """ |
| 55 | pushd $WORKSPACE/automation-tools/seba-in-a-box |
Kailash Khalasi | d0c5ecf | 2018-10-19 13:52:37 -0700 | [diff] [blame] | 56 | make run-tests ${params.Test_Tags} || true |
Kailash Khalasi | f005fcb | 2018-10-02 12:52:03 -0700 | [diff] [blame] | 57 | popd |
| 58 | """ |
| 59 | } |
| 60 | } |
| 61 | |
Kailash Khalasi | daa056e | 2018-10-12 09:58:26 -0700 | [diff] [blame] | 62 | stage ('Display Kafka Events') { |
| 63 | steps { |
| 64 | sh """ |
| 65 | pushd $WORKSPACE/automation-tools/seba-in-a-box |
| 66 | CORD_KAFKA_IP=\$(kubectl exec cord-kafka-0 -- ip a | grep -oE "([0-9]{1,3}\\.){3}[0-9]{1,3}\\b" | grep 192) |
| 67 | kafkacat -e -C -b \$CORD_KAFKA_IP -t onu.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0' |
| 68 | kafkacat -e -C -b \$CORD_KAFKA_IP -t authentication.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0' |
| 69 | kafkacat -e -C -b \$CORD_KAFKA_IP -t dhcp.events -f 'Topic %t [%p] at offset %o: key %k: %s\n >0' |
| 70 | popd |
| 71 | """ |
| 72 | } |
| 73 | } |
| 74 | |
Kailash Khalasi | f005fcb | 2018-10-02 12:52:03 -0700 | [diff] [blame] | 75 | stage('Publish') { |
| 76 | steps { |
| 77 | sh """ |
| 78 | if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs |
| 79 | cp -r $WORKSPACE/cord/test/cord-tester/src/test/cord-api/Tests/WorkflowValidations/*ml ./RobotLogs |
| 80 | """ |
| 81 | step([$class: 'RobotPublisher', |
| 82 | disableArchiveOutput: false, |
| 83 | logFileName: 'RobotLogs/log*.html', |
| 84 | otherFiles: '', |
| 85 | outputFileName: 'RobotLogs/output*.xml', |
| 86 | outputPath: '.', |
| 87 | passThreshold: 100, |
| 88 | reportFileName: 'RobotLogs/report*.html', |
| 89 | unstableThreshold: 0]); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | } |
| 94 | |
| 95 | post { |
| 96 | always { |
| 97 | sh ''' |
Kailash | 842cd87 | 2019-03-13 13:56:38 -0700 | [diff] [blame] | 98 | kubectl describe pods > $WORKSPACE/kube_pods.log |
| 99 | kubectl describe pods -n voltha > $WORKSPACE/kube_voltha_pods.log |
Kailash Khalasi | 2a1e24b | 2018-10-02 14:15:59 -0700 | [diff] [blame] | 100 | sudo cp /var/log/containers/*.log $WORKSPACE/ |
| 101 | sudo chown cord:cord $WORKSPACE/*log |
Kailash Khalasi | f005fcb | 2018-10-02 12:52:03 -0700 | [diff] [blame] | 102 | ''' |
Kailash Khalasi | 2a1e24b | 2018-10-02 14:15:59 -0700 | [diff] [blame] | 103 | archiveArtifacts artifacts: '*.log' |
Kailash Khalasi | f005fcb | 2018-10-02 12:52:03 -0700 | [diff] [blame] | 104 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "andy@opennetworking.org, kailash@opennetworking.org", sendToIndividuals: false]) |
| 105 | } |
Kailash Khalasi | bb2042e | 2018-10-04 09:41:49 -0700 | [diff] [blame] | 106 | failure { |
| 107 | sh ''' |
| 108 | curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices |
| 109 | curl -X GET -u karaf:karaf http://127.0.0.1:30120/onos/v1/devices/of:0000000000000001/ports |
| 110 | curl -X GET http://127.0.0.1:30125/api/v1/devices |
| 111 | curl -X GET http://127.0.0.1:30125/api/v1/logical_devices |
| 112 | ''' |
| 113 | } |
Kailash Khalasi | f005fcb | 2018-10-02 12:52:03 -0700 | [diff] [blame] | 114 | } |
| 115 | } |