Custom Build from an extended tab


I'm writing a plugin to TeamCity and I would like to do the following things.

  1. Create an extended tab that shows certain options (our internal logic) in an extended tab. (This is actually done.)
  2. List available build agents on the extended tab. (How do I get a list of build agents?)
  3. List available parameters on the same tab. (How to I get a list of parameters?)
  4. When user clicks on "Run" button on the extended tab, it gathers the parameter values and build agent(s) and runs the build. (How do I execute builds using TeamCity APIs?)

I'm sorry if I jammed too many questions in one thread.

Comment actions Permalink


I suppose you know build configuration where you want to start a build. If this is the case, you can obtain list of agents which can run build of this build configuration using method:
SBuildType#getCanRunAndCompatibleAgents(boolean includeDisabled)

Not sure what parameters do you need, but if you happen to know build configuration where you start build, you can use this method:

This method will return complete map of parameters configured for build configuration, including parameters inherited from projects and templates.

As to triggering builds, there are a few methods. First of all, to trigger a build with the same settings as in SBuildType you can use this method:

Where requestor is a string describing who triggered this build. It can be arbitrary string.

But since you're asking about parameters I suppose you need to start customized build, i.e. build with custom parameters. In this case it is better to use BuildCustomizer. Something like this:

jetbrains.buildServer.serverSide.BuildCustomizerFactory customizerFactory; // Spring bean
BuildCustomizer customizer = customizerFactory.createBuildCustomizer(buildType, null);
BuildPromotion p = customizer.createBuildPromotion();
p.addToQueue(requestor); // or p.addToQueue(agent, requestor) if you want to start build on specific agent
Comment actions Permalink


I've actually figured them all out just yesterday but I still appreciate your reply. :)

The APIs are nicely organized that I was able to figure things out. I'm quite impressed how extendable TeamCity is. I do have different questions, but I will create another thread so that the question  won't get mixed up with this one.


Comment actions Permalink

Hi Hayato,


Can I ask if this plugin is being used personally or will you be sharing it? We are looking for the exact same functionality without looking into develop a plugin/extended the current one.


Thank you


Please sign in to leave a comment.