Jenkins - MultiBranch Pipeline : Could not fetch branches from source

Viewed 4391

I am trying to create a Multibranch Pipeline project in Jenkins with GitHub.

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:

enter image description here

When I scan the repository, the log shows

enter image description here

I configured the project with a GitHub source, as we can see in this image:

enter image description here

The URI of the repository, Where in the root there is the Jenkinsfile., is: 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!

1 Answers

To use Multibranch pipeline it is mandatory to have Jenkinsfile in repository branch. 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". For jenkinsfile kindly visit https://jenkins.io/doc/book/pipeline/jenkinsfile/

Recommendation:-

  1. Choose git as an option for Branch source.
  2. Set credentials- give preference to 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)

Let me know if issue still persists.

Related