We have a pipeline build job which serves about 30 repos, each with their own Jenkinsfile.
The Jenkinsfiles have between 2-12 named stages, but it turns out that with few exceptions a stage with a certain name is identical to the same stage in other Jenkinsfiles.
I am thinking of having a common pipeline where all the stages are conditional. Each repo would have a small configuration file (Jenkins.config) that lists which stages to execute.
By creating a few more stages, where you split up almost identical stages into more stages this problem disappears.
It will take time to test each and every repo so the old way with Jenkinsfiles need to coexist with the common pipeline script.
The original way to select a build job uses a regexpr filter on the repo name. The repos that move over to the new job will match the same filter.
Is there a way to priority how jenkins matches?
I would like to configure Jenkins to prioritize the search in a preferred order.
An alternative would be to check for the presence of a file. If the repo has a Jenkinsfile, then I run the old job. If it does not, I run the new job.
So what options do I have to make Jenkins select the preferred build job?