Job Inheritance Plugin

14 views
Skip to first unread message

marouane zhani

unread,
Apr 15, 2020, 11:49:48 AM4/15/20
to Jenkins Users
Hi everybody,

Since a lot of my jobs have more or less the same set of parameters, I wanted to implement a "parent job" where we have the shared configuration, and all "children" jobs should just inherit from the "parent" and change the parameters if needed.

I have found that the "inheritance job plugin",which is fitting more or less my needs. However, I am still having the following problems with it: 

  •  How to get the parameters of the parent job (as environment variables for example) and use them in the build steps of the child job. 
  •  Is it possible to have the same structure with pipelines or multi-job? I mean here if it's possible to have just one parent multi-job where we have the common configuration, and then all the other multi-jobs should use the parent one as a reference. 

Looking forward to your help.

Thank you in advance,

Marouane ZHANI

jeremy mordkoff

unread,
Apr 15, 2020, 12:31:39 PM4/15/20
to Jenkins Users
I went back and forth on this. In the end, I put everything in code. I decided I wanted the minimum amount of stuff configured in jenkins. 

I started out with a wrapper pipeline that loaded the "guts" of the job. This was extremely restrictive in that each job had to conform at some level to the expectations of the wrapper. I switched to a library of code and all of my common parameters are stored in the library. I found that this was also easier to debug as I could create a jenkins job that loaded the library and ran the unit tests that I defined inside it. 

This is all using multi-branch pipelines, BTW, and my devops code is in the same repo as the product code, so it all gets branched at the same time. This gives me more confidence that I can reproduce any build later, no matter how much my devops code changes. If you store this library in a different repo, then make sure you have some way to select the correct version or else you will have trouble reproducing old builds (I often have 7 or more branches in development so this is important to me). 
Reply all
Reply to author
Forward
0 new messages