Commit 011b83cf authored by Ben Cooksley's avatar Ben Cooksley

Refactor this to use it's own DSL job.

We were probably headed in this direction anyway, but the need to specify build tokens makes this a requirement.
parent 2940f2f0
{"name": "Craft Setup Deploy"},
{"name": "Pre Review CI"},
{"name": "Extragear craft master SUSEQt5.9"}
// Read the contents of the gathered-jobs.json file a step created for us previously
def jobsToParse = readFileFromWorkspace('pre-review/staging-jobs.json')
def knownJobs = new groovy.json.JsonSlurper().parseText( jobsToParse )
// Iterate over all of the known jobs and create them!
knownJobs.each {
// Save our job name for later
def jobName = "Pre Review CI ${it.product}"
// Read in our security token, so we can let Phabricator trigger our seed jobs
def securityToken = readFileFromWorkspace("phabricator-remote-token")
// Read in the necessary Pipeline script
def pipelineTemplate = readFileFromWorkspace("pre-review/seed-job.pipeline")
// Prepend the information it will need to run
def pipelineScript = """
|def productName = "${it.product}"
// Actually create the job now
pipelineJob( jobName ) {
// Make sure Phabricator is allowed to trigger the build
authenticationToken( securityToken )
// Set some necessary properties around build logs and multiple builds...
properties {
// We don't want to keep build results for this for very long as they're not helpful
// We'll set it to keep the last 10 builds and discard everything else
buildDiscarder {
strategy {
logRotator {
// In order for Phabricator to tell us what to build, we need to have parameters...
// This is where the Pipeline script actually happens :)
definition {
cps {
script( pipelineScript )
// Overall configuration
// Still need to figure out how this will work exactly
// Likely will involve one of these jobs per Product - for now just hardcode Frameworks
// The branch is even trickier, but a basic compilation test is better than nothing, so we assume master
def productName = "Frameworks"
// As developers might be posting reviews for master or stable branches, we'll build against master
// While not perfect, this is the best solution we have for now
def branchGroup = "kf5-qt5"
def ciEnvironment = "production"
// Read in our variables, as we'll need to know what job we are creating...
def productName = "${PRODUCT_NAME}"
def reviewID = "${DIFF_ID}"
def reviewPHID = "${PHID}"
def reviewStagingURL = "${STAGING_URI}"
{"product": "Frameworks"}
// Make sure we accept the parameters we will need...
string(name: 'DIFF_ID', trim: false, defaultValue: '', description: ''),
string(name: 'PHID', trim: false, defaultValue: '', description: ''),
string(name: 'STAGING_URI', trim: false, defaultValue: '', description: ''),
string(name: 'STAGING_REF', trim: false, defaultValue: '', description: '')
// First things first: make sure our job exists!
node('master') {
// Grab the CI Tooling...
......@@ -16,8 +6,10 @@ node('master') {
branches: [[name: 'master']],
userRemoteConfigs: [[url: '']]
// Make sure the product is passed along to the DSL for processing
env.PRODUCT_NAME = productName
// Then process the necessary DSL to create the job
jobDsl targets: 'pre-review/seed_jobs.groovy'
jobDsl targets: 'pre-review/create_review_job.groovy'
// Now trigger the individual job we want
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment