jenkins-gitlab-merge-request-builder-plugin
jenkins-gitlab-merge-request-builder-plugin copied to clipboard
Merge Requests not building because Jenkins "Couldn't find any revision to build"
I am unable to get Merge Requests built due to this error: "ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job." I believe I have configured the project correctly. I've tried to create the job from scratch a couple of times. Please let me know if you need more info than I have provided.
Versions: Jenkins: 1.632 Git Plugin: 2.4.0 Git Client Plugin: 1.19.0 Gitlab Merge Request Builder Plugin: 1.2.4
Console log:
Seen branch in repository abhirao/appbuilder/20596 Seen branch in repository abhirao/appbuilder/20596_20354 Seen branch in repository abhirao/appbuilder/jenkins_test Seen branch in repository abhirao/appbuilder/master Seen branch in repository origin/master Seen 5 remote branches ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Plugin logs (gathered by adding logger for org.jenkinsci.plugins.gitlab):
Oct 14, 2015 12:30:03 PM INFO org.jenkinsci.plugins.gitlab.>GitlabMergeRequestWrapper check
The target regex matches the target branch {master}. Source branch {jenkins_test}
Oct 14, 2015 12:30:04 PM INFO org.jenkinsci.plugins.gitlab.>GitlabMergeRequestWrapper getJenkinsNote
Notes found: 0
Oct 14, 2015 12:30:04 PM INFO org.jenkinsci.plugins.gitlab.>GitlabMergeRequestWrapper check
Latest note from Jenkins is null
Oct 14, 2015 12:30:04 PM INFO org.jenkinsci.plugins.gitlab.>GitlabMergeRequestWrapper latestCommitIsNotReached
Jenkins does not remember any commit of this MR
Oct 14, 2015 12:30:04 PM INFO org.jenkinsci.plugins.gitlab.>GitlabMergeRequestWrapper check
Build is supposed to run
Oct 14, 2015 12:30:05 PM INFO org.jenkinsci.plugins.gitlab.>GitlabMergeRequestWrapper build
Build triggered.
I finally got it working by setting the branches to build to "${gitlabSourceName}/${gitlabSourceBranch}"
I was following the docs which say:
In Branch Specifier enter refs/remotes/origin/${gitlabSourceBranch} or for merge requests from forked repositories enter refs/remotes/${gitlabSourceName}/${gitlabSourceBranch}
Am I wrong or are the docs wrong? If the docs need to be updated I can send a PR your way.
I had the same problem, however I was initially able to get merge requests to work using "refs/remotes[...]". I then tried modifying a few additional values to play around with different configurations (trying to use https instead of ssh), and then reset everything to the original defaults. At that point using "refs/remotes[...]" no longer worked, but removing them and reverting to the method @abhirao describes did.
I was testing the CI build on the same merge request the whole time, using the "trigger comment" option to start new builds, so that could have something do to with it.
Confirm :+1: The string "${gitlabSourceName}/${gitlabSourceBranch}" solves my problem too.
For me this did the trick: http://julianhigman.com/blog/2016/05/17/jenkins-builds-of-gitlab-branches-stopped-working-due-to-security-patch/