Sharing configuration between jobs

I have several Jenkins jobs. They are very similar to each other and differ only in details. They were originally created by copying the first work. If something changes in one of the job configurations, then it should apply to all other job configurations. This makes Jenkins maintenance more complex, longer, and error prone.

What I would like to do is to pull out at least some common parts of the job configuration and save them in one place, so I don’t need to apply each configuration change for all jobs separately. Is it possible, and if so, how can this be achieved?

I would like not to create a new project or change the way we structure the work (upstream dependencies on the flow), since all these tasks are obsolete.

Thank you in advance!

+6
source share
3 answers

There are several plugins that help with this. Inheritance comes to mind

+3
source

You can also see the project plugin template .

With this plugin, you can use the designers, publishers and SCM settings from the template job.

We use this plugin in my company and it works well :)

+1
source

I think Jenkins DSL Plugin can be used to solve this problem.

According to its summary:

Jenkins is a great build management system, and people love using their user interface to set up tasks. Unfortunately, as the number of jobs grows, maintaining them becomes tedious, and the paradigm of using UI falls apart. In addition, the common template in this situation in order to copy tasks for creating new ones, these β€œchildren” have the habit of diverging from their original β€œtemplate”, and therefore it becomes difficult to maintain consistency between these jobs.

It allows you to create program tasks o using Groovy Domain-specific language.

0
source

Source: https://habr.com/ru/post/982890/


All Articles