The issue we have is when running this plugin inside pipeline more than once, those links are getting placed for each usage of the plugin within that job, ending up with several duplicated links for the same exact URL’s.
Is there anyway to avoid it either by writing the plugin differently, or running it differently?
You could rewrite the actions to contain a list of the relevant data. Then update publishing to check for existing actions and merge the new data instead of adding a new action.
Thank you, so that seems to solve the issue:
DSLBuildAction buildAction = new DSLBuildAction(“NA”, run);
List buildActionList = run.getActions(DSLBuildAction.class);
if (buildActionList.isEmpty()){
run.addAction(buildAction);
}
Thanks,
Actually now that you mention thread-safe, it does make sense, but I might get into a smaller corner-case in which the previous identical action is still working and I don’t want it to be replaced.
Is there a way to check if the previous identical action is still running?
An action should be a dumb view model object without any running code (it should just serve as UI model only). So if the action is deleted then it will exist - as any other Java object - until it is not needed anymore (Garbage collector).