BuildTriggerDescriptor Implementation

Hi,

I'm currently trying to create a new Build Trigger using the Teamcity API.  I found the following link that explain how to do that.

http://confluence.jetbrains.net/display/TCD5/Custom+Build+Trigger

The problem that i have is when i try to add my BuildTriggerDescriptor to the SBuildType, it try to cast it to  jetbrains.buildServer.buildTriggers.BuildTriggerDescriptorImpl. I dont have any reference to that class and is not included in the api. Here is the Exception message that i have.

java.lang.ClassCastException: "Class Name" cannot be cast to jetbrains.buildServer.buildTriggers.BuildTriggerDescriptorImpl.

Do you have an idea what might cause this problem or do you have any example of a custom build trigger? Or better, is there a way to add a VCS trigger to a build configuration via the API. I did not found anything about this in the API that's why i'm trying to create my own Trigger that would in fact do the same thing.

Teamcity version used: 5.1.5 and 6.0.2

Thanks,

Marc-André Lamoureux

3 comments
Comment actions Permalink

Hi

You can look at Url Build Trigger sources for example.

At the moment we don't have API to change build configurations, but there is TW-8394 request. You can vote for it.

Another solution  would be to directly modify settings in <TeamCity Data>\config\<Project>\project-config.xml file right on a disk.

Michael

0
Comment actions Permalink

Hi,

I will check the URL Build Trigger example.

About the fact that you dont have API to change the configuration, in the Web Open API, there is the SBuildType Class that allow us to update a configuration. Can't I just use the SBuildType.addBuildTrigger(BuildTriggerDescriptor descriptor) ?  I guess the only thing preventing me to use that method is the fact that the BuildTriggerDescriptor implementation is not available via the Open API.

Thanks,

Marc-André

0
Comment actions Permalink

If you are implementing custom build trigger you do not need to implement BuildTriggerDescriptor interface. This interface exists to descrive trigger parameters and this is the server work to create instance of it.
All you need to do is create a subclass of BuildTriggerService in your plugin. And describe this class as a Spring bean in your *-spring.xml file.
You can read more about custom trigger here: http://confluence.jetbrains.net/display/TCD6/Custom+Build+Trigger

0

Please sign in to leave a comment.