Skip to content

Commit e8f444a

Browse files
authored
Merge pull request #901 from mavasani/vsipr
Add VSI PR jobs in Jenkins
2 parents 17c5178 + 81910cf commit e8f444a

File tree

1 file changed

+45
-29
lines changed

1 file changed

+45
-29
lines changed

netci.groovy

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,25 @@ build.cmd /no-deploy-extension /${configuration.toLowerCase()}""")
4343
}
4444
}
4545

46-
// Add VSI job.
47-
// For now, trigger VSI jobs only on explicit request.
48-
def newVsiJobName = Utilities.getFullJobName(project, "vsi", false /* isPr */)
46+
// Add VSI jobs.
47+
// Generate the builds for commit and PRJob
48+
[true, false].each { isPR -> // Defines a closure over true and false, value assigned to isPR
49+
def newVsiJobName = Utilities.getFullJobName(project, "vsi", isPR)
4950

50-
def newVsiJob = job(newVsiJobName) {
51-
description('')
51+
def newVsiJob = job(newVsiJobName) {
52+
description('')
5253

53-
// This opens the set of build steps that will be run.
54-
steps {
55-
// Build roslyn-project-system repo - we also need to set certain environment variables for building the repo with VS15 toolset.
56-
batchFile("""SET VS150COMNTOOLS=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\
54+
// This opens the set of build steps that will be run.
55+
steps {
56+
// Build roslyn-project-system repo - we also need to set certain environment variables for building the repo with VS15 toolset.
57+
batchFile("""SET VS150COMNTOOLS=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\
5758
SET VSSDK150Install=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\VSSDK\\
5859
SET VSSDKInstall=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\VSSDK\\
5960
6061
build.cmd /release /skiptests""")
61-
62-
// Patch all the MSBuild xaml and targets files from the current roslyn-project-system commit into VS install.
63-
batchFile("""SET VS_MSBUILD_MANAGED=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\MSBuild\\Microsoft\\VisualStudio\\Managed
62+
63+
// Patch all the MSBuild xaml and targets files from the current roslyn-project-system commit into VS install.
64+
batchFile("""SET VS_MSBUILD_MANAGED=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\MSBuild\\Microsoft\\VisualStudio\\Managed
6465
6566
mkdir backup
6667
xcopy /SIY "%VS_MSBUILD_MANAGED%" .\\backup\\Managed
@@ -69,16 +70,16 @@ xcopy /SIY .\\src\\Targets\\*.targets "%VS_MSBUILD_MANAGED%"
6970
xcopy /SIY .\\bin\\Release\\Rules\\*.xaml "%VS_MSBUILD_MANAGED%"
7071
""")
7172

72-
// Sync roslyn-internal upfront as we use the VsixExpInstaller from roslyn-internal repo to install VSIXes built from SDK repo into RoslynDev hive.
73-
batchFile("""pushd %WORKSPACE%\\roslyn-internal
73+
// Sync roslyn-internal upfront as we use the VsixExpInstaller from roslyn-internal repo to install VSIXes built from SDK repo into RoslynDev hive.
74+
batchFile("""pushd %WORKSPACE%\\roslyn-internal
7475
git submodule init
7576
git submodule sync
7677
git submodule update --init --recursive
7778
init.cmd
7879
popd""")
7980

80-
// Build sdk repo and install templates into RoslynDev hive.
81-
batchFile("""SET VS150COMNTOOLS=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\
81+
// Build sdk repo and install templates into RoslynDev hive.
82+
batchFile("""SET VS150COMNTOOLS=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\
8283
SET DeveloperCommandPrompt=%VS150COMNTOOLS%\\VsMSBuildCmd.bat
8384
8485
call "%DeveloperCommandPrompt%" || goto :BuildFailed
@@ -101,8 +102,8 @@ echo Build failed with ERRORLEVEL %ERRORLEVEL%
101102
exit /b 1
102103
""")
103104

104-
// Build roslyn-internal and run netcore VSI tao tests.
105-
batchFile("""SET VS150COMNTOOLS=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\
105+
// Build roslyn-internal and run netcore VSI tao tests.
106+
batchFile("""SET VS150COMNTOOLS=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\
106107
SET VSSDK150Install=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\VSSDK\\
107108
SET VSSDKInstall=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\VSSDK\\
108109
@@ -116,13 +117,29 @@ set EchoOn=true
116117
BuildAndTest.cmd -build:true -clean:false -deployExtensions:true -trackFileAccess:false -officialBuild:false -realSignBuild:false -parallel:true -release:true -delaySignBuild:true -samples:false -unit:false -eta:false -vs:true -cibuild:true -x64:false -netcoretestrun
117118
popd""")
118119

119-
// Revert patched targets and rules from backup.
120-
batchFile("""SET VS_MSBUILD_MANAGED=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\MSBuild\\Microsoft\\VisualStudio\\Managed
120+
// Revert patched targets and rules from backup.
121+
batchFile("""SET VS_MSBUILD_MANAGED=%ProgramFiles(x86)%\\Microsoft Visual Studio\\2017\\Enterprise\\MSBuild\\Microsoft\\VisualStudio\\Managed
121122
del /SQ "%VS_MSBUILD_MANAGED%\\"
122123
xcopy /SIY .\\backup\\Managed "%VS_MSBUILD_MANAGED%"
123124
rmdir /S /Q backup
124125
""")
126+
}
127+
}
128+
129+
addVsiArchive(newVsiJob)
130+
Utilities.setMachineAffinity(newVsiJob, 'Windows_NT', 'latest-or-auto-dev15-internal')
131+
Utilities.standardJobSetup(newVsiJob, project, isPR, "*/${branch}")
132+
// ISSUE: Temporary until a full builder for source control is available.
133+
addVsiMultiScm(newVsiJob, project)
134+
135+
if (isPR) {
136+
def triggerPhrase = generateTriggerPhrase(newVsiJobName, "vsi")
137+
Utilities.addGithubPRTriggerForBranch(newVsiJob, branch, newVsiJobName, triggerPhrase, /*triggerPhraseOnly*/ true)
138+
} else {
139+
Utilities.addGithubPushTrigger(newVsiJob)
125140
}
141+
142+
Utilities.addHtmlPublisher(newVsiJob, "roslyn-internal/Open/Binaries/Release/Exes/EditorTestApp/VSIntegrationTestLogs", 'VS Integration Test Logs', '*.html')
126143
}
127144

128145
// Archive VSI artifacts.
@@ -182,16 +199,15 @@ static void addVsiMultiScm(def myJob, def project) {
182199
}
183200
// END ISSUE
184201

185-
addVsiArchive(newVsiJob)
186-
Utilities.setMachineAffinity(newVsiJob, 'Windows_NT', 'latest-or-auto-dev15-internal')
187-
// For now, trigger VSI jobs only on explicit request.
188-
Utilities.standardJobSetup(newVsiJob, project, false /* isPr */, "*/${branch}")
189-
// ISSUE: Temporary until a full builder for source control is available.
190-
addVsiMultiScm(newVsiJob, project)
191-
Utilities.addGithubPushTrigger(newVsiJob)
192-
Utilities.addHtmlPublisher(newVsiJob, "roslyn-internal/Open/Binaries/Release/Exes/EditorTestApp/VSIntegrationTestLogs", 'VS Integration Test Logs', '*.html')
202+
static String generateTriggerPhrase(String jobName, String triggerPhraseExtra) {
203+
def triggerCore = "all|${jobName}"
204+
if (triggerPhraseExtra) {
205+
triggerCore = "${triggerCore}|${triggerPhraseExtra}"
206+
}
207+
return "(?i).*test\\W+(${triggerCore})\\W+please.*";
208+
}
193209

194210
// Make the call to generate the help job
195211
Utilities.createHelperJob(this, project, branch,
196212
"Welcome to the ${project} Repository", // This is prepended to the help message
197-
"Have a nice day!") // This is appended to the help message. You might put known issues here.
213+
"Have a nice day!") // This is appended to the help message. You might put known issues here.

0 commit comments

Comments
 (0)