Is there any Jenkins plugin available to get all the active branches in a Bitbucket cloud repository?

454 views
Skip to first unread message

Vadivel Natarajan

unread,
Jul 29, 2016, 7:07:54 AM7/29/16
to jenkins...@googlegroups.com

Hi All,

 

I started to work with Jenkins for a week. I have referred the Jenkins plugins and implemented a Jenkins to build the source. Now, I need to get all the active branches in a BitBucket cloud repository from a Jenkins job(automatically) and build the sources for the particular branch alone if commits done on the same branch. 

 

Note: If any new branch created from the Bitbucket cloud repository, then that should also be detected and start the Jenkins job if commit done for the branch source.

 

Could anyone please guide me on this to get all the active branches in a Bitbucket cloud repository using Jenkins?  Is there any plugin available for this?

 

I have also referred the below links. But, this link specified to trigger the jenkins job for the particular branch  and we need to manually include the branch name in jenkins job.

 

  1. http://stackoverflow.com/questions/20713157/is-it-possible-to-trigger-jenkins-from-one-specific-branch-only
  2. http://stackoverflow.com/questions/19003098/how-can-i-make-jenkins-only-build-feature-branches-if-they-have-changed-when-tri
  3. http://stackoverflow.com/questions/27388145/bitbucketjenkins-trigger-build-only-when-specific-branch-is-changed
  4. http://stackoverflow.com/questions/11231064/how-do-i-get-jenkins-to-build-on-push-to-a-bitbucket-git-repository

 

Stackoverflow query: http://stackoverflow.com/questions/38657171/is-there-any-jenkins-plugin-available-to-get-all-the-active-branches-in-a-bitbuc 


Thanks.

Mark Waite

unread,
Jul 29, 2016, 8:09:04 AM7/29/16
to jenkins...@googlegroups.com
I really like the "multi-branch" plugins ("Multi-branch project plugin" - https://wiki.jenkins-ci.org/display/JENKINS/Multi-Branch+Project+Plugin and "Pipeline Multibranch Plugin" - https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Multibranch+Plugin and GitHub Organization Folders) because they automatically create, run, and destroy jobs for each branch based on selection criteria.

The Pipeline Multibranch Plugin uses an inclusion list and an exclusion list to create a job for each branch in a repository that contains a "Jenkinsfile" in its root directory.  The build is then executed based on the definition in that Jenkinsfile.  Examples of Jenkinsfile contents are available from various pipeline example repositories.

The Multi-branch project plugin uses an inclusion list and an exclusion list to create a job for each branch in a repository, then runs the user defined build step (ant, maven, gradle, Xshell, shell, batch, etc.).

The GitHub Organization Folders plugin probably won't work in your case, since you're using BitBucket, but it takes it one step further.  It monitors an organization on GitHub, selects repositories based on an inclusion list, then creates a folder for each repository, and jobs for each matching branch in each repository.  It also seems to automatically configure a pull request builder for each of the repositories, so that pull requests are automatically evaluated, with the results of the pull request uploaded to GitHub.

Mark Waite

--
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 jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAByDd%3DfO0TarwMjHUZjeHWoHgFetRQ3LOKLkBD5N%2BG%2BU0J74KQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages