有可能合并多个共享的Jenkins库吗?
例如,我有一个公共共享库:my-shared-library (带有maven项目的git存储库)定义在包含一些作业的jenkins文件夹上。在该文件夹中运行的每个作业都可以使用Jenkinsfile中的共享库:
@Library("my-shared-library") _
import com.pipelines.Pipeline
new Pipeline().build()现在,我想创建另一个共享库:my-specialized-shared-library,它包含一些专门的管道(在另一个git存储库中,也作为一个maven项目)。my-specialized-shared-library中的管道(groovy类、脚本等)应该能够使用/导入类、管道等:my-shared-library是可能的,如果是的话,推荐的方法是什么?
发布于 2019-05-06 11:10:54
在>中,我从不同的URL定义了两个不同的全局管道库。
.jenkinsfile:
@Library('GlobalLibrary-1@some_branch') l1 //you can write here _ (underscore) or any other string.
@Library('GlobalLibrary-2@any_branch') l2
import com.lib1.Class1; // import from GlobalLibrary-1 (Jenkins automatically finds com.lib.Class1 inside GlobalLibrary-1)
import com.prodcode.Class2; // import from GlobalLibrary-2 (Jenkins automatically finds com.prodcode.Class2 inside GlobalLibrary-2)
node {
new Class1();
new Class2();
}我甚至可以使用Class2.groovy中的导入从获取类
https://stackoverflow.com/questions/52478705
复制相似问题