5

I am trying to use Bamboo build variables in a Task plugin (e.g. bamboo.jira.version and similar). Using taskContext.getBuildContext().getVariableContext() only seems to retrieve custom build variables, and not the ones that are built into bamboo.

There doesn't appear to be much documentation on this at all in the plugin SDK documentation and there are no answers on Atlassian Answers that appear to work or that refer to API calls that are still in the SDK.

How can I accomplish this?

TylerH
  • 20,799
  • 66
  • 75
  • 101
lm5630
  • 51
  • 4

1 Answers1

2

You can inject an instance of CustomVariableContext into your task and then use the following to get the build variables:

Map<String, String> buildVariables = customVariableContext.getVariables(taskContext.getCommonContext());
TylerH
  • 20,799
  • 66
  • 75
  • 101
Michael Rueegg
  • 765
  • 4
  • 13