|
| 1 | +pipeline { |
| 2 | + agent { |
| 3 | + node { label 'jenkins-kvmtest-workers' } |
| 4 | + } |
| 5 | + |
| 6 | + options { |
| 7 | + buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '30')) |
| 8 | + } |
| 9 | + |
| 10 | + triggers { |
| 11 | + pollSCM('@midnight') |
| 12 | + } |
| 13 | + |
| 14 | + stages { |
| 15 | + stage('Prepare') { |
| 16 | + steps { |
| 17 | + dir('sonic-mgmt') { |
| 18 | + checkout([$class: 'GitSCM', |
| 19 | + branches: [[name: '*/master']], |
| 20 | + userRemoteConfigs: [[url: 'https://github.com/Azure/sonic-mgmt']]]) |
| 21 | + } |
| 22 | + copyArtifacts(projectName: 'bldenv/docker-sonic-mgmt', filter: '**/docker-sonic-mgmt.gz', target: 'mgmt', flatten: true) |
| 23 | + copyArtifacts(projectName: 'vs/buildimage-vs-image', filter: '**/sonic-vs.img.gz', target: 'vsimage', flatten: true) |
| 24 | + } |
| 25 | + } |
| 26 | + |
| 27 | + stage('Test') { |
| 28 | + steps { |
| 29 | + wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { |
| 30 | + lock(resource: "kvmtest_${env.NODE_NAME}") { |
| 31 | + withCredentials([sshUserPrivateKey(credentialsId: '2b6b6afe-4892-41d1-967c-d683e7773727', keyFileVariable: 'VM_USER_PRIVATE_KEY'), \ |
| 32 | + usernamePassword(credentialsId: 'sonicdev-cr', usernameVariable: 'REGISTRY_USERNAME', passwordVariable: 'REGISTRY_PASSWD')]) { |
| 33 | + sh './scripts/mgmt/test.sh' |
| 34 | + } |
| 35 | + } |
| 36 | + } |
| 37 | + } |
| 38 | + |
| 39 | + post { |
| 40 | + always { |
| 41 | + junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/results/**/*.xml') |
| 42 | + archiveArtifacts(artifacts: 'sonic-mgmt/tests/results/**, sonic-mgmt/tests/logs/**') |
| 43 | + } |
| 44 | + } |
| 45 | + } |
| 46 | + } |
| 47 | + |
| 48 | + post { |
| 49 | + cleanup { |
| 50 | + cleanWs(disableDeferredWipeout: false, deleteDirs: true, notFailBuild: true) |
| 51 | + } |
| 52 | + } |
| 53 | +} |
0 commit comments