/cli

Permalink
71 lines (58 sloc) 2.88 KB
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// Import the utility functionality.
importjobs.generation.Utilities;
def project=GithubProject
def branch=GithubBranchName
def isPR=true
def platformList= ['Linux:x64:Release','Debian8.2:x64:Debug','Ubuntu:x64:Release','Ubuntu16.04:x64:Debug','Ubuntu16.10:x64:Debug','OSX10.12:x64:Release','Windows_NT:x64:Release','Windows_NT:x86:Debug','RHEL7.2:x64:Release','CentOS7.1:x64:Debug','OpenSUSE42.1:x64:Debug']
defstaticgetBuildJobName(defconfiguration,defos,defarchitecture) {
return configuration.toLowerCase()+'_'+ os.toLowerCase()+'_'+ architecture.toLowerCase()
}
platformList.each {platform->
// Calculate names
def (os, architecture, configuration)= platform.tokenize(':')
def osUsedForMachineAffinity= os;
// Calculate job name
def jobName= getBuildJobName(configuration, os, architecture)
def buildCommand='';
// Calculate the build command
if (os=='Windows_NT') {
buildCommand=".\\build.cmd -Configuration${configuration} -Architecture${architecture} -Targets Default"
}
elseif (os=='Windows_2016') {
buildCommand=".\\build.cmd -Configuration${configuration} -Architecture${architecture} -RunInstallerTestsInDocker -Targets Default"
}
elseif (os=='Ubuntu') {
buildCommand="./build.sh --skip-prereqs --configuration${configuration} --docker ubuntu.14.04 --targets Default"
}
elseif (os=='Linux') {
osUsedForMachineAffinity='Ubuntu16.04';
buildCommand="./build.sh --linux-portable --skip-prereqs --configuration${configuration} --targets Default"
}
else {
// Jenkins non-Ubuntu CI machines don't have docker
buildCommand="./build.sh --skip-prereqs --configuration${configuration} --targets Default"
}
def newJob= job(Utilities.getFullJobName(project, jobName, isPR)) {
// Set the label.
steps {
if (os=='Windows_NT'|| os=='Windows_2016') {
// Batch
batchFile(buildCommand)
}
else {
// Shell
shell(buildCommand)
}
}
}
Utilities.setMachineAffinity(newJob, osUsedForMachineAffinity,'latest-or-auto')
Utilities.standardJobSetup(newJob, project, isPR,"*/${branch}")
Utilities.addMSTestResults(newJob,'**/*.trx')
Utilities.addGithubPRTriggerForBranch(newJob, branch,"${os}${architecture}${configuration} Build")
}
// Make the call to generate the help job
Utilities.createHelperJob(this, project, branch,
"Welcome to the${project} Repository",// This is prepended to the help message
"Have a nice day!")// This is appended to the help message. You might put known issues here.