Skip to content

Commit 030b6d7

Browse files
authored
[vsbuild]: move test stage to jenkins-vstest-worker (sonic-net#88)
1 parent 5360d94 commit 030b6d7

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

jenkins/vs/buildimage-vs-all/Jenkinsfile

+30-8
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@ pipeline {
1010
pollSCM('@midnight')
1111
}
1212

13-
1413
stages {
1514
stage('Prepare') {
1615
steps {
17-
checkout([$class: 'GitSCM',
16+
checkout([$class: 'GitSCM',
1817
branches: [[name: 'refs/heads/master']],
1918
extensions: [[$class: 'SubmoduleOption',
2019
disableSubmodules: false,
@@ -31,37 +30,60 @@ pipeline {
3130
sh '''
3231
#!/bin/bash -xe
3332
33+
echo ${JOB_NAME##*/}.${BUILD_NUMBER}
34+
3435
git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $(realpath --relative-to=. $(cut -d" " -f2 .git))" > .git'
3536
3637
make configure PLATFORM=vs
3738
make SONIC_CONFIG_BUILD_JOBS=1 target/docker-sonic-vs.gz
38-
39+
sudo cp target/docker-sonic-vs.gz /nfs/jenkins/docker-sonic-vs.${JOB_NAME##*/}.${BUILD_NUMBER}.gz
3940
'''
4041
}
4142
}
4243

4344
stage('Test') {
45+
agent { node { label 'jenkins-vstest-workers' } }
46+
4447
steps {
48+
49+
checkout([$class: 'GitSCM',
50+
branches: [[name: 'refs/heads/master']],
51+
extensions: [[$class: 'SubmoduleOption',
52+
disableSubmodules: false,
53+
parentCredentials: false,
54+
recursiveSubmodules: true,
55+
reference: '',
56+
trackingSubmodules: false]],
57+
userRemoteConfigs: [[url: 'http://github.com/Azure/sonic-buildimage']]])
58+
4559
wrap([$class: 'AnsiColorBuildWrapper', 'colorMapName': 'xterm']) {
4660
lock(resource: "vstest_${env.NODE_NAME}") {
4761
sh '''
4862
#!/bin/bash -xe
4963
50-
docker load < target/docker-sonic-vs.gz
64+
cleanup() {
65+
docker rmi docker-sonic-vs:${JOB_NAME##*/}.${BUILD_NUMBER}
66+
}
67+
sudo docker load -i /nfs/jenkins/docker-sonic-vs.${JOB_NAME##*/}.${BUILD_NUMBER}.gz
68+
docker tag docker-sonic-vs:latest docker-sonic-vs:${JOB_NAME##*/}.${BUILD_NUMBER}
69+
sudo rm /nfs/jenkins/docker-sonic-vs.${JOB_NAME##*/}.${BUILD_NUMBER}.gz
5170
5271
cd platform/vs/tests
53-
sudo py.test -v --junitxml=tr.xml
72+
sudo py.test -v --junitxml=tr.xml --imgname=docker-sonic-vs:${JOB_NAME##*/}.${BUILD_NUMBER}
73+
cleanup
5474
'''
5575
}
5676
}
5777
}
78+
post {
79+
always {
80+
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'platform/vs/tests/tr.xml')
81+
}
82+
}
5883
}
5984

6085
}
6186
post {
62-
always {
63-
junit(allowEmptyResults: true, keepLongStdio: true, testResults: 'platform/vs/tests/tr.xml')
64-
}
6587
success {
6688
archiveArtifacts(artifacts: 'target/**, platform/vs/**')
6789
}

0 commit comments

Comments
 (0)