How to pass information from a Bamboo "build trigger condition" to the build that is triggered

I have implemented a build trigger condition plugin.

The basic idea is that the condition would be enabled on plans that release/package products, where the condition checks the version control system to determine if the product is “stale” (are there newer commits?) and if it is not it will stop the build. Some of our products are quite elaborate and the condition ensures a quiet/consistency period, so I would like to pass on certain data to the build from the condition if it is triggered (such as which projects are stale and the revision to build them at, etc).

The condition works perfectly but I can’t figure out how a “build trigger condition” can pass any information to the triggered build.


In case it helps anyone, after struggling with this for a long time, and reading the source code. I believe there is no way to pass data “directly” from the condition to the build because the build context is only created after the condition allows the request to proceed (which makes sense).

What I ended up doing was to always provide a return value that told Bamboo to abort the request, but when the condition thinks the plan should be executed it does so through the “/queue/PLAN” REST endpoint where we have the opportunity of setting/overriding variables. The only small trick is that I needed to schedule this POST, so the condition can return cleanly before the request is made.