Kailash Khalasi | 8e12ccd | 2018-09-27 13:20:25 -0700 | [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 | repos = params.repos.split(",") |
Kailash Khalasi | f7608a6 | 2018-10-11 09:00:30 -0700 | [diff] [blame] | 16 | echo repos[0] |
Kailash Khalasi | 8e12ccd | 2018-09-27 13:20:25 -0700 | [diff] [blame] | 17 | |
| 18 | node ("${TestNodeName}") { |
| 19 | timeout (100) { |
| 20 | try { |
| 21 | stage ("Cleanup") { |
| 22 | sh returnStdout: true, script: "rm -rf *" |
| 23 | } |
| 24 | stage ("Check repositories") { |
Kailash Khalasi | f7608a6 | 2018-10-11 09:00:30 -0700 | [diff] [blame] | 25 | |
| 26 | for(int i=0; i < repos.size(); i++) { |
| 27 | checkRepo(repos[i]) |
| 28 | } |
Kailash Khalasi | 8e12ccd | 2018-09-27 13:20:25 -0700 | [diff] [blame] | 29 | } |
| 30 | currentBuild.result = 'SUCCESS' |
| 31 | } catch (err) { |
| 32 | currentBuild.result = 'FAILURE' |
| 33 | step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false]) |
| 34 | } |
| 35 | echo "RESULT: ${currentBuild.result}" |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | def checkRepo(repo) { |
Kailash Khalasi | 8e12ccd | 2018-09-27 13:20:25 -0700 | [diff] [blame] | 40 | withCredentials([sshUserPrivateKey(credentialsId: '315e1f56-7193-464e-8af1-97bf7b1ee541', keyFileVariable: 'KEY')]) { |
| 41 | sh returnStdout: true, script: """ |
| 42 | chmod 600 $KEY && eval `ssh-agent -s` && ssh-add $KEY && |
| 43 | ssh-keyscan -p 29418 gerrit.opencord.org >> ~/.ssh/known_hosts && |
| 44 | git clone -b ${branch} ssh://mcord-private@gerrit.opencord.org:29418/${repo} |
| 45 | """ |
| 46 | } |
Kailash Khalasi | f7608a6 | 2018-10-11 09:00:30 -0700 | [diff] [blame] | 47 | hub_detect("--detect.source.path=${repo} --detect.project.name=${prefix}-${repo} --detect.project.version.name=${branch} --snippet-matching --full-snippet-scan") |
Kailash Khalasi | 8e12ccd | 2018-09-27 13:20:25 -0700 | [diff] [blame] | 48 | } |