Accurev Plugin - Post Build Notification

When a build is complete does TeamCity provide a way of reporting the results/status of the build to the VCS plugin?
If not what is the best way to implement a Post Build Event that promotes the current Stream if the build was successful.
Thanks

11 comments

VCS plugin can register its' own jetbrains.buildServer.serverSide.BuildServerListener and watch for buildFinished event. When event occurred listener should check whether build has corresponding VCS root (see SBuild::getVcsRootEntries() method) and after that it can perform any additional action. Note that it is not recommended to perform some long actions in a listener method, it is better to make it asynchronous.

Read more here: http://confluence.jetbrains.net/display/TCD5/Server-side+Object+Model

0

The action that we need to perform in the buildFinished() method is an accurev promote.
We cannot do it asynchronously because we need to fail the build if the promote failed.
What are the consequences if the promote takes too long?
How will the server react?

Thanks

0

The Following code does not work:

 EventDispatcher<BuildServerListener> ed = EventDispatcher.create(BuildServerListener.class);
 AccurevPromoter promoter = new AccurevPromoter();
 ed.addListener(promoter);



The AccurevPromoter is not receiving any of the events.
0

EventDispatcher is Spring bean, so you need to ask for it in the constructor of your Spring bean.
As for failing build, if you need to do so, it is better to watch for beforeBuildFinish event, in buildFinish it is too late to set the build status. Use SRunningBuild::setBuildStatus() method to fail the build.

0

How do you go about creating a Spring Bean?
Thanks

0

Please take a look at META-INF/build-server-plugin-*.xml file in AccuRev plugin, there must be a file like this. There you will find all beans defined in this plugin. You can take one of them and add new argument to the class constructor: EventDispatcher<BuildServerListener>, when Spring will construct this class it will set corresponding instance of this interface automatically.

0

I know next to nothing about spring but I did try the following:

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans default-autowire="constructor">

      <bean id="accurevServer" >
           <constructor-arg >
               <value>jetbrains.buildServer.util.EventDispatcher</value>
          </constructor-arg>
      </bean>
</beans>


------------------------------------------------------------------------------------------------------------------------------------------------------------------------


in the java file i have
------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 EventDispatcher<BuildServerListener> ed = EventDispatcher.create(BuildServerListener.class);
 AccurevPromoter promoter = new AccurevPromoter();
 ed.addListener(promoter);


------------------------------------------------------------------------------------------------------------------------------------------------------------------------
What am i doing wrong?
Thanks
0

You do not need to define argument in xml, neither you need to create event dispatcher yourself, all you need is to add one more argument to the constructor of the AccuRevVcsSupport class with type: EventDispatcher<BuildServerListener> and Spring will pass the required instance automatically, when it creates instance of the AccuRevVcsSupport.

0

I have now implemented post build events in the accurev plugin.
Thank you

0

On a slightly different subject.
Is there a way to customise the Project configuration page in TeamCity.

The accurev plugin allows you to customise the VCS settings page.
I was wondering if a different type of plugin can be used to alter the appearance and behaviour of the projects configuration page.

I have attached a screenshot of the page I'm talking about.
Thanks



Attachment(s):
teamCity.JPG
0

Please sign in to leave a comment.