Capturing HTTP Response Header for build status

Hi,

I would really appreciate some guidance on the best way to implement a simple TeamCity plugin to return a standard HTTP Response Header indicating the status of all current builds (rolled up), I would like the plugin to work along the following lines.

    • Expose a non authenticated buildStatus page, e.g. http://<myTeamCityServer>:771/buildstatus.html?guest=1 that returns the HTTP Response Header (no HTML page content required in the response).
    • The buildStatus page to return an 'HTTP/1.1 200 OK' (or similar) in the HTTP Response Header if all build configurations under all projects are currently successful
    • The buildStatus page to return an 'HTTP/1.1 409 CONFLICT' (or similar) in the HTTP Response Header if all build configurations under all project are currently successful


I'm intending to switch a simple physical set of traffic lights (green and red only) on and off based on the polling the buildStatus page and retrieving the HTTP status code.

I have taken a read through the TeamCity plugin documentation, including the WebUIExtensions (http://confluence.jetbrains.net/display/TCD6/Web+UI+Extensions#WebUIExtensions-DevelopCustomController) and think that creating a new WebUI page that chats with REST API (to inspect project statuses) would be the simplest approach, is this possible?  However, being new to TeamCity plugin development any input as to the best way to achieve this (or a better way) would be greatly appreciated?

I will also open source this as a plugin for the community.

Thanks,

Lloyd

2 comments

Sadly no help from the community on this one then?
I took my approach from above and have done the following https://github.com/lholman/TeamCitySimpleBuildStatus#readme

Constructive feedback welcome.

ll

0

Lloyd,

Sorry for not replying in a timely manner.
(we a bit busy preparing 6.5 release)

Seems the plugin does not return HTTP status so far?

You can use something like:

        response.sendError(HttpServletResponse.SC_CONFLICT, "The message to return.");
        return null;
in doHandle method to return the error.
0

Please sign in to leave a comment.