Skip to content

Commit b5a02e9

Browse files
authored
[release/2.1] Remove online tarball build from CI in favor of enforced offline build. (#701)
* Remove online tarball build from CI in favor of enforced offline build. * Add CentOS to unshared builds.
1 parent 7f6f24b commit b5a02e9

File tree

1 file changed

+14
-52
lines changed

1 file changed

+14
-52
lines changed

netci.groovy

Lines changed: 14 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ def addArchival(def job) {
2727
Utilities.addArchival(job, archivalSettings)
2828
}
2929

30+
def getDockerImageForOs(os) {
31+
def imageMap = [
32+
'RHEL7.2': 'microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2',
33+
'CentOS7.1': 'microsoft/dotnet-buildtools-prereqs:centos-7-b46d863-20180719033416',
34+
]
35+
return imageMap.get(os)
36+
}
37+
3038
def addBuildStepsAndSetMachineAffinity(def job, String os, String configuration) {
3139
job.with {
3240
steps {
@@ -91,75 +99,29 @@ def addPushJob(String project, String branch, String os, String configuration)
9199
};
92100
};
93101

94-
// Tarball builds that are not enforced to be offline
95-
[true, false].each { isPR ->
96-
["RHEL7.2", "CentOS7.1"].each { os ->
97-
["Release", "Debug"].each { configuration ->
98-
99-
def shortJobName = "${os}_Tarball_${configuration}";
100-
def contextString = "${os} Tarball ${configuration}";
101-
def triggerPhrase = "(?i).*test\\W+${contextString}.*";
102-
103-
def newJob = job(Utilities.getFullJobName(project, shortJobName, isPR)){
104-
steps{
105-
shell("cd ./source-build;git submodule update --init --recursive");
106-
shell("cd ./source-build;./build.sh /p:ArchiveDownloadedPackages=true /p:Configuration=${configuration} ${loggingOptions}");
107-
shell("cd ./source-build;./build-source-tarball.sh ../tarball-output --skip-build");
108-
109-
shell("cd ./tarball-output;./build.sh /p:Configuration=${configuration} ${loggingOptions}")
110-
shell("cd ./tarball-output;./smoke-test.sh --minimal --configuration ${configuration}")
111-
}
112-
}
113-
114-
Utilities.setMachineAffinity(newJob, os, 'latest-or-auto');
115-
116-
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}");
117-
118-
// Increase timeout. The tarball builds can take longer than the 2 hour default.
119-
Utilities.setJobTimeout(newJob, 240);
120-
121-
// Clone into the source-build directory
122-
Utilities.addScmInSubDirectory(newJob, project, isPR, 'source-build');
123-
124-
addArchival(newJob);
125-
if(isPR){
126-
if(configuration == "Release"){
127-
Utilities.addGithubPRTriggerForBranch(newJob, branch, contextString);
128-
}
129-
else{
130-
Utilities.addGithubPRTriggerForBranch(newJob, branch, contextString, triggerPhrase);
131-
}
132-
}
133-
else{
134-
Utilities.addGithubPushTrigger(newJob);
135-
}
136-
137-
}
138-
}
139-
}
140-
141102
// Tarball builds that are enforced offline with unshare
142103
[true, false].each { isPR ->
143-
["RHEL7.2"].each { os->
104+
["RHEL7.2", "CentOS7.1"].each { os->
144105
["Release", "Debug"].each { configuration ->
145106

146107
def shortJobName = "${os}_Unshared_${configuration}";
147108
def contextString = "${os} Unshared ${configuration}";
148109
def triggerPhrase = "(?i).*test\\W+${contextString}.*";
110+
def imageName = getDockerImageForOs(os);
149111

150112
def newJob = job(Utilities.getFullJobName(project, shortJobName, isPR)){
151113
steps{
152114
shell("cd ./source-build;git submodule update --init --recursive");
153115
// First build the product itself
154-
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/code/home -v \$(pwd)/source-build:/opt/code --rm -w /opt/code microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2 /opt/code/build.sh /p:ArchiveDownloadedPackages=true /p:Configuration=${configuration} ${loggingOptions}");
116+
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/code/home -v \$(pwd)/source-build:/opt/code --rm -w /opt/code ${imageName} /opt/code/build.sh /p:ArchiveDownloadedPackages=true /p:Configuration=${configuration} ${loggingOptions}");
155117
// Have to make this directory before volume-sharing it unlike non-docker build - existing directory is really only a warning in build-source-tarball.sh
156118
shell("mkdir tarball-output");
157119
// now build the tarball
158-
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/code/home --network none -v \$(pwd)/source-build:/opt/code -v \$(pwd)/tarball-output:/opt/tarball --rm -w /opt/code microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2 /opt/code/build-source-tarball.sh /opt/tarball --skip-build");
120+
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/code/home --network none -v \$(pwd)/source-build:/opt/code -v \$(pwd)/tarball-output:/opt/tarball --rm -w /opt/code ${imageName} /opt/code/build-source-tarball.sh /opt/tarball --skip-build");
159121
// now build from the tarball offline and without access to the regular non-tarball build
160-
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/tarball/home --network none -v \$(pwd)/tarball-output:/opt/tarball --rm -w /opt/tarball microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2 /opt/tarball/build.sh /p:Configuration=${configuration} ${loggingOptions}");
122+
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/tarball/home --network none -v \$(pwd)/tarball-output:/opt/tarball --rm -w /opt/tarball ${imageName} /opt/tarball/build.sh /p:Configuration=${configuration} ${loggingOptions}");
161123
// finally, run a smoke-test on the result
162-
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/tarball/home -v \$(pwd)/tarball-output:/opt/tarball --rm -w /opt/tarball microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2 /opt/tarball/smoke-test.sh --minimal --configuration ${configuration}");
124+
shell("docker run -u=\"\$(id -u):\$(id -g)\" -t --sig-proxy=true -e HOME=/opt/tarball/home -v \$(pwd)/tarball-output:/opt/tarball --rm -w /opt/tarball ${imageName} /opt/tarball/smoke-test.sh --minimal --configuration ${configuration}");
163125
}
164126
}
165127

0 commit comments

Comments
 (0)