Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,84 @@ pipeline {
string(name: "PACKAGE_JOB", defaultValue: 'cf-remote', description: 'where to get CFEngine HUB package from, either a dir at http://buildcache.cloud.cfengine.com/packages like testing-pr or a keyword cf-remote to use cf-remote download')
string(name: "USE_NIGHTLIES_FOR", defaultValue: '', description: 'branch whose nightlies to use (master, 3.18.x, etc) - will be one of http://buildcache.cloud.cfengine.com/packages/testing-pr/jenkins-$USE_NIGHTLIES_FOR-nightly-pipeline-$NUMBER/')
}
triggers {
// Run nightly at 2 AM to trigger builds for master, 3.27, 3.24, and lts
cron('H 2 * * *')
}
options {
checkoutToSubdirectory('documentation')
}
stages {
stage('Trigger Nightly Builds') {
when {
triggeredBy 'TimerTrigger'
}
steps {
script {
echo "Triggered by cron - launching builds for master, 3.27, 3.24, and lts"

// Build master
build job: env.JOB_NAME, parameters: [
string(name: 'CORE_REV', value: 'master'),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice to parameterize this a bit so not so much repetition, but there are differences here and there.

string(name: 'ENTERPRISE_REV', value: 'master'),
string(name: 'NOVA_REV', value: 'master'),
string(name: 'MASTERFILES_REV', value: 'master'),
string(name: 'DOCS_REV', value: 'master'),
string(name: 'NT_DOCS_REV', value: 'main'),
string(name: 'DOCS_BRANCH', value: 'master'),
string(name: 'PACKAGE_JOB', value: 'cf-remote'),
string(name: 'USE_NIGHTLIES_FOR', value: 'master')
], wait: false

// Build 3.27
build job: env.JOB_NAME, parameters: [
string(name: 'CORE_REV', value: '3.27.x'),
string(name: 'ENTERPRISE_REV', value: '3.27.x'),
string(name: 'NOVA_REV', value: '3.27.x'),
string(name: 'MASTERFILES_REV', value: '3.27.x'),
string(name: 'DOCS_REV', value: '3.27'),
string(name: 'NT_DOCS_REV', value: 'main'),
string(name: 'DOCS_BRANCH', value: '3.27'),
string(name: 'PACKAGE_JOB', value: 'cf-remote'),
string(name: 'USE_NIGHTLIES_FOR', value: '3.27.x')
], wait: false

// Build 3.24
build job: env.JOB_NAME, parameters: [
string(name: 'CORE_REV', value: '3.24.x'),
string(name: 'ENTERPRISE_REV', value: '3.24.x'),
string(name: 'NOVA_REV', value: '3.24.x'),
string(name: 'MASTERFILES_REV', value: '3.24.x'),
string(name: 'DOCS_REV', value: '3.24'),
string(name: 'NT_DOCS_REV', value: 'main'),
string(name: 'DOCS_BRANCH', value: '3.24'),
string(name: 'PACKAGE_JOB', value: 'cf-remote'),
string(name: 'USE_NIGHTLIES_FOR', value: '3.24.x')
], wait: false

// Build lts (3.27.x code deployed to lts location)
build job: env.JOB_NAME, parameters: [
string(name: 'CORE_REV', value: '3.27.x'),
string(name: 'ENTERPRISE_REV', value: '3.27.x'),
string(name: 'NOVA_REV', value: '3.27.x'),
string(name: 'MASTERFILES_REV', value: '3.27.x'),
string(name: 'DOCS_REV', value: '3.27'),
string(name: 'NT_DOCS_REV', value: 'main'),
string(name: 'DOCS_BRANCH', value: 'lts'),
string(name: 'PACKAGE_JOB', value: 'cf-remote'),
string(name: 'USE_NIGHTLIES_FOR', value: '3.27.x')
], wait: false

echo "All nightly builds triggered successfully"
}
}
}
stage('Environment check') {
when {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why skip these?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so that a manual trigger doesn't cause all of them to build this one cron trigger causes master, 3.27, 3.24 and lts (which is 3.27 but targeting /lts ) to build.

not {
triggeredBy 'TimerTrigger'
}
}
steps {
sh 'env'
sh 'whoami; pwd; ls'
Expand All @@ -32,11 +105,21 @@ pipeline {
}
// we clean FIRST and NOT at the end of the job so that we can replay various stages and have the build result from previous runs
stage('Clean workspace') {
when {
not {
triggeredBy 'TimerTrigger'
}
}
steps {
sh 'for r in $REPOS; do rm -rf "$(basename "$r")"; done'
}
}
stage('Checkout repositories'){
when {
not {
triggeredBy 'TimerTrigger'
}
}
steps {
script {
if (env.CHANGE_ID) {
Expand All @@ -57,11 +140,21 @@ pipeline {
}
}
stage('Build documentation') {
when {
not {
triggeredBy 'TimerTrigger'
}
}
steps {
sh 'bash -x documentation/generator/build/run.sh'
}
}
stage('Publish to buildcache') {
when {
not {
triggeredBy 'TimerTrigger'
}
}
steps {
sshPublisher(
// we must use alwaysPublishFromMaster: true because our CONTAINERS build hosts are not in the private network which has access to buildcache.cloud.cfengine.com
Expand Down
Loading