@@ -49,71 +49,98 @@ def getDockerImageForOs(os) {
49
49
def imageMap = [
50
50
' RHEL7.2' : ' microsoft/dotnet-buildtools-prereqs:rhel7_prereqs_2' ,
51
51
' CentOS7.1' : ' microsoft/dotnet-buildtools-prereqs:centos-7-b46d863-20180719033416' ,
52
+ ' Fedora28' : ' microsoft/dotnet-buildtools-prereqs:fedora-28-c103199-20180628122443' ,
52
53
]
53
54
return imageMap. get(os)
54
55
}
55
56
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
+
57
64
job. with {
58
65
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" );
62
75
}
63
76
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} " );
70
85
}
71
- shell( " ./smoke-test.sh --minimal --configuration ${ configuration } ${ smokeTestExcludes } " );
86
+ setMachineAffinity(job, os );
72
87
}
73
88
};
74
89
};
75
90
76
- setMachineAffinity(job, os);
91
+
77
92
}
78
93
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 )
80
95
{
81
96
def newJobName = Utilities . getFullJobName(project, " ${ os} _${ configuration} " , true );
82
97
def contextString = " ${ os} ${ configuration} " ;
83
98
def triggerPhrase = " (?i).*test\\ W+${ contextString} .*" ;
84
99
85
100
def newJob = job(newJobName);
86
101
87
- addBuildStepsAndSetMachineAffinity(newJob, os, configuration);
102
+ addBuildStepsAndSetMachineAffinity(newJob, os, configuration, runInDocker );
88
103
addArchival(newJob);
89
104
Utilities . standardJobSetup(newJob, project, true , " */${ branch} " );
90
105
Utilities . setJobTimeout(newJob, 180 );
91
106
Utilities . addGithubPRTriggerForBranch(newJob, branch, contextString, triggerPhrase, ! runByDefault);
92
107
}
93
108
94
- def addPushJob (String project , String branch , String os , String configuration )
109
+ def addPushJob (String project , String branch , String os , String configuration , boolean runInDocker )
95
110
{
96
111
def shortJobName = " ${ os} _${ configuration} " ;
97
112
98
113
def newJobName = Utilities . getFullJobName(project, shortJobName, false );
99
114
def newJob = job(newJobName);
100
115
101
- addBuildStepsAndSetMachineAffinity(newJob, os, configuration);
116
+ addBuildStepsAndSetMachineAffinity(newJob, os, configuration, runInDocker );
102
117
addArchival(newJob);
103
118
Utilities . standardJobSetup(newJob, project, false , " */${ branch} " );
104
119
Utilities . setJobTimeout(newJob, 180 );
105
120
Utilities . addGithubPushTrigger(newJob);
106
121
}
107
122
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 );
111
132
};
112
133
113
134
// 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 ->
115
142
[" Release" , " Debug" ]. each { configuration ->
116
- addPushJob(project, branch, os, configuration);
143
+ addPushJob(project, branch, os, configuration, true );
117
144
};
118
145
};
119
146
0 commit comments