-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jenkins doesn't build branches when refspec has been defined #77
Comments
Hi, usually the use case is to have two jobs - one for normal Continuous Integration (in which there is nice history) and one for testing pull requests (in which the history is a mess, eg because of #73). I only tried to set default value to |
As far as I can tell it is now possible to supply multiple refspecs to the Git plugin, separated by space. A quick test so far seems to indicate that, for me, |
Using the default `refspec` prohibits the project from automatically building non-PR branches like `origin/master`. Prepending the `refspec` with the heads and remote/origin allows the project to build pull requests as well as other branches like `origin/my-feature`. This should resolve jenkinsci#77. Big thanks to janinko#77 (comment) 😄
for me it didn't work jenkins starts a build when i commit to my branch i use any idea? can anybody confirm this? |
same issue for me, can someone help? |
I confirm this, still not working |
could you reopen that issue since it seems to be still a problem? |
@emmanuelmathot this is an issue with the Jenkins git plugin, unless the commit sha is incorrect that is provided from the ghprb plugin |
I usually wouldn't post on a clearly old thread, however I too can't get both PR & push to build using a single ref spec In the github hook log I see that the pushed branch doesn't get matched against for some reason I did manage to get it working though, by specifying a refspec of With the above it seems that both PR's & branches build properly |
The steps provided by @nullify005 work for getting the job to trigger, but the job immediately fails on PR builds with
Notice that it is (as expected) asking for only the master refs but then trying to find the PR refs (which won't exist locally). This is using the Multiple SCM widget in the job configuration. |
I was able to work around this by specifying both ref specs in both git jobs, but in reverse of each other: One of them has:
The other has:
From git's point of view, both are identical (since it doesn't care about order). From the trigger's point of view, they are different because it appears to ignore all but the last. |
Nevermind, it only works for the PR build when I do that, not the master build. :/ |
To be clear, does this means that currently it is impossible to build both master and PR inside the same jenkins job? If not impossible, what would be the correct way to do it? |
@ssbarnea It is possible, though awkward. I also have triggers setup for |
HI, Kindly please help me how can i configure PR for "abc" branch. Thanks, |
@Zoltu This doesn't seem to work. I have a jenkins job that runs when code is pushed to The job picks up PRs and builds them. Same with pushes to Job config
Jenkins and plugin versions
|
A bug in jenkins gitplugin prevents to notice changes when using refspec over certain branch only [1]. This seems to be fixed in the 3.4.0 version of jenkins gitplugin [2]. [1] janinko/ghprb#77 [2] https://wiki.jenkins.io/display/JENKINS/Git+Plugin Change-Id: I0d069be886ef0dee8c3fa9108e5a34a7483abdab Signed-off-by: Aníbal Limón <[email protected]>
To save others from mistyping like I did, it is:
I also had to set branch specifier to
|
What you must do within section 'Repositories':
|
Using the default `refspec` prohibits the project from automatically building non-PR branches like `origin/master`. Prepending the `refspec` with the heads and remote/origin allows the project to build pull requests as well as other branches like `origin/my-feature`. This should resolve jenkinsci#77. Big thanks to janinko#77 (comment) 😄
I have defined
+refs/pull/*:refs/remotes/origin/pr/*
as my refspec and${sha1}
as my branch to build.Now this stops me from building my normal branches when something is pushed to them, how can this be fixed?
I tried setting multiple refspecs but it didn't seem to work, maybe my syntax was wrong...
The text was updated successfully, but these errors were encountered: