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