forked from vmware-archive/vsphere-storage-for-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
216 lines (202 loc) · 8.77 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
pipeline {
agent none
stages {
stage('Checkout code') {
failFast true
parallel {
stage('Checkout for ESX 6.5 runs') {
/* Let's make sure we have the repository cloned to our workspace. */
agent {
label "vdvs-65-slaves"
}
steps {
checkout scm
}
}
stage('Checkout for ESX 6.0 runs') {
/* Let's make sure we have the repository cloned to our workspace..*/
agent {
label "vdvs-60-slaves"
}
steps {
checkout scm
}
}
}
}
stage('Build binaries') {
/* This builds VDVS binaries */
failFast true
parallel {
stage('Build binaries for ESX 6.5 runs') {
agent {
label "vdvs-65-slaves"
}
steps {
sh "echo Building the VDVS binaries"
sh "export PKG_VERSION=$BUILD_NUMBER"
sh "make build-all"
}
}
stage('Build binaries for ESX 6.0 runs') {
agent {
label "vdvs-60-slaves"
}
steps {
sh "echo Building the VDVS binaries"
sh "export PKG_VERSION=$BUILD_NUMBER"
sh "make build-all"
}
}
}
}
stage('Deployment') {
failFast true
parallel {
stage('Deploy binaries for ESX 6.5 runs') {
agent {
label "vdvs-65-slaves"
}
steps {
sh "echo Deployment On 6.5 setup"
sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
sh "echo deploying binaries"
sh "make deploy-all"
sh "echo finished deploying the binaries"
}
}
stage('Deploy binaries for ESX 6.0 runs') {
agent {
label "vdvs-60-slaves"
}
steps {
sh "echo Deployment On 6.0 setup"
sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
sh "echo deploying binaries"
sh "make deploy-all"
sh "echo finished deploying the binaries"
}
}
}
}
stage('Test VDVS') {
failFast true
parallel {
stage('Run tests on ESX 6.5') {
agent {
label "vdvs-65-slaves"
}
steps {
sh "echo Test VDVS On 6.5 setup"
sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
sh "echo starting e2e tests"
sh "make test-e2e"
sh "make test-esx"
sh "make test-vm"
}
}
stage('Run tests on ESX 6.0') {
agent {
label "vdvs-60-slaves"
}
steps {
sh "echo Test VDVS On 6.0 setup"
sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3; echo PKG_VERSION"
sh "echo starting e2e tests"
sh "make test-e2e"
sh "make test-esx"
sh "make test-vm"
}
}
}
}
stage('Test vFile') {
failFast true
parallel {
stage('Run vFile tests on ESX 6.5') {
agent {
label "vdvs-65-slaves"
}
steps {
script{
def stopContainers = "docker stop \$(docker ps -a -q) 2> /dev/null || true"
def removeContainers = "docker rm \$(docker ps -a -q) 2> /dev/null || true"
def removeVolumes = "docker volume rm \$(docker volume ls -q -f dangling=true) 2> /dev/null || true"
try{
sh "echo Build, deploy, and test vFile on 6.5 setup"
sh "echo Build vFile binaries"
sh "echo ESX = $ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3;"
sh "make build-vfile-all"
sh "echo Deploy the vFile binaries"
sh "make deploy-vfile-plugin"
sh "echo Start the vFile tests"
sh "make test-e2e-vfile"
sh "echo vFile tests finished"
} finally{
sh "ssh ${env.GOVC_USERNAME}@$VM1 ${stopContainer}; ${removeContainer}; ${removeVolume}"
sh "ssh ${env.GOVC_USERNAME}@$VM2 ${stopContainer}; ${removeContainer}; ${removeVolume}"
sh "ssh ${env.GOVC_USERNAME}@$VM3 ${stopContainer}; ${removeContainer}; ${removeVolume}"
sh "make clean-vfile"
sh "make clean-all"
}
}
}
}
stage('Run vFile tests on ESX 6.0') {
agent {
label "vdvs-60-slaves"
}
steps {
script{
def stopContainers = "docker stop \$(docker ps -a -q) 2> /dev/null || true"
def removeContainers = "docker rm \$(docker ps -a -q) 2> /dev/null || true"
def removeVolumes = "docker volume rm \$(docker volume ls -q -f dangling=true) 2> /dev/null || true"
try{
echo "Build, deploy, and test vFile on 6.0 setup"
sh "echo Build vFile binaries"
sh "echo ESX=$ESX; echo VM1=$VM1; echo VM2=$VM2; echo VM3=$VM3;"
sh "make build-vfile-all"
sh "echo Deploy the vFile binaries"
sh "make deploy-vfile-plugin"
sh "echo Run the vFile tests"
sh "make test-e2e-vfile"
sh "echo vFile tests finished"
}finally{
sh "ssh ${env.GOVC_USERNAME}@$VM1 ${stopContainer}; ${removeContainer}; ${removeVolume}"
sh "ssh ${env.GOVC_USERNAME}@$VM2 ${stopContainer}; ${removeContainer}; ${removeVolume}"
sh "ssh ${env.GOVC_USERNAME}@$VM3 ${stopContainer}; ${removeContainer}; ${removeVolume}"
sh "make clean-vfile"
sh "make clean-all"
}
}
}
}
}
}
stage('Test Windows plugin') {
/* This builds, deploys and tests the windows binaries */
agent {
label "vdvs-65-slaves"
}
steps {
sh "echo Build, deploy, and test Windows plugin"
sh "echo Windows-VM=$WIN_VM1"
sh "echo Build Windows plugin binaries"
sh "make build-windows-plugin"
sh "echo Finished building binaries for windows"
sh "echo Deploy the Windows plugin binaries"
sh "make deploy-windows-plugin"
sh "echo Finished deploying binaries for windows"
sh "echo Run the Windows plugin tests"
sh "make test-e2e-windows"
sh "echo Windows plugin tests finished"
}
}
}
// The options directive is for configuration that applies to the whole job.
options {
// This ensures we only have 10 builds at a time, so
// we don't fill up our storage!
buildDiscarder(logRotator(numToKeepStr:'10'))
}
}