多分支作业扫描无法发现远程 GitHub 回购标签

Multibranch job scan fails to discover remote GitHub repo tags

我正在使用多分支管道作业来发现 branches/tags/PRs 并执行某些作业。我在 GitHub 上获得了回购协议并且扫描能够发现所有但不是标签。我得到以下错误。此外,当 Discover tags 选项在多分支作业配置中被禁用时,我没有看到此错误并且在创建标签时我错过了构建。

我尝试创建多个新的存储库,但没有帮助。 詹金斯版本:2.150.1

Getting remote tags...
ERROR: [Sun Jan 06 16:00:21 UTC 2019] Could not fetch branches from source 3f765a8f-ee7f-4c6d-a655-f9ca3b2b25d3
org.kohsuke.github.GHException: Failed to retrieve https://repourl/branch/git/refs/tags
at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:529)
at org.kohsuke.github.Requester$PagingIterator.hasNext(Requester.java:494)
at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:44)
at org.kohsuke.github.PagedIterator.hasNext(PagedIterator.java:32)
at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$LazyTags.hasNext(GitHubSCMSource.java:2222)
at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1016)
at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:374)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:284)
at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1025)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
[Sun Jan 06 16:00:21 UTC 2019] Finished branch indexing. Indexing took 0.42 sec
FATAL: Failed to recompute children of Pipelines » bl-calibration-orchestrator-v1
org.kohsuke.github.GHException: Failed to retrieve https://repourl/branch/git/refs/tags
at org.kohsuke.github.Requester$PagingIterator.fetch(Requester.java:529)
at org.kohsuke.github.Requester$PagingIterator.hasNext(Requester.java:494)
at org.kohsuke.github.PagedIterator.fetch(PagedIterator.java:44)
at org.kohsuke.github.PagedIterator.hasNext(PagedIterator.java:32)
at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource$LazyTags.hasNext(GitHubSCMSource.java:2222)
at org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1016)
at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:374)
at jenkins.scm.api.SCMSource.fetch(SCMSource.java:284)
at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:634)
at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:277)
at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:165)
at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1025)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE

这看起来像是最近的 Jenkins 问题 (JENKINS-52397),但仍未解决:

Org Scan blows up when repository has no tags

Given a GitHub Organization Folder that has the "Discover Tags" behavior; the scan blows up on every repository that doesn't have any tags.

Workaround of adding a single tag confirmed to work

这链接到 JENKINS/GitHub Branch Source Plugin,并且在 Jenkins 2.152 中仍然可以看到。

来自 Jenkins GitHub 分支源插件的发行说明

Version 2.4.2
Release date: 2019-01-16
* JENKINS-52397: Org Scan blows up when repository has no tags #191
* INFRA-1934: Stop publishing to jenkinsci/jenkins repo on Docker Hub

参考:https://github.com/jenkinsci/github-branch-source-plugi/blob/b26aba6136024d4dfaafb9e2c36317128ceb82dd/CHANGELOG.md

如果您已经收到这些插件,可能取决于各种因素。 Jenkins 版本 2.160 (2019-01-16) 或更高版本可能是也可能不是插件的固定版本至少在设置时可用的安全指标。