I have a parametrized job that takes a name, a SVN Repository and a shared directory. I need to call this job regularly with roughly 20 sets of these parameters. At the moment I just created 20 jobs and each calls the main job.
This is a very tedious configuration and clutters the main view in Jenkins.
Is there a better possibility to solve this? I am open to either restructure the jobs or use plugins to "hide" them.
More Details about the jobs: I have actually two kinds of main jobs:
What I need/want:
Not allowed to comment, but @Absurd-Mind, it sounds like you wanted to build just one job in the beginning that fits all and blows up now. When you have about 20 different settings try to find a larger common basis or split them completely.
Also, we have also such a job.... old shell script crap and well, one of my colleagues build a multijob pipeline around it, that can run in parallel. Under MultiJob Phase you can set Job execution to parallel.
But be careful, if it contains a build tool like bower or so you can't as easily wipe the cache because they share one.
You could use the Pipeline plugin and write groovy code to do this. You could add a bunch of checkbox input parameters, 1 for each set of parameters you want, and then conditionally execute the other job with that set of parameters.
node: {
stage ('set1') {
if(env.build_set1) {
build job: 'main_job', parameters: [[$class: 'StringParameterValue', name: 'name', value: 'Name1'], [$class: 'StringParameterValue', name: 'directory', value: 'dir1']]
}
}
stage ('set2') {
if(env.build_set2) {
build job: 'main_job', parameters: [[$class: 'StringParameterValue', name: 'name', value: 'Name2'], [$class: 'StringParameterValue', name: 'directory', value: 'dir2']]
}
}
}
This example runs sequentially, but you can also make these jobs run in parallel.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With