Shared Libraries in jenkins.

  • In Jenkins, a shared library is a way to store commonly used code(reusable code), such as scripts or functions, that can be used by different Jenkins pipelines.

  • Instead of writing the same code again and again in multiple pipelines, you can create a shared library and use it in all the pipelines that need it. This can make your code more organized and easier to maintain.

  • Think of it like a library of books, Instead of buying the same book over and over again, you can borrow it from the library whenever you need it.

Advantage:

  • Standarization of Pipelines

  • Reduce duplication of code

  • Easy onboarding of new applications, projects or teams

  • One place to fix issues with the shared or common code

  • Code Maintainence

  • Reduce the risk of errors

Have a look on this picture:

Special thanks to abhishek veeramalla bhaiya.