What is the best design approach to keeping the Jenkinsfile small (little build logic as possible)?
Having close to a hundred projects and several branches on each, then duplicating the pipeline logic within each Jenkinsfile would be a maintenance nightmare.
1)
I could put the Pipeline script within Jenkins Scriptler
def packageInformation = load '../../../scriptler/scripts/package-information.groovy'
packageInformation.init()
However I'm only able to access this on the master node
2)
I could have all the pipeline scripts within a jenkins-ci-scripts project in Git.
stash includes: '**/*.groovy', name: 'scripts'
stage 'Checkout'
checkout scm
unstash scripts
def packageInformation = load 'src/main/groovy/com/company/pipeline/package-information.groovy'
packageInformation.init()
I could then load the pipeline scripts from this stash. However I do not like having to duplicate even this much in all my different Jenkinsfile.
3)
We have a inhouse build tool installed on all build machines. This contains various build scripts, shell, python, ruby.
Example Jenkinsfile with little logic as possible
def branch = env.BUILD_BRANCH
def pipeline = load '/path/to/our/installed/build-pipeline.groovy'
parallel pipeline.nodes(branch)
My current Jenkins instance I comprised of Multi-configuration jobs/projects (a jenkins job/project for each release branch). Having aprox 8 release branches for each of the 60 projects. I am moving over to Pipeline because of a complex workflow and because Multi-configuration does not support a Prebuild-step that I need.