Git plugin: how does it decide to build instead of aborting?

127 views
Skip to first unread message

bl0ck3r

unread,
Aug 1, 2015, 8:44:37 PM8/1/15
to Jenkins Users
In the big picture, I want to give my users a job where they specify both the source (fork) and destination (upstream) git repository, as well as the source and destination branch names, and I want jenkins to merge the source (repo, branch) into the destination (repo, branch), then build. The source repo is a fork of the upstream repo, necessarily.

The git-plugin clones and fetches everything without any problem, but it errors out in the end. I am puzzled.

Here is the configuration:
Repo URL: ${UPSTREAM_REPO}
Name: upstream
Refspec: +refs/heads/${UPSTREAM_BRANCH}:refs/remotes/upstream/${UPSTREAM_BRANCH}

Repo URL: ${FORK_REPO}
Name: fork
Refspec: +refs/heads/${FORK_BRANCH}:refs/remotes/fork/${FORK_BRANCH}

Additional behaviours:
Wipe out repository and force clone
Check out to specific local branch: ${UPSTREAM_BRANCH}
Merge before build
Name of repository: upstream
Branch to merge to: ${UPSTREAM_BRANCH}

The the user supplies the four parameters:
UPSTREAM_REPO=ssh://g...@stash.domain.com/path/project.git
UPSTREAM_BRANCH=master
FORK_REPO=ssh://g...@stash.domain.com/~user/project.git
FORK_BRANCH=master

The the user hits build, and the git-plugin ends with an error:
Seen branch in repository fork/master
Seen branch in repository upstream/master
Seen 2 remote branches
ERROR: Couldn't find any revision to build. Verify the repository and branch configuration for this job.
Finished: Failure


There are no errors before that in the log. The workspace contains the .git folder, with those branches not checked out - despite the fact that I asked for a specific local branch to be checked out:
git branch -a
  remotes/fork/master
  remotes/upstream/master

What causes the Git plugin to error out like that? What makes it decide that it should abort instead of proceeding with the build?

I use Git 2.4.3, git-plugin 2.4.0, jenkins 1.609.1.

Thanks,
Martin

Christopher Orr

unread,
Aug 4, 2015, 7:12:36 PM8/4/15
to jenkins...@googlegroups.com
On 02/08/15 02:44, bl0ck3r wrote:
> The git-plugin clones and fetches everything without any problem, but it
> errors out in the end. I am puzzled.
>
> Here is the configuration:
> Repo URL: ${UPSTREAM_REPO}
> Name: upstream
> Refspec:
> +refs/heads/${UPSTREAM_BRANCH}:refs/remotes/upstream/${UPSTREAM_BRANCH}
>
> Repo URL: ${FORK_REPO}
> Name: fork
> Refspec: +refs/heads/${FORK_BRANCH}:refs/remotes/fork/${FORK_BRANCH}

> The the user hits build, and the git-plugin ends with an error:
> Seen branch in repository fork/master
> Seen branch in repository upstream/master
> Seen 2 remote branches
> ERROR: Couldn't find any revision to build. Verify the repository and
> branch configuration for this job.

What do you have in your "Branches to build" configuration? It would
appear that it's something that doesn't match any of the remote branches.

bl0ck3r

unread,
Aug 5, 2015, 10:15:54 PM8/5/15
to Jenkins Users


What do you have in your "Branches to build" configuration?  It would
appear that it's something that doesn't match any of the remote branches.

That was the right question to ask... and I got it to work.
Branches to build: fork/${FORK_BRANCH}

And I even threw in the Merge before build:

Name of repository: upstream
Branch to merge to: ${UPSTREAM_BRANCH}

Now it works. Thank you.
Reply all
Reply to author
Forward
0 new messages