GitHub分支源插件 - >仅扫描Pull请求

时间:2017-11-22 15:34:58

标签: github jenkins jenkins-pipeline

我们在Jenkins中使用GitHub Branch Source Plugin。它很棒。但是它会扫描分支和拉取请求。

我们希望以仅扫描拉取请求的方式配置插件。这可能吗?如果没有,我们可以在哪里发布我们的功能请求?

祝你好运, 马里努斯

2 个答案:

答案 0 :(得分:2)

您可以通过结帐行为在作业中对此进行配置。只需删除 Discover Branches 项目,它就不应该找到任何分支。 enter image description here

答案 1 :(得分:0)

使用 JCaSC / DSL 语法,可以使用 gitHubBranchDiscovery trait 和 strategyId(1) 进行配置:

              branchSource {
                  source {
                      github {
                          id('ci') // IMPORTANT: use a constant and unique identifier
                          repositoryUrl('https://github.com/OWNER/REPO')
                          repository('REPO')
                          repoOwner('OWNER')
                          apiUri('https://github.com/api/v3')
                          configuredByUrl(false)
                          credentialsId('github-token')
                          traits {
                              gitHubBranchDiscovery {
                                  // 1 = Exclude branches that are also filed as PRs
                                  // 2 = Only branches that are also filed as PRs
                                  // 3 = All branches
                                  strategyId(1)
                              }
                              gitHubPullRequestDiscovery {
                                  // 1 = only PR merge
                                  // 2 = only PR head
                                  // 3 = both PR head and PR merge
                                  strategyId(3) // 3 = both PR head and PR merge from origin
                              }
                          }
                      }
                  }
              }
相关问题