diff --git a/jenkins/vs/buildimage-vs-all/Jenkinsfile b/jenkins/vs/buildimage-vs-all/Jenkinsfile index 91f7270f4485..1a5f255e2a92 100644 --- a/jenkins/vs/buildimage-vs-all/Jenkinsfile +++ b/jenkins/vs/buildimage-vs-all/Jenkinsfile @@ -10,11 +10,10 @@ pipeline { pollSCM('@midnight') } - stages { stage('Prepare') { steps { - checkout([$class: 'GitSCM', + checkout([$class: 'GitSCM', branches: [[name: 'refs/heads/master']], extensions: [[$class: 'SubmoduleOption', disableSubmodules: false, @@ -31,37 +30,60 @@ pipeline { sh ''' #!/bin/bash -xe +echo ${JOB_NAME##*/}.${BUILD_NUMBER} + git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $(realpath --relative-to=. $(cut -d" " -f2 .git))" > .git' make configure PLATFORM=vs make SONIC_CONFIG_BUILD_JOBS=1 target/docker-sonic-vs.gz - +sudo cp target/docker-sonic-vs.gz /nfs/jenkins/docker-sonic-vs.${JOB_NAME##*/}.${BUILD_NUMBER}.gz ''' } } stage('Test') { + agent { node { label 'jenkins-vstest-workers' } } + steps { + + checkout([$class: 'GitSCM', + branches: [[name: 'refs/heads/master']], + extensions: [[$class: 'SubmoduleOption', + disableSubmodules: false, + parentCredentials: false, + recursiveSubmodules: true, + reference: '', + trackingSubmodules: false]], + userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]]) + wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) { lock(resource: "vstest_${env.NODE_NAME}") { sh ''' #!/bin/bash -xe -docker load < target/docker-sonic-vs.gz +cleanup() { + docker rmi docker-sonic-vs:${JOB_NAME##*/}.${BUILD_NUMBER} +} +sudo docker load -i /nfs/jenkins/docker-sonic-vs.${JOB_NAME##*/}.${BUILD_NUMBER}.gz +docker tag docker-sonic-vs:latest docker-sonic-vs:${JOB_NAME##*/}.${BUILD_NUMBER} +sudo rm /nfs/jenkins/docker-sonic-vs.${JOB_NAME##*/}.${BUILD_NUMBER}.gz cd platform/vs/tests -sudo py.test -v --junitxml=tr.xml +sudo py.test -v --junitxml=tr.xml --imgname=docker-sonic-vs:${JOB_NAME##*/}.${BUILD_NUMBER} +cleanup ''' } } } + post { + always { + junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'platform/vs/tests/tr.xml') + } + } } } post { - always { - junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'platform/vs/tests/tr.xml') - } success { archiveArtifacts(artifacts: 'target/**, platform/vs/**') }