samedi 30 mai 2020

How to work with multiple shared libraries in jenkins?

Sharing a design issue using jenkins!

I have a project in which I have to use multiple libraries. Multiple Libraries in the sense Project consists of multiple services. and to install the project we have different mechanism to call there are few non standard ansible calls maintained by other team which we have to utilize, basically 20 services leads to 20 different architecture call. They can be in any version which can support any version maintained by different team so as the same we have to think, My question is how we can design the architecture which will do installation of project so code reusability is at the maximum and maintainence with coupling is at minimum, How beautifully we can design this problem?

Considering the limitation of jenkins: we can not keep the same filename in the jenkins shared library src folder. we can not keep the same filename in vars folder as well because the first one will load others wouldn't load. (correct me If I am wrong anywhere) Ref: https://www.jenkins.io/doc/book/pipeline/shared-libraries/

Current Architecture which I have thought of is (It is better not to read current architecture because you might need fresh mind to resolve this)

1 main jenkins file which will load all shared libraries 
1 main shared libraries which will act as parent to all shared libraries
In all 20 shared libraries "all_stages" are written which will create the map which have objects of stages and this map is stored in 1 main common file resides in parent shared library which will have the workflow implementation inside it.
We will pass a yaml stage parameters to this project which stage we have to pick from combined all stages. using this feature we can control the workflow.

Please Do let me know if I am not clear anywhere I will give more details for the same right now It will be difficult to mention the complete project here itself.

Aucun commentaire:

Enregistrer un commentaire