Reputation: 250
I have a Jenkins Shared Library which supports functions to checkout, build, etc. Is it possible to convert the entire library into a plugin making it more portable and also protect the code?
Or any other ways by which I might not expose the code but give users the ability to access all the functionalities by calling the functions?
Upvotes: 1
Views: 341
Reputation: 4136
Shared library logic doesn't translate directly to a plugin.
Usually Jenkins admins are looking for a solution the other way around: how to convert a plugin to a shared library. A plugin has to be installed by an admin, requires a restart every time there is an update to the code, can potentially bring your whole master down in case of an error.
You probably have good reasons to want to hide the library code from your users. Maybe you can put your library in a repo where users don't have read access. In order to use the library in a build, only credentials stored in Jenkins have to be able to access the repository.
Upvotes: 2