diff --git a/.septentrio/Jenkinsfile b/.septentrio/Jenkinsfile index 6a105ec3dc16fa..d6e376de80ffb7 100644 --- a/.septentrio/Jenkinsfile +++ b/.septentrio/Jenkinsfile @@ -1,26 +1,38 @@ pipeline { triggers { + // Poll the Git repository every 5 minutes to detect changes. pollSCM('H/5 * * * *') } + // Run stages without specified agent on any available agent. agent any + // Parameters used for manual builds triggered in the Jenkins web UI. parameters { string(name: 'BOARDS', defaultValue: 'Pixhawk6C Pixhawk6X', description: 'A space-separated list of boards to build for') string(name: 'GIT_REVISION', defaultValue: 'Copter-0.0.0-citesting', description: 'The Git revision (commit, branch, tag...) to check out') } + // Options for the pipeline. options { + // Discard old builds to save space. buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '1', numToKeepStr: '') } stages { - // Check out the repository on the Jenkins server + // Check out the repository on the Jenkins server. stage('Checkout') { steps{ - git(branch: 'Copter-0.0.0-citesting', - url: 'https://github.com/flyingthingsintothings/ardupilot.git') + git(url: 'https://github.com/flyingthingsintothings/ardupilot.git') echo "$GIT_COMMIT" // We need all the tags locally to check them out. The documentation to do this with the builtin steps is not really useful. sh "git fetch --all" - sh "git checkout ${params.GIT_REVISION}" + script { + if (env.GIT_COMMIT) { + // Build started from polling SCM. + sh "git checkout $GIT_COMMIT" + } else { + // Build started by user with parameters. + sh "git checkout ${params.GIT_REVISION}" + } + } sh "./Tools/gittools/submodule-sync.sh" } }