Skip to content

Commit 44fae29

Browse files
authored
[mgmt] Add PR test for sonic-mgmt repo (sonic-net#110)
Signed-off-by: Danny Allen <[email protected]>
1 parent 7cca8ff commit 44fae29

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

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

0 commit comments

Comments
 (0)