Commit 4b2afaa1 authored by Ben Cooksley's avatar Ben Cooksley

Adapt DSL Jobs for the new way we build Jenkins

parent f0735835
......@@ -6,18 +6,68 @@ def knownJobs = new groovy.json.JsonSlurper().parseText( jobsToParse )
def structureToParse = readFileFromWorkspace('gathered-structure.json')
def knownStructure = new groovy.json.JsonSlurper().parseText( structureToParse )
// Iterate over all of the known structures and create the necessary jobs to build the dependencies
knownStructure.combinations.each {
// Create our job name
def jobName = "Administration/Dependency Build ${it.product} ${it.branchGroup} ${it.platform}"
// Read in the necessary Pipeline template
def pipelineTemplate = readFileFromWorkspace("pipeline-templates/dependency-build/${it.platform}.template")
// Now we can construct our Pipeline script
def pipelineScript = """
|def productName = "${it.product}"
|def branchGroup = "${it.branchGroup}"
|def currentPlatform = "${it.platform}"
|def ciEnvironment = "${knownStructure.environment}"
|${pipelineTemplate}""".stripMargin()
// Actually create the job now
pipelineJob( jobName ) {
properties {
// We don't want to keep build results forever, as otherwise they fill up the Jenkins host disk and clog things up
// As a compromise to keep useful information around we keep the last 25 builds
buildDiscarder {
strategy {
logRotator {
numToKeepStr("25")
daysToKeepStr('')
artifactDaysToKeepStr('')
artifactNumToKeepStr('')
}
}
}
// Make sure we don't build more than one at the same time
// For the dependency builds this is quite important as they're resource expensive and can take quite a while to do their thing
disableConcurrentBuilds()
}
// We want to rebuild dependency jobs once a week to catch up on changes in our dependencies
// Of course someone will be able to initiate one manually if needed, but weekly should be enough to catch up on fixes and the like
triggers {
cron('@weekly')
}
// Magic happens here - put the Pipeline in!
definition {
cps {
script( pipelineScript )
sandbox()
}
}
}
}
// Iterate over all of the known structures and create the necessary jobs to trigger global rebuilds
knownStructure.combinations.each {
// Determine what our product/branchGroup/platform key is
def structureKey = "${it.product} ${it.branchGroup} ${it.platform}"
// Create our job name
def jobName = "Global Rebuild ${structureKey}"
def jobName = "Administration/Global Rebuild ${structureKey}"
// Start assembling our Pipeline script
def pipelineScript = """
|// First things first: rebuild all the dependencies
|build job: 'Dependency Build ${structureKey}', quietPeriod: 10, wait: true
|build job: 'Administration/Dependency Build ${structureKey}', quietPeriod: 10, wait: true
|// Now trigger a rebuild of all the individual jobs
""".stripMargin().trim()
......@@ -34,7 +84,7 @@ knownStructure.combinations.each {
}
// Determine the name this job will have
def localJobName = "${it.product} ${it.name} ${it.branchGroup} ${it.platform}"
def localJobName = "${it.product}/${it.name}/${it.branchGroup} ${it.platform}"
// Add it to the pipeline script
pipelineScript = """
......
......@@ -5,7 +5,11 @@ def knownJobs = new groovy.json.JsonSlurper().parseText( jobsToParse )
// Iterate over all of the known jobs and create the necessary platform files
knownJobs.each {
// Create our job name
def jobName = "${it.product} ${it.name} ${it.branchGroup} ${it.platform}"
def jobName = "${it.product}/${it.name}/${it.branchGroup} ${it.platform}"
// Make sure the folders for this exist
folder( "${it.product}" )
folder( "${it.product}/${it.name}" )
// Read in the necessary Pipeline template
def pipelineTemplate = readFileFromWorkspace("pipeline-templates/${it.platform}.template")
......
......@@ -9,67 +9,19 @@ def supportedOSes = [
'Windows': '.* WindowsMSVCQt5.[10|11]$'
]
// Iterate over all of the known structures and create the necessary jobs to build the dependencies
knownStructure.combinations.each {
// Create our job name
def jobName = "Dependency Build ${it.product} ${it.branchGroup} ${it.platform}"
// Read in the necessary Pipeline template
def pipelineTemplate = readFileFromWorkspace("pipeline-templates/dependency-build/${it.platform}.template")
// Now we can construct our Pipeline script
def pipelineScript = """
|def productName = "${it.product}"
|def branchGroup = "${it.branchGroup}"
|def currentPlatform = "${it.platform}"
|def ciEnvironment = "${knownStructure.environment}"
|${pipelineTemplate}""".stripMargin()
// Actually create the job now
pipelineJob( jobName ) {
properties {
// We don't want to keep build results forever, as otherwise they fill up the Jenkins host disk and clog things up
// As a compromise to keep useful information around we keep the last 25 builds
buildDiscarder {
strategy {
logRotator {
numToKeepStr("25")
daysToKeepStr('')
artifactDaysToKeepStr('')
artifactNumToKeepStr('')
}
}
}
// Make sure we don't build more than one at the same time
// For the dependency builds this is quite important as they're resource expensive and can take quite a while to do their thing
disableConcurrentBuilds()
}
// We want to rebuild dependency jobs once a week to catch up on changes in our dependencies
// Of course someone will be able to initiate one manually if needed, but weekly should be enough to catch up on fixes and the like
triggers {
cron('@weekly')
}
// Magic happens here - put the Pipeline in!
definition {
cps {
script( pipelineScript )
sandbox()
}
}
}
}
// Setup a view for each Product
knownStructure.products.each {
// Setup a view for each OS we support
supportedOSes.each {
// Some preparation to create the view...
// This will create a regex of the form "Frameworks .*" for the 'Frameworks' product for instance
def jobRegex = "^${it} .*"
def viewName = "${it}"
def jobRegex = "^${it.value}"
def viewName = "OS - ${it.key}"
def osName = "${it.key}"
// Now create the view
listView( viewName ) {
// Give it a nice description
description("Current Status of ${viewName}")
description("Current Status of ${osName} builds")
// We want to recurse when looking for our jobs
recurse()
// Only include jobs matching the previously provided regex
jobs {
regex( jobRegex )
......@@ -87,20 +39,21 @@ knownStructure.products.each {
}
}
// Setup a view for each OS we support
supportedOSes.each {
// Some preparation to create the view...
def jobRegex = "^${it.value}"
def viewName = "OS - ${it.key}"
def osName = "${it.key}"
// Setup a recursive view inside each Platform's folder so people can see a big overall view should they so wish
knownStructure.products.each {
// Prepare to create the view
def product = "${it}"
def viewName = "${it}/Everything"
// Now create the view
listView( viewName ) {
// Give it a nice description
description("Current Status of ${osName} builds")
description("Current Status of all ${product} builds")
// We want to recurse when looking for our jobs
recurse()
// Only include jobs matching the previously provided regex
jobs {
regex( jobRegex )
regex( '.*' )
}
// Include a reasonable/sane set of Columns
columns {
......@@ -115,28 +68,32 @@ supportedOSes.each {
}
}
// Setup a view for CI Administration
listView('CI Management') {
// Give it a nice description so people know what they are looking at
description('All Jobs Related to the Administration of the KDE CI System')
// We want to include the following types of jobs:
// 1) Our DSL Job (the one running this script)
// 2) Docker Image generation scripts (Named 'Docker Generate .* Image')
// 3) Dependency Build jobs (Named Dependency Build Plasma kf5-qt5 XenialQt5.7 for instance)
jobs {
name('DSL Job Seed')
name('Craft Setup Deploy')
name('Craft Cache Rebuild')
regex('^Docker Generate .* Image$|^Docker Generate .* SDK$|^Dependency Build .*|^Global Rebuild .*')
}
// Include a reasonable/sane set of Columns
columns {
status()
weather()
name()
lastSuccess()
lastFailure()
lastDuration()
buildButton()
// Setup Per Branch Group views inside each Product as well for those wanting to monitor on that level
knownStructure.combinations.each {
// Grab all the info out for later use
def product = "${it.product}"
def branchGroup = "${it.branchGroup}"
def platform = "${it.platform}"
// Create the view for the overall branch group view
listView( "${it.product}/Everything - ${it.branchGroup}" ) {
// Give it a nice description
description("Current Status of all ${product} builds")
// We want to recurse when looking for our jobs
recurse()
// Only include jobs matching the previously provided regex
jobs {
regex( '${branchGroup} .*' )
}
// Include a reasonable/sane set of Columns
columns {
status()
weather()
name()
lastSuccess()
lastFailure()
lastDuration()
buildButton()
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment