Updated TeamCity WebHooks plugin available

4 07 2009

Version 0.6.13.11 of the tcWebHooks plugin is available for download. It’s mainly a bugfix release and some tidy up of the user interface.

Fixes:
- Fix for newly created WebHooks not being persisted to plugin-settings.xml until re-edited.
- Plugin JSPs loaded using getPluginResourcesPath(), so plugin dir can be anything, and not hard-coded to “webhook”.
- webHookUrl form input style fix for linux (or large fonts in general). URL input field was too wide for div.

Features:
- WebHook blurb updated. A new link can be added to the “Further reading” section of the blurb by adding a <info> line to the <webhooks> section of the main-config.xml
- Enabled events are now listed in Tabs and Edit pages, eg. Build Started, Build Changed Status, Build Interrupted, Build Almost Completed, Build Responsibility Changed

Links:

More Info | Download | Install and usage docs

I welcome any and all feedback.





Developing for TeamCity in Eclipse

28 06 2009

This document assumes you are running the TeamCity package from JetBrains, which includes Tomcat. If you are running your own Tomcat install, you may need to hunt out the files yourself. This document is based on Linux. I’ve tried to point out what you need to change on Windows, but I don’t have a Windows box to test with.

My TeamCity home  is /opt/TeamCity

Enable JSP development mode in Tomcat.

This setting alows you to hot delpoy JSPs, and Tomcat will re-compile them for you without a restart.  Edit <TeamCityHome>/conf/web.xml and find the JspServlet section. Change the development mode to true as per the section below.

<servlet-name>jsp</servlet-name>
   <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
     <init-param>
       <param-name>development</param-name>
       <param-value>true</param-value>
     </init-param>
  ...

Enable Java code hot-swapping with a debugger

We have enabled JSP hot-compile in the previous, now we need to configure Tomcat so that Eclipse can load new Java code into the JVM from within the Eclipse debugger.

For Linux, edit <TeamCityHome>/bin/teamcity-server.sh and insert the commands needed to start Tomcat with the debugger enabled. I added the TEAMCITY_DEBUG_OPTS variable, and then added it to the CATALINA_OPTS line.

TEAMCITY_DEBUG_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n"

 CATALINA_OPTS="$CATALINA_OPTS $TEAMCITY_SERVER_OPTS $TEAMCITY_DEBUG_OPTS -server $TEAMCITY_SERVER_MEM_OPTS -Dlog4j.configuration=file:$BIN/../conf/teamcity-server-log4j.xml -Dteamcity_logs=../logs/ -Djava.awt.headless=true"

For Windows, edit <TeamCityHome>\conf\teamcity-server.bat and insert the debug commands. I added the TEAMCITY_DEBUG_OPTS variable, and then added it to the CATALINA_OPTS line.

:server_mem_opts_done
SET TEAMCITY_DEBUG_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
SET CATALINA_OPTS=%TEAMCITY_SERVER_OPTS% %TEAMCITY_DEBUG_OPTS% -server %TEAMCITY_SERVER_MEM_OPTS_ACTUAL% -Dlog4j.configuration=file:../conf/teamcity-server-log4j.xml -Dteamcity_logs=../logs/

Start Tomcat

Stop Tomcat if it’s running and then start it by running <TeamCityHome>/bin/teamcity-server.sh start (or <TeamCityHome>\bin\teamcity-server.bat start on Windows).

Have a look in <TeamCityHome>/logs/catalina.out  There should be a line similar to the one below indicating that Tomcat is running with the debug port open.

Listening for transport dt_socket at address: 8000

Configure Eclipse

In Eclipse, create a new Debug Configuration (In the Java perspective, it’s under the Run menu).

Find Remote Java Application, and click the new button.  In the Connect tab, set:

  • Connection Type: Standard Socket (Attach)
  • Connection Properties:
    • Host: localhost (assuming your TeamCity instance is on your local machine)
    • Port: 8000

In the Source tab, I added my Java source directory.

Connect to Tomcat in Eclipse

Run the new Debug Config, and change to the Debug perspective. A quote from the TeamCity dev page is relevant here.

if you do not change code affecting plugin initialization and change only body of the methods, you can attach to the server process with a debugger and hot-swap the code

So if you change your registers or constructors, you need to restart Tomcat.

Deploy your JSPs

When TeamCity starts, it copies the JSPs from your plugin into <TeamCityHome>/webapps/ROOT/plugins/<YourPluginName>/

Therefore, you can copy updated JSPs to here. This might be best acheived with a simple ANT script.





TeamCity WebHooks plugin beta available

22 06 2009

Announcing a beta release (version 0.5.5.5) of a plugin for TeamCity which enhances TeamCity to provide WebHook functionality. With the tcWebHooks plugin installed, you can tell TeamCity to trigger a webhook POST request as build events occur.

WebHooks are configured on a project basis, and when events occur in the build process, a POST request is submitted to the URL. You can configure as many URLs as you like (within reason) and which events will trigger the request.

There is support for proxies in this version, and webhooks are configured in the TeamCity UI. There are a few outstanding items to tidy up, but the core functionality is working.

The project is on SourceForge at tcplugins.sourceforge.net.