Reputation: 115
I need to create multiple pipelines on the same repo. For instance, there is the usual build pipeline that is triggered by git. However, there is another pipeline which is for targeted testing on separate hardware that has entirely different constraints on how it is triggered and what it runs. Both of these pipelines function on the same branch.
Would it be incorrect (or even anti-pattern) if I were to create two Jenkins files (say "Jenkins.build", "Jenkins.targettest" ...) on the same branch of the repo?
Upvotes: 2
Views: 3566
Reputation: 191
It's not an anti-pattern as long as those Jenkinsfile have different scopes that are as much unrelated as possible. In long run, the risk of keeping two separate Jenkinsfile is to let duplicated code spread to each one. For complex projects, I think it's totally ok to have different Jenkinsfile, but usually I would recommend to keep things as simple as possible, and forcing yourself to use only one Jenkinsfile will avoid making mistakes and choices you would regret in the long run.
It's perfectly feasible to only run specific stages depending on the detected file changes (e.g : skip deployment if only internal documentation was updated), or to skip stages depending on the branch names or some conditions.
Upvotes: 1