简体   繁体   English

Jenkins-MultiBranch管道:无法从源获取分支

[英]Jenkins - MultiBranch Pipeline : Could not fetch branches from source

I am trying to create a Multibranch Pipeline project in Jenkins with GitHub. 我正在尝试使用GitHub在Jenkins中创建一个Multibranch Pipeline项目。

In the status page of the project I have the message that says that there are no branch with the Jenkins file and not build the project, as we can see in this image: 在项目的状态页面中,我收到一条消息,说没有Jenkins文件的分支,也没有构建项目,正如我们在此图中看到的:

在此处输入图片说明

When I scan the repository, the log shows 当我扫描存储库时,日志显示

在此处输入图片说明

I configured the project with a GitHub source, as we can see in this image: 如图所示,我使用GitHub源配置了该项目:

在此处输入图片说明

The URI of the repository, Where in the root there is the Jenkinsfile., is: https://github.com/AleGallagher/Prueba1 存储库的URI(在根目录中有Jenkinsfile。)是: https : //github.com/AleGallagher/Prueba1

Could you help me please? 请问你能帮帮我吗? I've spent many hours with this and I don't know what to do. 我已经花了很多时间这样做,我也不知道该怎么办。

Thank you! 谢谢!

To use Multibranch pipeline it is mandatory to have Jenkinsfile in repository branch. 要使用多分支管道,必须在存储库分支中包含Jenkinsfile How it works? 这个怎么运作? The Multibranch pipeline job first scans all your repository branches and looks for Jenkinsfile, if it is able to met the criteria it will proceed by executing the Jenkinsfile code and go ahead with build, if it wont be able to find the Jenkinsfile then you will find in console that "criteria not met, jenkinsfile not found in branch". 多分支管道作业首先扫描您的所有存储库分支并查找Jenkinsfile,如果它能够满足标准,则将执行Jenkinsfile代码并继续进行构建,如果它无法找到Jenkinsfile,那么您将找到在控制台中显示“条件未满足,分支中未找到jenkinsfile”。 For jenkinsfile kindly visit https://jenkins.io/doc/book/pipeline/jenkinsfile/ 对于jenkinsfile,请访问https://jenkins.io/doc/book/pipeline/jenkinsfile/

Recommendation:- 建议:-

  1. Choose git as an option for Branch source. 选择git作为“分支源”的选项。
  2. Set credentials- give preference to ssh. 设置凭据-优先使用ssh。 put privatekey as jenkins side 将私钥作为詹金斯方面
  3. Make sure you have correct access to Repository, if not give access by put key of same user (ssh public-key in repository) 确保您对存储库具有正确的访问权限,如果没有通过同一用户的put密钥提供访问权限(存储库中的ssh公共密钥)

Let me know if issue still persists. 让我知道问题是否仍然存在。

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

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