我希望创建一个Jenkins声明性流水线,并希望将流水线结构设置如下:
mainPipeline.groovy
stage1.groovy
stage2.groovy
stage3.groovy
mainPipeline
看起来像下面这样:
pipeline {
stages {
stage('stage1') {
// Call method from the file Stage1.groovy
}
stage('stage2') {
// Call method from the file Stage2.groovy
}
}
}
我有两个主要问题:
- 我如何将这些文件链接到库中?
- 我如何配置Jenkins Pipeline,使Jenkins不仅知道主要的JenkinsFile(即
mainPipeline
),还知道子模块?