Skip to content

Commit

Permalink
[vsbuild]: move test stage to jenkins-vstest-worker (sonic-net#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
lguohan authored Mar 17, 2020
1 parent 5360d94 commit 030b6d7
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions jenkins/vs/buildimage-vs-all/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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/**')
}
Expand Down

0 comments on commit 030b6d7

Please sign in to comment.