If seen this in your source code base:
private boolean isOnLocalAgent() { return !(buildDirectoryManager instanceof RemoteBuildDirectoryManager); }
However, it doesn't seem to work from a remote agent. I'm assuming this is switched on the server side, to tell the build processor where the build is occuring.
I need to figure out how to check if my build is being run from a remote agent vs local.
This check needs to occure within a standard CustomBuildProcessor:
public class MyProcessor extends BaseConfigurableBuildPlugin implements CustomBuildProcessor { private BuildDirectoryManager buildDirectoryManager = null; public void setBuildDirectoryManager(BuildDirectoryManager buildDirectoryManager) { logger.debug(String.format( "setBuildDirectoryManager: setting build directory manager, %s..", buildDirectoryManager.toString())); this.buildDirectoryManager = buildDirectoryManager; } private boolean isOnLocalAgent() { return !(buildDirectoryManager instanceof RemoteBuildDirectoryManager); }
Community moderators have prevented the ability to post new answers.
Try using: com.atlassian.bamboo.agent.AgentTypeHolder#get
Our implementation of isOnLocalAgent() is admitedly hacky but it works both on local and remote agents. For example, our git plugin relies on it. If it doesn't work for you I suggest looking at Spring injection in your plugin. Do you have all the "component-import" statements in atlassian-plugin.xml ?
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.