I'm trying to update a global variable that contains authentication token. This token must be updated every 90 days. what is the atlassian code to do so?
Found from online there is com.atlassian.bamboo.configuration.variable.ConfigureGlobalVariables. how to initialize it and add bamboo plan to run periodically and update authentication token.
For reference you can check com.atlassian.bamboo.plugins.rest.admin.globalvariable.RestGlobalVariableServiceImpl#updateGlobalVariable
final VariableDefinition variableDefinition = variableDefinitionManager.findVariableDefinition(variableId);
/*or*/
variableDefinition = variableDefinitionManager.getGlobalVariables().stream().filter(byName).findFirst().get();
String preValue = variableDefinition.getValue();
variableDefinition.setValue("new value");
variableConfigurationService.updateVariableDefinition(variableDefinition, preValue);
How do we initialize variableDefinitionManager?
If I have a global variable
key:fortify.auth.token
value: xxxxxx-xxxx-xxxx-xxxx-xxxxxx
Will String preValue=variableDefinition.getValue(); sets preValue to xxxxxx-xxxx-xxxx-xxxx-xxxxxx?
Will variableDefinition.setValue("yyyyyy-yyyy-yyyy-yyyy-yyyyyy"); save global variable fortify.auth.token to yyyyy-yyyy-yyyy-yyyyyy perimenently {All the plans uses new value instead of previous value}?
_______________________________________________
can you provide me sample code that updates global variable in above case using
How to initialize uriInfo to a link http://xxxxxxx:zzzzz/kfdjg/dfd/
and restGlobalVariable?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
add it
@ComponentImport
@Autowired
private VariableDefinitionManager variableDefinitionManager
or in atlassian-plugin.xml
<component-import key="variableDefinitionManager" interface="com.atlassian.bamboo.variable.VariableDefinitionManager" />
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<dependencies>
...
<dependency>
<groupId>com.atlassian.bamboo</groupId>
<artifactId>atlassian-bamboo-api</artifactId>
<scope>provided</scope>
</dependency>
...
</dependencies>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.