Creating a Trac-Integration plugin

I started to code a custom plugin for an integration with our Trac IssueTracker.

I took http://confluence.jetbrains.net/display/TCD5/Issue+Tracker+Integration+Plugin as a starting point for it.

First of all I had problems deploying the jar to the server. Copying it to .BuildServer/plugins didn't worked for me.

So I copied

  • editIssueProvider.jsp ->${teamcity.base}/webapps/ROOT/plugins/trac/admin

  • teamcity-plugin.xml ->${teamcity.base}/webapps/ROOT/WEB-INF/plugins/trac
  • dist/trac-plugin.jar -> ${teamcity.base}/webapps/ROOT/WEB-INF/plugins/trac/server

At least its shown in the list of IssueTrackers and I can insert properties.

Im not sure if my code is called (except for the Test Button under ServerConfiguration - IssueTracker Properties).

How can I put some logging output to the server logs? With normal logger.info nothing appears in my logs :-(

Regards,

Andreas

9 comments

I made some progress on the plugin.

It gets called correctly and the last thing i have to code is to load the ticket-specific data from the server.

But there's one more question:

Is it possible to let the user add an property (from editIssueProvider.jsp) to use the IssueTracker pattern just on a specific VCS?

Currently I can only parse the comment but there may be no sufficent information to distinguish a ticket ID from several VCS.

Example:

The check-in comment is "bla bla Ticket #123" and it belongs to revision 10 in svn://host/project1

Then there's a project2 at svn://host/project2 with a check-in comment"blub blub Ticket #234" for revision 20.

I want to correctly distinguish them by their VCS.

Is that possible?

Regards,

Andreas

0

Andreas,

Just for a future note:

First of all I had problems deploying the jar to the server. Copying it to .BuildServer/plugins didn't worked for me.

This should work (and it probably works for other plugins if you try). Please doublecheck the palugin .zip has correct structure.

How can I put some logging output to the server logs? With normal logger.info nothing appears in my logs :-(

If you use Log4j then the logging can be confogired by conf\teamcity-server-log4j.xml log configuraiton. e.g. you can add
  <category name="your.package.name">
    <priority value="DEBUG"/>
    <appender-ref ref="ROLL"/>
  </category>
to get debug messages from classes in pakage "your.package.name" into teamcity-server.log.

0

Hi Andreas,

> Is it possible to let the user add an property (from editIssueProvider.jsp) to use the IssueTracker pattern just on a specific VCS?
Yes, starting from TeamCity Eluru 6.0 the API provides the corresponsing VcsModification instance. Given that you can get the VCS type. TeamCity 6.0 release is expected in November.

But please note that single VCS root can be used in different projects, and currently the project information is unavailable on IssueProvider level.
Is it a blocker in your case?

---
Maxim

0

Hello Maxim,

>But please note that single VCS root can be used in different projects, and currently the project information is unavailable on IssueProvider level. Is it a blocker in your case?

No, that's no problem. I'm just using it on two different VCS roots and I can easily distinguish them by some regex.

First im going to finish the plugin at a low level, then I'm heading for that new version...

It's possible that I'll put the sourcecode on my private SVN server if someone is interested.

Thanks for your help,

Andreas

0

Andreas,

That will be great. We'll mention your plugin on our http://confluence.jetbrains.net/display/TW/TeamCity+Plugins page.


---
Maxim

0

I finally got it working (basically).

I created a trac project site on

http://schaek-it.de/trac/projects/TracTeamcityPlugin

In the next days I'll check the source again and add stuff as I haven't checked a lot for incorrect user entry.

Maybe someone finds it helpful or wants to participate.

Thanks for you help,

Andreas

0

Hi Andreas,

Thanks for the contribution!

BTW, your plugin seems to support XML interface. Does Trac support XML-RPC?


---
Maxim

0

Why do you say that my plugin supports XML? Did I configured it wrong?

Trac does not support XML-RPC out of the box afaik.

The plugin just loads the specific ticket page and does a regex search.

0

OK, at first glance I thought your plugin requests the issues using XML interface.

0

Please sign in to leave a comment.