forked from dotnet/dotnet-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
76 lines (69 loc) · 2.96 KB
/
netci.groovy
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
import jobs.generation.Utilities
def project = GithubProject
def branch = GithubBranchName
def isPR = true
def platformList = [
'Ubuntu16.04:Linux',
'Windows_2016:NanoServer-sac2016',
'Windows_2016:NanoServer-1709',
'Windows_2016:NanoServer-1803',
'Windows_2016:NanoServer-1809'
]
platformList.each { platform ->
def(hostOS, containerOS) = platform.tokenize(':')
def machineLabel = (hostOS == 'Windows_2016') ? 'latest-docker' : 'latest-or-auto-docker'
if (containerOS == 'NanoServer-1709' || containerOS == 'NanoServer-1803' || containerOS == 'NanoServer-1809') {
versionList = ['2.1', '2.2', '3.0']
}
else if (containerOS == 'NanoServer-sac2016') {
versionList = ['1.', '2.1', '2.2', '3.0']
}
else {
versionList = ['1.', '2.1-2.2', '3.0']
}
versionList.each { version ->
def newJobName = Utilities.getFullJobName(project, "${containerOS}_${version}", isPR)
def versionFilters = version.tokenize( '-' )
def newJob = job(newJobName) {
steps {
if (hostOS == 'Windows_2016') {
batchFile("powershell -NoProfile -Command .\\scripts\\Invoke-CleanupDocker.ps1")
try {
versionFilters.each { versionFilter ->
batchFile("powershell -NoProfile -Command .\\build-and-test.ps1 -VersionFilter \"${versionFilter}*\" -OSFilter \"${containerOS}\"")
}
}
finally {
batchFile("powershell -NoProfile -Command .\\scripts\\Invoke-CleanupDocker.ps1")
}
}
else {
shell("./scripts/cleanup-docker.sh")
try {
shell("docker build --rm -t testrunner -f ./tests/Dockerfile.linux.testrunner .")
versionFilters.each { versionFilter ->
shell("docker run -v /var/run/docker.sock:/var/run/docker.sock testrunner pwsh -File build-and-test.ps1 -VersionFilter \"${versionFilter}*\"")
}
}
finally {
shell("./scripts/cleanup-docker.sh")
}
}
}
}
if (containerOS == 'NanoServer-1709') {
newJob.with {label('windows.10.amd64.serverrs3.open')}
}
else if (containerOS == 'NanoServer-1803') {
newJob.with {label('windows.10.amd64.serverrs4.open')}
}
else if (containerOS == 'NanoServer-1809') {
newJob.with {label('windows.10.amd64.serverrs5.open')}
}
else {
Utilities.setMachineAffinity(newJob, hostOS, machineLabel)
}
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${containerOS} - ${version} Dockerfiles")
}
}