From 44fae2966c8ec9908fa8b1035c79ca66af5f92df Mon Sep 17 00:00:00 2001 From: Danny Allen Date: Mon, 8 Jun 2020 10:25:34 -0700 Subject: [PATCH] [mgmt] Add PR test for sonic-mgmt repo (#110) Signed-off-by: Danny Allen --- jenkins/mgmt/sonic-mgmt-pr/Jenkinsfile | 50 ++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 jenkins/mgmt/sonic-mgmt-pr/Jenkinsfile diff --git a/jenkins/mgmt/sonic-mgmt-pr/Jenkinsfile b/jenkins/mgmt/sonic-mgmt-pr/Jenkinsfile new file mode 100644 index 000000000000..94ec2c90fa09 --- /dev/null +++ b/jenkins/mgmt/sonic-mgmt-pr/Jenkinsfile @@ -0,0 +1,50 @@ +pipeline { + agent { + node { label 'jenkins-kvmtest-workers' } + } + + options { + buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '60')) + } + + stages { + stage('Prepare') { + steps { + dir('sonic-mgmt') { + checkout([$class: 'GitSCM', + branches: [[name: '${sha1}']], + userRemoteConfigs: [[url: 'https://github.com/Azure/sonic-mgmt', + refspec: '+refs/pull/*:refs/remotes/origin/pr/*']]]) + } + copyArtifacts(projectName: 'bldenv/docker-sonic-mgmt', filter: '**/docker-sonic-mgmt.gz', target: 'mgmt', flatten: true) + copyArtifacts(projectName: 'vs/buildimage-vs-image', filter: '**/sonic-vs.img.gz', target: 'vsimage', flatten: true) + } + } + + stage('Test') { + steps { + wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { + lock(resource: "kvmtest_${env.NODE_NAME}") { + withCredentials([sshUserPrivateKey(credentialsId: '2b6b6afe-4892-41d1-967c-d683e7773727', keyFileVariable: 'VM_USER_PRIVATE_KEY'), \ + usernamePassword(credentialsId: 'sonicdev-cr', usernameVariable: 'REGISTRY_USERNAME', passwordVariable: 'REGISTRY_PASSWD')]) { + sh './scripts/mgmt/test.sh' + } + } + } + } + + post { + always { + junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'sonic-mgmt/tests/results/**/*.xml') + archiveArtifacts(artifacts: 'sonic-mgmt/tests/results/**, sonic-mgmt/tests/logs/**') + } + } + } + } + + post { + cleanup { + cleanWs(disableDeferredWipeout: false, deleteDirs: true, notFailBuild: true) + } + } +}