Greetings,
I am working on simplification of pipeline flow in my team.
In Git I have 2 files: Jenkinsfile and steps.groovy.
In steps I have defined my pipeline steps in form of functions, e.g.:
def build(system){
return {
node ("BUILDER"){
deleteDir()
scm checkout
env.BUILD_TARGET = architecture
sh "builder/builder.sh"
archive "*.zip"
stash name: "build_artifacts", includes: "*.zip"
}
}
}
return this
In Jenkins I am checkouting Git repo, specific branch and run Jenkinsfile.
How can I make Jenkinsfile to consist only of functions calling like this:
def steps = load "ci/steps.groovy"
steps.build("linux")
steps.build("linux2")