Daniel C. Sobral
Daniel C. Sobral

Reputation: 297185

Triggering build on Bamboo for pull requests on Stash?

I want to know if it is possible to configure something similar to what is accomplished by Jenkins+Github with the request builder plugin. Specifically, triggering a build on Bamboo when a pull request is created on Stash, using the pull request branch for the build.

Bonus points for triggering new builds when the pull request is updated, or if some command is given through comments (like with the Jenkins plugin).

I can't see a way to do that, and I can't even see a way to create a plugin that will make it possible. Maybe the Merge-checks trigger for plugins would work, but it looks like something triggered when someone goes look at the pull request, not something triggered when a pull request arrives.

Upvotes: 16

Views: 2977

Answers (2)

Daniel C. Sobral
Daniel C. Sobral

Reputation: 297185

We solved this by writing a Stash plugin, which has now been open sourced and is available on github.

The trick is to annotate methods with com.atlassian.event.api.EventListener, which will get Stash to call them when a corresponding event happens. Then just listen to events such as:

  • com.atlassian.stash.event.pull.PullRequestCommentAddedEvent
  • com.atlassian.stash.event.pull.PullRequestOpenedEvent
  • com.atlassian.stash.event.pull.PullRequestReopenedEvent
  • com.atlassian.stash.event.pull.PullRequestRescopedEvent

Aside from that, just follow Atlassian guidelines to create plugins. The open sourced plugin can serve as a reference.

Upvotes: 5

Tomasz Szuba
Tomasz Szuba

Reputation: 905

Stash and Bamboo integration is standard in Atlassian.

Please see: https://confluence.atlassian.com/display/STASH/Bamboo+integration

Upvotes: -2

Related Questions