Git push to specific branch on multibranch pipelines builds all branches

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Git push to specific branch on multibranch pipelines builds all branches

Harlan Barnes
Hello Jenkins Friends,

I'm having a problem getting the configuration correct for my multi-branch pipeline. Here are the details

* I have a Jenkins job configured with a simple Git Branch Source with the following options:
  * Discover All Sources
  * Filter by name (with regular expression): (master|v\d+\.\d+) ... this should pick up master and v1.14, v1.15, etc.

* I see the current expected list of branches appear for building: master and v1.14

* The Jenkinsfile for both branches is the same (v1.14 is a branch of master) and has the following setup for triggering with a github push:

          properties([
            pipelineTriggers([triggers: [[$class: "GitHubPushTrigger"]]])
          ])

* When I push a change to master, both the "master" and the "v1.14" branches build.

* The Github Hook Log for master is below and looks about what I would expect:

Started on Nov 21, 2017 6:26:55 PM
Started by event from 192.30.252.34 ⇒ http://not.the.real.hostname/github-webhook/ on Tue Nov 21 18:26:55 UTC 2017
Using strategy: Specific revision
[poll] Last Built Revision: Revision 69062e9fb06a7b458642c35bc07aaea1e3794cdc (master)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/master is: 3fc35f5d4619a6e8bdcdec490e25378e64b674e0
Using strategy: Default
[poll] Last Built Revision: Revision 69062e9fb06a7b458642c35bc07aaea1e3794cdc (master)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/master is: 3fc35f5d4619a6e8bdcdec490e25378e64b674e0
Done. Took 0.48 sec
Changes found

* The Github Hook Log for v1.14 starts out okay, but then says it's checking "master" too:

Started on Nov 22, 2017 3:05:52 PM
Started by event from 192.30.252.45 ⇒ http://not.the.real.hostname/github-webhook/ on Wed Nov 22 15:05:52 UTC 2017
Using strategy: Specific revision
[poll] Last Built Revision: Revision 6b49bb9293b66ba6f19500b7613c992ba49dfdc6 (v1.14)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/v1.14 is: 6b49bb9293b66ba6f19500b7613c992ba49dfdc6 - already built by 2
Using strategy: Default
[poll] Last Built Revision: Revision 6b49bb9293b66ba6f19500b7613c992ba49dfdc6 (v1.14)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/master is: 017f8e7c0c8ba5e064418a4445aaef3f4bee13c1
Done. Took 0.45 sec
Changes found

* As you can see in the v1.14 hook log, it says that the v1.14 branch was already build by build id #2 ... but then it goes on to check the head revision against "ref/heads/master" and says it's different and "changes found".

Can anyone point me to the detail I'm missing in this configuration?

Thanks,

Harlan Barnes

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b6f0e7a1-36ea-48ba-9837-e43156389c90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Git push to specific branch on multibranch pipelines builds all branches

stephenconnolly

On 22 November 2017 at 15:17, Harlan Barnes <[hidden email]> wrote:
Hello Jenkins Friends,

I'm having a problem getting the configuration correct for my multi-branch pipeline. Here are the details

* I have a Jenkins job configured with a simple Git Branch Source with the following options:
  * Discover All Sources
  * Filter by name (with regular expression): (master|v\d+\.\d+) ... this should pick up master and v1.14, v1.15, etc.

* I see the current expected list of branches appear for building: master and v1.14

* The Jenkinsfile for both branches is the same (v1.14 is a branch of master) and has the following setup for triggering with a github push:

          properties([
            pipelineTriggers([triggers: [[$class: "GitHubPushTrigger"]]])
          ])

Dont do that.

Multibranch is opinionated, if you have set up your webhook correctly, you are done. That config is what is causing your issue
 

* When I push a change to master, both the "master" and the "v1.14" branches build.

* The Github Hook Log for master is below and looks about what I would expect:

Started on Nov 21, 2017 6:26:55 PM
Started by event from 192.30.252.34 ⇒ http://not.the.real.hostname/github-webhook/ on Tue Nov 21 18:26:55 UTC 2017
Using strategy: Specific revision
[poll] Last Built Revision: Revision 69062e9fb06a7b458642c35bc07aaea1e3794cdc (master)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/master is: 3fc35f5d4619a6e8bdcdec490e25378e64b674e0
Using strategy: Default
[poll] Last Built Revision: Revision 69062e9fb06a7b458642c35bc07aaea1e3794cdc (master)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/master is: 3fc35f5d4619a6e8bdcdec490e25378e64b674e0
Done. Took 0.48 sec
Changes found

* The Github Hook Log for v1.14 starts out okay, but then says it's checking "master" too:

Started on Nov 22, 2017 3:05:52 PM
Started by event from 192.30.252.45 ⇒ http://not.the.real.hostname/github-webhook/ on Wed Nov 22 15:05:52 UTC 2017
Using strategy: Specific revision
[poll] Last Built Revision: Revision 6b49bb9293b66ba6f19500b7613c992ba49dfdc6 (v1.14)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/v1.14 is: 6b49bb9293b66ba6f19500b7613c992ba49dfdc6 - already built by 2
Using strategy: Default
[poll] Last Built Revision: Revision 6b49bb9293b66ba6f19500b7613c992ba49dfdc6 (v1.14)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/master is: 017f8e7c0c8ba5e064418a4445aaef3f4bee13c1
Done. Took 0.45 sec
Changes found

* As you can see in the v1.14 hook log, it says that the v1.14 branch was already build by build id #2 ... but then it goes on to check the head revision against "ref/heads/master" and says it's different and "changes found".

Can anyone point me to the detail I'm missing in this configuration?

Thanks,

Harlan Barnes

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b6f0e7a1-36ea-48ba-9837-e43156389c90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMwUpS5EYDCVd6hBjeLmR5Wyeh1ZJdzw5eVFfD50R_0KtQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Git push to specific branch on multibranch pipelines builds all branches

stephenconnolly


On 22 November 2017 at 15:49, Stephen Connolly <[hidden email]> wrote:

On 22 November 2017 at 15:17, Harlan Barnes <[hidden email]> wrote:
Hello Jenkins Friends,

I'm having a problem getting the configuration correct for my multi-branch pipeline. Here are the details

* I have a Jenkins job configured with a simple Git Branch Source with the following options:
  * Discover All Sources
  * Filter by name (with regular expression): (master|v\d+\.\d+) ... this should pick up master and v1.14, v1.15, etc.

* I see the current expected list of branches appear for building: master and v1.14

* The Jenkinsfile for both branches is the same (v1.14 is a branch of master) and has the following setup for triggering with a github push:

          properties([
            pipelineTriggers([triggers: [[$class: "GitHubPushTrigger"]]])
          ])

Dont do that.

Multibranch is opinionated, if you have set up your webhook correctly, you are done. That config is what is causing your issue.

To clarify, multibranch automatically detects those push events and handles them automatically.
 
 

* When I push a change to master, both the "master" and the "v1.14" branches build.

* The Github Hook Log for master is below and looks about what I would expect:

Started on Nov 21, 2017 6:26:55 PM
Started by event from 192.30.252.34 ⇒ http://not.the.real.hostname/github-webhook/ on Tue Nov 21 18:26:55 UTC 2017
Using strategy: Specific revision
[poll] Last Built Revision: Revision 69062e9fb06a7b458642c35bc07aaea1e3794cdc (master)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/master is: 3fc35f5d4619a6e8bdcdec490e25378e64b674e0
Using strategy: Default
[poll] Last Built Revision: Revision 69062e9fb06a7b458642c35bc07aaea1e3794cdc (master)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/master is: 3fc35f5d4619a6e8bdcdec490e25378e64b674e0
Done. Took 0.48 sec
Changes found

* The Github Hook Log for v1.14 starts out okay, but then says it's checking "master" too:

Started on Nov 22, 2017 3:05:52 PM
Started by event from 192.30.252.45 ⇒ http://not.the.real.hostname/github-webhook/ on Wed Nov 22 15:05:52 UTC 2017
Using strategy: Specific revision
[poll] Last Built Revision: Revision 6b49bb9293b66ba6f19500b7613c992ba49dfdc6 (v1.14)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/v1.14 is: 6b49bb9293b66ba6f19500b7613c992ba49dfdc6 - already built by 2
Using strategy: Default
[poll] Last Built Revision: Revision 6b49bb9293b66ba6f19500b7613c992ba49dfdc6 (v1.14)
 > git ls-remote -h [hidden email]:FakeOrg/FakeRepo.git # timeout=10
Found 91 remote heads on [hidden email]:FakeOrg/FakeRepo.git
[poll] Latest remote head revision on refs/heads/master is: 017f8e7c0c8ba5e064418a4445aaef3f4bee13c1
Done. Took 0.45 sec
Changes found

* As you can see in the v1.14 hook log, it says that the v1.14 branch was already build by build id #2 ... but then it goes on to check the head revision against "ref/heads/master" and says it's different and "changes found".

Can anyone point me to the detail I'm missing in this configuration?

Thanks,

Harlan Barnes

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/b6f0e7a1-36ea-48ba-9837-e43156389c90%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CA%2BnPnMzxPHxhdTgXb5LaO-8v0ej93DYbz-Tk3C%2B_FUZ%3DKip_wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Git push to specific branch on multibranch pipelines builds all branches

Harlan Barnes

On Wednesday, November 22, 2017 at 10:50:52 AM UTC-5, Stephen Connolly wrote:

* The Jenkinsfile for both branches is the same (v1.14 is a branch of master) and has the following setup for triggering with a github push:

          properties([
            pipelineTriggers([triggers: [[$class: "GitHubPushTrigger"]]])
          ])

Dont do that.

Multibranch is opinionated, if you have set up your webhook correctly, you are done. That config is what is causing your issue.

To clarify, multibranch automatically detects those push events and handles them automatically.
 
Well, I only added it after I couldn't get commits to trigger builds to start with. From some Googling, I saw some folks using that so I thought it was required to trigger it on push events.

But I tried it now just to be sure. I removed it, deleted the job and rebuilt it from scratch, and now the job won't trigger at all on commits.

I re-configured my webhooks (they are set at the Organization level ... I tried them at the repository level as well and it didn't work either.)

I can't find a webhook log now either ... although I see the event being received in my log:

Nov 22, 2017 5:13:53 PM org.jenkinsci.plugins.github_branch_source.PushGHEventSubscriber onEvent
INFO: Received PUSH for https://github.com/FakeOrg/FakeRepo from x.x.x.x ⇒ https://fake.hostname/github-webhook/

Is that the right webhook event handler? There's so many of them I can't tell if one plugin is affecting another.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/03c8d982-8d92-464c-ae1d-4052d639d3b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.