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(",") |
| 16 | |
| 17 | def stepsForParallel = repos.collectEntries { |
| 18 | ["${it}" : checkRepo(it)] |
| 19 | } |
| 20 | |
| 21 | node ("${TestNodeName}") { |
| 22 | timeout (100) { |
| 23 | try { |
| 24 | stage ("Cleanup") { |
| 25 | sh returnStdout: true, script: "rm -rf *" |
| 26 | } |
| 27 | stage ("Check repositories") { |
| 28 | parallel stepsForParallel |
| 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) { |
| 40 | return { |
| 41 | withCredentials([sshUserPrivateKey(credentialsId: '315e1f56-7193-464e-8af1-97bf7b1ee541', keyFileVariable: 'KEY')]) { |
| 42 | sh returnStdout: true, script: """ |
| 43 | chmod 600 $KEY && eval `ssh-agent -s` && ssh-add $KEY && |
| 44 | ssh-keyscan -p 29418 gerrit.opencord.org >> ~/.ssh/known_hosts && |
| 45 | git clone -b ${branch} ssh://mcord-private@gerrit.opencord.org:29418/${repo} |
| 46 | """ |
| 47 | } |
| 48 | hub_detect("--detect.source.path=${repo} --detect.blackduck.signature.scanner.snippet.mode=true --detect.project.name=${prefix}-${repo} --detect.project.version.name=${branch} --detect.search.depth=20") |
| 49 | } |
| 50 | } |