Trigger bamboo deploy plan creation in a plugin in 5.9

David Kesler August 28, 2015

We've written a plugin that triggers deployment plans programatically.  After upgrading from 5.6 to 5.9 it has broken due to a backwards incompatible change in the bamboo api.  Previously we used 

Deploymentcontext context = deploymentExecutionService.prepareDeploymentContext(environment, version, reason);
deploymentExecutionService.execute(context);

However in 5.9, deploymentExecutionService.execute now takes an environment and an EnvironmentTriggeringAction.  I can't figure out how i'm supposed to create an EnvironmentTriggeringAction since it's an interface.  i found EnvironmentTriggeringActionFactory, but that's also an interface.  I tried wiring it in just like a service, but it doesn't get wired in.  I can't find anything else that would let me create an EnvironmentTriggeringAction.

How am i supposed to trigger deploy plans now? 

Also, tangentially, why was backwards compatibility broken without warning in the api changelog?

2 answers

0 votes
Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 30, 2015

1) The change had to be done because old logic was broken. There is no meaningful implementation for the old interface and it had to be removed. See: BAM-15501

2) Moreover, the correct method to be called when triggering deployment is NonBlockingPlanExecutionService.tryToStart(
environment, environmentTriggeringAction). The method's signature:

 Future<ExecutionRequestResult> tryToStart(@NotNull Triggerable triggerable,
                                              @NotNull BuildDetectionAction buildDetectionAction);

3) EnvironmentTriggeringAction is an interface because plugins triggering deployments are supposed to implement it. You can find examples in Bamboo source code.

4) If you want to use one of existing implementations of EnvironmentTriggeringAction, EnvironmentTriggeringActionFactory is available to plugins. In fact, deployment triggers built-in in Bamboo are implemented as plugins. They wouldn't work if the factory wasn't available to them.
(did you put <component-import> statement into your atlassian-plugin.xml?)

Marcin Gardias
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 31, 2015

Also, DeploymentExecutionService is now correctly annotated as @Internal.

0 votes
Steffen Opel _Utoolity_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 28, 2015

How am i supposed to trigger deploy plans now? 

Good question, I hope an Atlassian Bamboo team member chimes in here.

Also, tangentially, why was backwards compatibility broken without warning in the api changelog?

Likewise a good question - we had stumbled over a significant (and as of today still undocumented) Bamboo 5.9 API change as well, and I have requested a resp. changelog update two month ago already, which you might want to watch/vote/comment on accordingly:

While the minor sorting issue mentioned there too has meanwhile been (silently) fixed, the Changes for 5.9 documentation itself has not yet been amended in any way.

  • I really appreciate that the actual issue that we had encountered has been addressed in due course (less than a day turn around for fixing a critical bug is excellent!) - regardless, I'm a bit at a loss what keeps the Bamboo team from documenting such changes properly (and ideally upfront/ongoing) so that the add-on ecosystem can keep concentrating on adding value to Bamboo (instead of chasing undocumented incompatibilities like the one at hand).

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events