[JIRA] (JENKINS-22591) Does not spawn build if a branch refers to the same SHA1 as another already built branch

1 view
Skip to first unread message

gustavo.kambara@gmail.com (JIRA)

unread,
Feb 3, 2017, 2:17:03 PM2/3/17
to jenkinsc...@googlegroups.com
Gustavo Kambara commented on Improvement JENKINS-22591
 
Re: Does not spawn build if a branch refers to the same SHA1 as another already built branch

Hello,

While I was reading some JIRA ticket, I found the non-official Jenkins plugin Git Chooser Build Branches, which defines a build branch strategy that allows Jenkins to build the same commit that was built previously, considering a different branch.

I am going to describe step-by-step how to configure, from webhook (Bitbucket) to the job configuration, in case someone else is trying to achieve the same goals.

1. Install the following Jenkins plugins:

2. On Bitbucket:

  • Access your repository settings
  • Access Webhooks -> Add Webhook
  • In URL, you should inform: YOUR_JENKINS_URL/bitbucket-hook/. Note that the trailing slash is required.
  • Configure the remaining fields as you wish

3. On Jenkins:

  • In your job, mark "This build is parameterized"
  • Add a string parameter BRANCH with the wildcard that you want, say origin/*.
  • Configure your SCM and in "Branches to build", inform the same parameter specified before. In our case, $BRANCH.
  • In Git "Additional Behaviours", add "Strategy for choosing what to build", selecting "Build branches". Also, add "Force polling using workspace".
  • In "Build Triggers", check "Build when a change is pushed to BitBucket".

That's it. When you push something in your repository (branch creation or push in existing branches), the job will be triggered.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

gustavo.kambara@gmail.com (JIRA)

unread,
Feb 3, 2017, 2:27:04 PM2/3/17
to jenkinsc...@googlegroups.com
Gustavo Kambara edited a comment on Improvement JENKINS-22591
Hello,

While I was reading some JIRA ticket, I found the non-official Jenkins plugin [Git Chooser Build Branches|https://github.com/phemmer/jenkins-git-chooser-build-branches], which defines a build branch strategy that allows Jenkins to build the same commit that was built previously, considering a different branch.


I am going to describe step-by-step how to configure, from webhook (Bitbucket) to the job configuration, in case someone else is trying to achieve the same goals.

*1. Install the following Jenkins plugins:*
- [Git|https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin]
- [Git Chooser Build Branches|https://github.com/phemmer/jenkins-git-chooser-build-branches] - you'll have to clone the repository, compile (maven) and install manually.
- [Bitbucket|https://wiki.jenkins-ci.org/display/JENKINS/BitBucket+Plugin]

*2. On Bitbucket:*
- Access your repository settings
- Access Webhooks -> Add Webhook
- In URL, you should inform: YOUR_JENKINS_URL/bitbucket-hook/. Note that the trailing slash is required.
- Configure the remaining fields as you wish

*3. On Jenkins:*
- In your job, mark "This build is parameterized"
- Add a string parameter BRANCH with the wildcard that you want, say origin/*.
- Configure your SCM and in "Branches to build", inform the same parameter specified before. In our case, $BRANCH.
- In Git "Additional Behaviours", add "Strategy for choosing what to build", selecting "Build branches". Also, add "Force polling using workspace".
- In "Build Triggers", check "Build when a change is pushed to BitBucket".


That's it. When you push something in your repository (branch creation or push in existing branches), the job will be triggered.


This build strategy could be included in Git plugin, so we have centralized configuration.

artem.zinnatullin@gmail.com (JIRA)

unread,
Mar 15, 2017, 12:52:02 PM3/15/17
to jenkinsc...@googlegroups.com
Artem Zinnatullin updated an issue
 
Jenkins / Improvement JENKINS-22591
Change By: Artem Zinnatullin
Priority: Minor Major
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

nicolas.deloof@gmail.com (JIRA)

unread,
Apr 24, 2019, 10:31:16 AM4/24/19
to jenkinsc...@googlegroups.com
Nicolas De Loof assigned an issue to Unassigned
Change By: Nicolas De Loof
Assignee: Nicolas De Loof
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

mark.earl.waite@gmail.com (JIRA)

unread,
Jan 13, 2020, 7:45:04 PM1/13/20
to jenkinsc...@googlegroups.com
Mark Waite closed an issue as Won't Fix
 

This behavior is deeply ingrained in the git plugin. Changing it would break many, many use cases. Won't fix.

Change By: Mark Waite
Status: Open Closed
Resolution: Won't Fix
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages