Skip to content

Commit b247296

Browse files
authored
Update Fedora28 to run in docker instead (#755)
1 parent 7922aa8 commit b247296

File tree

1 file changed

+48
-21
lines changed

1 file changed

+48
-21
lines changed

netci.groovy

Lines changed: 48 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -49,71 +49,98 @@ def getDockerImageForOs(os) {
4949
def imageMap = [
5050
'RHEL7.2': 'microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2',
5151
'CentOS7.1': 'microsoft/dotnet-buildtools-prereqs:centos-7-b46d863-20180719033416',
52+
'Fedora28': 'microsoft/dotnet-buildtools-prereqs:fedora-28-c103199-20180628122443',
5253
]
5354
return imageMap.get(os)
5455
}
5556

56-
def addBuildStepsAndSetMachineAffinity(def job, String os, String configuration) {
57+
def addBuildStepsAndSetMachineAffinity(def job, String os, String configuration, boolean runInDocker) {
58+
smokeTestExcludes = "";
59+
if (os == "OSX10.12") {
60+
// Dev certs doesn't seem to work in these platforms. https://github.com/dotnet/source-build/issues/560
61+
smokeTestExcludes += " --excludeWebHttpsTests";
62+
}
63+
5764
job.with {
5865
steps {
59-
if (os == "Windows_NT") {
60-
batchFile("git submodule update --init --recursive");
61-
batchFile(".\\build.cmd /p:Configuration=${configuration} ${loggingOptions}")
66+
if (runInDocker) {
67+
def imageName = getDockerImageForOs(os);
68+
69+
shell("git submodule update --init --recursive");
70+
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/code/home -v \$(pwd):/opt/code --rm -w /opt/code ${imageName} /opt/code/build.sh /p:Configuration=${configuration} ${loggingOptions}");
71+
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/code/home -v \$(pwd):/opt/code --rm -w /opt/code ${imageName} /opt/code/smoke-test.sh --minimal --configuration ${configuration} ${smokeTestExcludes}");
72+
73+
// Only Ubuntu Jenkins machines have Docker
74+
setMachineAffinity(job, "Ubuntu16.04");
6275
}
6376
else {
64-
shell("git submodule update --init --recursive");
65-
shell("./build.sh /p:Configuration=${configuration} ${loggingOptions}");
66-
smokeTestExcludes = "";
67-
if (os == "OSX10.12") {
68-
// Dev certs doesn't seem to work in these platforms. https://github.com/dotnet/source-build/issues/560
69-
smokeTestExcludes += " --excludeWebHttpsTests";
77+
if (os == "Windows_NT") {
78+
batchFile("git submodule update --init --recursive");
79+
batchFile(".\\build.cmd /p:Configuration=${configuration} ${loggingOptions}")
80+
}
81+
else {
82+
shell("git submodule update --init --recursive");
83+
shell("./build.sh /p:Configuration=${configuration} ${loggingOptions}");
84+
shell("./smoke-test.sh --minimal --configuration ${configuration} ${smokeTestExcludes}");
7085
}
71-
shell("./smoke-test.sh --minimal --configuration ${configuration} ${smokeTestExcludes}");
86+
setMachineAffinity(job, os);
7287
}
7388
};
7489
};
7590

76-
setMachineAffinity(job, os);
91+
7792
}
7893

79-
def addPullRequestJob(String project, String branch, String os, String configuration, boolean runByDefault)
94+
def addPullRequestJob(String project, String branch, String os, String configuration, boolean runInDocker, boolean runByDefault)
8095
{
8196
def newJobName = Utilities.getFullJobName(project, "${os}_${configuration}", true);
8297
def contextString = "${os} ${configuration}";
8398
def triggerPhrase = "(?i).*test\\W+${contextString}.*";
8499

85100
def newJob = job(newJobName);
86101

87-
addBuildStepsAndSetMachineAffinity(newJob, os, configuration);
102+
addBuildStepsAndSetMachineAffinity(newJob, os, configuration, runInDocker);
88103
addArchival(newJob);
89104
Utilities.standardJobSetup(newJob, project, true, "*/${branch}");
90105
Utilities.setJobTimeout(newJob, 180);
91106
Utilities.addGithubPRTriggerForBranch(newJob, branch, contextString, triggerPhrase, !runByDefault);
92107
}
93108

94-
def addPushJob(String project, String branch, String os, String configuration)
109+
def addPushJob(String project, String branch, String os, String configuration, boolean runInDocker)
95110
{
96111
def shortJobName = "${os}_${configuration}";
97112

98113
def newJobName = Utilities.getFullJobName(project, shortJobName, false);
99114
def newJob = job(newJobName);
100115

101-
addBuildStepsAndSetMachineAffinity(newJob, os, configuration);
116+
addBuildStepsAndSetMachineAffinity(newJob, os, configuration, runInDocker);
102117
addArchival(newJob);
103118
Utilities.standardJobSetup(newJob, project, false, "*/${branch}");
104119
Utilities.setJobTimeout(newJob, 180);
105120
Utilities.addGithubPushTrigger(newJob);
106121
}
107122

108-
["Ubuntu16.04", "Fedora28", "Debian8.4", "RHEL7.2", "Windows_NT", "CentOS7.1", "OSX10.12"].each { os ->
109-
addPullRequestJob(project, branch, os, "Release", true);
110-
addPullRequestJob(project, branch, os, "Debug", false);
123+
["Ubuntu16.04", "Debian8.4", "RHEL7.2", "Windows_NT", "CentOS7.1", "OSX10.12"].each { os ->
124+
addPullRequestJob(project, branch, os, "Release", false, true);
125+
addPullRequestJob(project, branch, os, "Debug", false, false);
126+
};
127+
128+
// Pull request jobs that run in Docker
129+
["Fedora28"].each { os ->
130+
addPullRequestJob(project, branch, os, "Release", true, true);
131+
addPullRequestJob(project, branch, os, "Debug", true, false);
111132
};
112133

113134
// Per push, run all the jobs
114-
["Ubuntu16.04", "Fedora28", "Debian8.4", "RHEL7.2", "Windows_NT", "CentOS7.1", "OSX10.12"].each { os ->
135+
["Ubuntu16.04", "Debian8.4", "RHEL7.2", "Windows_NT", "CentOS7.1", "OSX10.12"].each { os ->
136+
["Release", "Debug"].each { configuration ->
137+
addPushJob(project, branch, os, configuration, false);
138+
};
139+
};
140+
// Push jobs that run in Docker
141+
["Fedora28"].each { os ->
115142
["Release", "Debug"].each { configuration ->
116-
addPushJob(project, branch, os, configuration);
143+
addPushJob(project, branch, os, configuration, true);
117144
};
118145
};
119146

0 commit comments

Comments
 (0)