Automatic authorization and termination of cloud agents


I have two issues with my new cloud plugin, which I would appreciate some help with:

1. For the bundled cloud plugins, started cloud agents are detected as "virtual" and automatically authorized. In building my own cloud plugin, I don't see this behavior, I need to manually authorize the agents as they are started. Do I need to do something special with the agent images that I am starting? Or have I missed something in my code?

2. I have set "Terminate instance after each build" on my cloud profile. However, my code doesn't receive a call to the terminate method after a cloud agent has finished a build. I tried to also set CloudInstanceUserData.setAgentRemovePolicy(CloudConstants.AgentRemovePolicyValue.RemoveAgent) in my code, but that did not help.


1 comment


1. To have agent authorized automatically TC needs to recognize it as the agent it started. There are two methods that are responsible for that:

jetbrains.buildServer.clouds.CloudType#canBeAgentOfType - but you should implement CloudClientFactory


jetbrains.buildServer.clouds.CloudInstance#containsAgent - here you should decide whether agent matches the certain instance.

2. Please see here:



Please sign in to leave a comment.