@@ -27,6 +27,14 @@ def addArchival(def job) {
27
27
Utilities . addArchival(job, archivalSettings)
28
28
}
29
29
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
+
30
38
def addBuildStepsAndSetMachineAffinity (def job , String os , String configuration ) {
31
39
job. with {
32
40
steps {
@@ -91,75 +99,29 @@ def addPushJob(String project, String branch, String os, String configuration)
91
99
};
92
100
};
93
101
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
-
141
102
// Tarball builds that are enforced offline with unshare
142
103
[true , false ]. each { isPR ->
143
- [" RHEL7.2" ]. each { os ->
104
+ [" RHEL7.2" , " CentOS7.1 " ]. each { os ->
144
105
[" Release" , " Debug" ]. each { configuration ->
145
106
146
107
def shortJobName = " ${ os} _Unshared_${ configuration} " ;
147
108
def contextString = " ${ os} Unshared ${ configuration} " ;
148
109
def triggerPhrase = " (?i).*test\\ W+${ contextString} .*" ;
110
+ def imageName = getDockerImageForOs(os);
149
111
150
112
def newJob = job(Utilities . getFullJobName(project, shortJobName, isPR)){
151
113
steps{
152
114
shell(" cd ./source-build;git submodule update --init --recursive" );
153
115
// 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} " );
155
117
// 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
156
118
shell(" mkdir tarball-output" );
157
119
// 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" );
159
121
// 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} " );
161
123
// 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} " );
163
125
}
164
126
}
165
127
0 commit comments