简体   繁体   English

是否可以将 Jenkins 共享库转换为 Jenkins 插件?

[英]Is it possible to convert a Jenkins Shared Library into a Jenkins plugin?

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?我有一个 Jenkins 共享库,它支持结帐、构建等功能。是否可以将整个库转换为插件,使其更便携并保护代码?

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?或者我可能不会公开代码但让用户能够通过调用函数来访问所有功能的任何其他方式?

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.通常 Jenkins 管理员正在寻找另一种解决方案:如何将插件转换为共享库。 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.为了在构建中使用库,只有存储在 Jenkins 中的凭据才能访问存储库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM