Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 66dc2583 authored by Bhushan Shah's avatar Bhushan Shah 📱

Add pipeline for the static web generation

parent 7e485dde
// Read the contents of the gathered-jobs.json file a step created for us previously
def jobsToParse = readFileFromWorkspace('staticweb/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 = "Website ${it.name}"
// Likewise with our cron schedule
def cronSchedule = "${it.cron}"
// Read in the necessary Pipeline script
def pipelineScript = readFileFromWorkspace("staticweb/${it.name}.pipeline")
// Actually create the job now
pipelineJob( jobName ) {
properties {
// We don't want to keep build results forever
// We'll set it to keep the last 10 builds and discard everything else
buildDiscarder {
strategy {
logRotator {
numToKeepStr("5")
daysToKeepStr('')
artifactDaysToKeepStr('')
artifactNumToKeepStr('')
}
}
}
// We don't want to be building the same project more than once
// This is to prevent one project hogging resources
// And also has a practical component as otherwise an older build could finish afterwards and upload old build results
disableConcurrentBuilds()
}
triggers {
// We want to automatically rebuild once a day
cron( cronSchedule )
}
// This is where the Pipeline script actually happens :)
definition {
cps {
script( pipelineScript )
sandbox()
}
}
}
}
[
{"name": "plasma-mobile-org", "cron": "@hourly"}
]
// Request a node to be allocated to us
node( "StaticWeb" ) {
// We want Timestamps on everything
timestamps {
// We want to catch any errors that occur to allow us to send out notifications (ie. emails) if needed
catchError {
// First Thing: Checkout Sources
stage('Checkout Sources') {
// Make sure we have a clean slate to begin with
deleteDir()
// plasma-mobile.org Code
checkout changelog: true, poll: true, scm: [
$class: 'GitSCM',
branches: [[name: 'master']],
userRemoteConfigs: [[url: 'https://anongit.kde.org/websites/plasma-mobile-org.git']]
]
}
// Let's build website now
stage('Website build') {
sh """
cd plasma-mobile-org/
pluto update planet.ini
ruby -r 'jekyll/planet' -e 'JekyllPlanet.main'
# Workaround for non-complete image urls in Bhushan Shah's blog
for post in _posts/*; do
if grep "author:" $post | grep "Bhushan Shah" >/dev/null; then
sed -i -e 's_/images_http://blog.bshah.in/images_g' $post
fi
done
jekyll build
cd _site; tar cvzf ../plasma-mobile-org.tar.gz .
"""
}
stage('Capturing Artifacts') {
archiveArtifacts artifacts: '*.tar.gz', onlyIfSuccessful: true
}
}
}
}
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