Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Bamboo variables in a Task plugin?

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?

like image 618
lm5630 Avatar asked Nov 12 '22 17:11

lm5630


1 Answers

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());
like image 139
Michael Rueegg Avatar answered Dec 28 '22 18:12

Michael Rueegg