Is it possible to automate build creation.

I need to automate  the following process:

1. Create a branch in perforce
2. Create TeamCity VCS root pointing to new branch
3. Clone existing TeamCity build  config and modefy it:
    3.1 Attach to VCS root created in #2
    3.2 Update build number format and reset counter

Does teamcity provide API allowing to do #2 - #3.2?

Why is it required: in the project, I'm working on, I have to support up to 3 versions. E.g. if I'm working on 2.10 version it means that version 2.9 is currently in preProd and 2.8 is in Prod env. I'd like to avoid manual creation of build config each time I create new branch.

Thanks in advance

Comment actions Permalink

Please watch/vote for the feature request:

You could also write a TeamCity Java plugin that will perform the tasks using open API. Here is some basic information on the TeamCity plugins:
You can ask questions on the openAPI in our forum.

Another possible approach is modifying projects configuration directly on disk (they are stored in an XML form). There are several gotchas with id references, but this seems to be the most easiest way for a one-time task.

Kind regards,

Comment actions Permalink

Hi Marina,

I was just about to try your second solution (writing an xml-file for a new project), but first I  found the solution of creating an id outside of teamcity problematic and I also hardcode todays xml -structure and have to adapt it for new versions.

Now that there is an API, it would be nicer to create a project through with it, so Teamcity will create an xml reflecting the changes within versions.

Do you have a example in Java or groovy to create a basic project? I found several questions, mostly from before 2009, if it was possible to create a project in an automated way, but I didn't find any (java or groovy) examples how to do this. That would be a nice help for a jump start.




Please sign in to leave a comment.