This repository has been archived by the owner on Aug 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
netci.groovy
153 lines (135 loc) · 6.85 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
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
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// Import the utility functionality.
import jobs.generation.Utilities;
import jobs.generation.ArchivalSettings;
def project = GithubProject
def branch = GithubBranchName
def isPR = true
def platformList = ['Debian8.2:x64:Debug', 'PortableLinux:x64:Release', 'Ubuntu:x64:Release', 'Ubuntu16.04:x64:Release', 'Ubuntu16.10:x64:Release', 'Ubuntu:arm:Release', 'Ubuntu16.04:arm:Release', 'OSX10.12:x64:Release', 'Windows_NT:x64:Release', 'Windows_NT:x86:Debug', 'Windows_NT:arm:Debug', 'Fedora24:x64:Debug', 'OpenSUSE42.1:x64:Debug']
def static getBuildJobName(def configuration, def os, def architecture) {
return configuration.toLowerCase() + '_' + os.toLowerCase() + '_' + architecture.toLowerCase()
}
platformList.each { platform ->
// Calculate names
def (os, architecture, configuration) = platform.tokenize(':')
// Calculate the job name
def jobName = getBuildJobName(configuration, os, architecture)
def buildCommand = '';
def osForGHTrigger = os
def version = "latest-or-auto"
def dockerRepository = "microsoft/dotnet-buildtools-prereqs"
def dockerContainer = ''
def dockerWorkingDirectory = "/src/core-setup"
def dockerCommand = ''
def crossbuildargs = ''
// Calculate build command
if (os == 'Windows_NT') {
buildCommand = ".\\build.cmd -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture}"
if ((architecture == 'arm' || architecture == 'arm64')) {
buildCommand += " -PortableBuild=true -SkipTests=true"
}
}
else if ((os.startsWith("Ubuntu")) &&
(architecture == 'arm' || architecture == 'armel')) {
if (os == 'Ubuntu') {
dockerContainer = "ubuntu-14.04-cross-0cd4667-20172211042239"
crossbuildargs = " -CrossBuild=true"
}
else if (os == 'Ubuntu16.04') {
dockerContainer = "ubuntu-16.04-cross-ef0ac75-20175511035548"
}
dockerCommand = "docker run -e ROOTFS_DIR=/crossrootfs/${architecture} --name ${dockerContainer} --rm -v \${WORKSPACE}:${dockerWorkingDirectory} -w=${dockerWorkingDirectory} ${dockerRepository}:${dockerContainer}"
buildCommand = "${dockerCommand} ./build.sh -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture} -PortableBuild=true -DistroRid=linux-${architecture} -SkipTests=true -DisableCrossgen=true${crossbuildargs}"
}
else if (os == "Ubuntu") {
dockerContainer = "ubuntu-14.04-debpkg-e5cf912-20175003025046"
dockerCommand = "docker run --name ${dockerContainer} --rm -v \${WORKSPACE}:${dockerWorkingDirectory} -w=${dockerWorkingDirectory} ${dockerRepository}:${dockerContainer}"
buildCommand = "${dockerCommand} ./build.sh -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture}"
}
else if (os == "PortableLinux") {
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand = "./build.sh -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture} -PortableBuild=true"
// Trigger a portable Linux build that runs on RHEL7.2
osForGHTrigger = "PortableLinux"
os = "RHEL7.2"
}
else {
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand = "./build.sh -ConfigurationGroup=${configuration} -TargetArchitecture=${architecture}"
}
def newJob = job(Utilities.getFullJobName(project, jobName, isPR)) {
// Set the label.
steps {
if (os == 'Windows_NT' || os == 'Windows_2016') {
// Batch
batchFile(buildCommand)
}
else {
// Shell
shell(buildCommand)
}
}
}
Utilities.setMachineAffinity(newJob, os, version)
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
if (!(architecture == 'arm')) {
Utilities.addMSTestResults(newJob, '**/*-testResults.trx')
}
if (os == 'Ubuntu16.04' && architecture == 'arm') {
// Don't enable by default
def contextString = "${osForGHTrigger} ${architecture} ${configuration}"
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${contextString} Build", "(?i).*test\\W+${contextString}.*", true /* trigger on comment phrase only */)
}
else {
Utilities.addGithubPRTriggerForBranch(newJob, branch, "${osForGHTrigger} ${architecture} ${configuration} Build")
}
ArchivalSettings settings = new ArchivalSettings();
def archiveString = ["tar.gz", "zip", "deb", "msi", "pkg", "exe", "nupkg"].collect { "Bin/*/packages/*.${it},Bin/*/corehost/*.${it}" }.join(",")
settings.addFiles(archiveString)
settings.setArchiveOnSuccess()
settings.setFailIfNothingArchived()
Utilities.addArchival(newJob, settings)
}
// **************************
// Define ARM64 building.
// **************************
//['Windows_NT'].each { os ->
// ['Release'].each { configurationGroup ->
// def newJobName = "${configurationGroup.toLowerCase()}_${os.toLowerCase()}_arm64"
// def arm64Users = ['ianhays', 'kyulee1', 'gkhanna79', 'weshaggard', 'stephentoub', 'rahku', 'ramarag']
// def newJob = job(Utilities.getFullJobName(project, newJobName, /* isPR */ false)) {
// steps {
// // build the world, but don't run the tests
// batchFile("build.cmd -ConfigurationGroup ${configurationGroup} -Architecure x64 -TargetArch arm64 -ToolsetDir C:\\ats2 -Framework netcoreapp1.1")
// }
// label("arm64")
//
// // Kick off the test run
// publishers {
// archiveArtifacts {
// pattern("artifacts/win10-arm64/packages/*.zip")
// pattern("artifacts/win10-arm64/corehost/*.nupkg")
// onlyIfSuccessful(true)
// allowEmpty(false)
// }
// }
// }
//
// // Set up standard options.
// Utilities.standardJobSetup(newJob, project, /* isPR */ false, "*/${branch}")
//
// // Set a daily trigger
// Utilities.addPeriodicTrigger(newJob, '@daily')
//
// // Set up a PR trigger that is only triggerable by certain members
// Utilities.addPrivateGithubPRTriggerForBranch(newJob, branch, "Windows_NT ARM64 ${configurationGroup} Build", "(?i).*test\\W+ARM64\\W+${os}\\W+${configurationGroup}", null, arm64Users)
//
// // Set up a per-push trigger
// Utilities.addGithubPushTrigger(newJob)
// }
//}
// Make the call to generate the help job
Utilities.createHelperJob(this, project, branch,
"Welcome to the ${project} Repository", // This is prepended to the help message
"Have a nice day!") // This is appended to the help message. You might put known issues here.