@@ -10,11 +10,10 @@ pipeline {
10
10
pollSCM(' @midnight' )
11
11
}
12
12
13
-
14
13
stages {
15
14
stage(' Prepare' ) {
16
15
steps {
17
- checkout([$class : ' GitSCM' ,
16
+ checkout([$class : ' GitSCM' ,
18
17
branches : [[name : ' refs/heads/master' ]],
19
18
extensions : [[$class : ' SubmoduleOption' ,
20
19
disableSubmodules : false ,
@@ -31,37 +30,60 @@ pipeline {
31
30
sh '''
32
31
#!/bin/bash -xe
33
32
33
+ echo ${JOB_NAME##*/}.${BUILD_NUMBER}
34
+
34
35
git submodule foreach --recursive '[ -f .git ] && echo "gitdir: $(realpath --relative-to=. $(cut -d" " -f2 .git))" > .git'
35
36
36
37
make configure PLATFORM=vs
37
38
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
39
40
'''
40
41
}
41
42
}
42
43
43
44
stage(' Test' ) {
45
+ agent { node { label ' jenkins-vstest-workers' } }
46
+
44
47
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
+
45
59
wrap([$class : ' AnsiColorBuildWrapper' , ' colorMapName' : ' xterm' ]) {
46
60
lock(resource : " vstest_${ env.NODE_NAME} " ) {
47
61
sh '''
48
62
#!/bin/bash -xe
49
63
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
51
70
52
71
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
54
74
'''
55
75
}
56
76
}
57
77
}
78
+ post {
79
+ always {
80
+ junit(allowEmptyResults : true , keepLongStdio : true , testResults : ' platform/vs/tests/tr.xml' )
81
+ }
82
+ }
58
83
}
59
84
60
85
}
61
86
post {
62
- always {
63
- junit(allowEmptyResults : true , keepLongStdio : true , testResults : ' platform/vs/tests/tr.xml' )
64
- }
65
87
success {
66
88
archiveArtifacts(artifacts : ' target/**, platform/vs/**' )
67
89
}
0 commit comments