Kailash | 3196164 | 2019-02-04 09:07:26 -0800 | [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 | 3196164 | 2019-02-04 09:07:26 -0800 | [diff] [blame] | 14 | stages { |
| 15 | |
| 16 | stage ("Clean workspace") { |
| 17 | steps { |
Kailash | 3f6b9ac | 2019-02-04 10:32:20 -0800 | [diff] [blame] | 18 | sh 'cd $WORKSPACE; rm -rf *' |
Kailash | 3196164 | 2019-02-04 09:07:26 -0800 | [diff] [blame] | 19 | } |
| 20 | } |
| 21 | |
| 22 | stage('repo') { |
| 23 | steps { |
| 24 | checkout(changelog: false, \ |
| 25 | poll: false, |
| 26 | scm: [$class: 'RepoScm', \ |
Kailash | 3f6b9ac | 2019-02-04 10:32:20 -0800 | [diff] [blame] | 27 | manifestRepositoryUrl: "https://gerrit.opencord.org/manifest.git", \ |
| 28 | manifestBranch: "master", \ |
Kailash | 3196164 | 2019-02-04 09:07:26 -0800 | [diff] [blame] | 29 | 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 |
Kailash | 4853bb0 | 2019-02-12 12:53:14 -0800 | [diff] [blame] | 65 | make ${params.version} |
Kailash | 3196164 | 2019-02-04 09:07:26 -0800 | [diff] [blame] | 66 | 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 Bavier | 5e92df6 | 2019-05-09 16:11:24 -0700 | [diff] [blame] | 75 | make ${params.Test_Target} ${params.Test_Tags} || true |
Kailash | 3196164 | 2019-02-04 09:07:26 -0800 | [diff] [blame] | 76 | 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 ''' |
Kailash | 842cd87 | 2019-03-13 13:56:38 -0700 | [diff] [blame] | 117 | kubectl describe pods > $WORKSPACE/kube_pods.log |
| 118 | kubectl describe pods -n voltha > $WORKSPACE/kube_voltha_pods.log |
Kailash | 3196164 | 2019-02-04 09:07:26 -0800 | [diff] [blame] | 119 | 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 | } |