Kailash | c7b90d5 | 2019-03-08 12:54:26 -0800 | [diff] [blame] | 1 | // Copyright 2017-present Open Networking Foundation |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | shortCommit = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim() |
| 16 | |
| 17 | node ('qct-pod3-node2') { |
| 18 | timeout (time: 1200) { |
| 19 | try { |
| 20 | stage ('Get Latest Code') { |
| 21 | sh """ |
| 22 | cd /home/cord/openolt |
| 23 | git pull |
| 24 | """ |
| 25 | } |
| 26 | stage ('Clean Environment') { |
| 27 | sh """ |
| 28 | cd /home/cord/openolt/agent |
| 29 | make OPENOLTDEVICE=asfvolt16 clean |
| 30 | """ |
| 31 | } |
| 32 | stage ('Build OpenOLT Deb') { |
| 33 | sh """ |
| 34 | cd /home/cord/openolt/agent |
| 35 | make OPENOLTDEVICE=asfvolt16 prereq |
| 36 | make OPENOLTDEVICE=asfvolt16 |
| 37 | make OPENOLTDEVICE=asfvolt16 deb |
| 38 | """ |
| 39 | } |
| 40 | stage ('Save Deb Record') { |
| 41 | sh """ |
| 42 | cd /home/cord/openolt/agent/build |
| 43 | cp openolt.deb /home/cord/olt_builds/openolt-\$shortCommit.deb |
| 44 | """ |
| 45 | } |
| 46 | currentBuild.result = 'SUCCESS' |
| 47 | } catch (err) { |
| 48 | currentBuild.result = 'FAILURE' |
| 49 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| 50 | } finally { |
| 51 | echo "RESULT: ${currentBuild.result}" |
| 52 | } |
| 53 | } |
| 54 | } |