Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git PullRequest job failed. Couldn't find any revision to build. Verify the repository and branch configuration for this job

Yesterday my pullrequest jobs failed with the following output:

11:07:41  > git rev-parse origin/${sha1}^{commit} 11:07:41  > git rev-parse ${sha1}^{commit} 11:07:41 ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job. 

I have made an investigation and saw that in property ${sha1} there was nothing. When i paste an absolute path to pull request builder like pr/341/merge instead of ${sha1} the build works. What it can be?

Git Client Plugin 1.9.0

GitHub API Plugin 1.44

like image 918
Vladimir Voitekhovski Avatar asked May 28 '14 08:05

Vladimir Voitekhovski


People also ask

How do I set Git credentials in Jenkins?

For that purpose, we need to click on the Manage Jenkins option. Step 2: Then, a new tab will open. There we need to click on the Manage Plugin option to add the Credential option there. Step 3: Then we need to click on the Available Tab & we should search for 'Credential' in the search bar provided there.

What is Git revision?

So "revision" refers to the id you can use as a parameter to reference an object in git (usually a commit). HEAD@{5 minutes ago} is a revision which reference the commit present 5 minutes ago.


2 Answers

I spent a long time on this. The above comment "if I leave this field blank" worked like a charm. In SCM:
1) select Git
2) Name: origin
3) Refspec: +refs/pull/*:refs/remotes/origin/pr/*
4) Branches to build : leave blank

This solved the above error.

like image 166
Tammytee Avatar answered Sep 23 '22 04:09

Tammytee


According to this, Github branch's default name have been changed from "master" to "main".

So, when creating new jobs for a new repository, you have to set "main" as the branch name instead of "master".

Note that github has way to set "master" (or any other name of your convenience) as default branch name.

like image 44
Duloren Avatar answered Sep 23 '22 04:09

Duloren