httpAuth and viewType.html

Hi there,

I would like to programatically access the agent requirements webpage of a given build configuration. The URL to get this information is:

http://teamcity/viewType.html?buildTypeId=bt54&tab=compatibilityList

If I try to access this programatically, I get authentication problems, but normally I get around this by going via the httpAuth url:

http://teamcity/httpAuth/viewType.html?buildTypeId=bt54&tab=compatibilityList

But that just gives me an error page with:

'The requested resource (/httpAuth/viewType.jsp) is not available.'

Which makes it sound like viewType.jsp doesn't exist, but it does (I had a look on the server), more interestingly, if I try to view this URL:

http://teamcity/httpAuth/viewType.html

(notice I am not specifying any parameters), I get redirected to the overview.html page, with a yellow warning at the top of the page:

'Build configuration does not exist.'

Which to me indicates it was able to get to viewType.jsp and determine that I didn't provide it a build configuration ID.

I'm rather lost now, could anyone possibly point me in the right direction; I'm guessing it's probably be being stupid, but I can't think how right now!

Many thanks,

Steve

3 comments

Steven,


Seems like you've ensountered TW-2748: the "httpAuth" prefix is supported for direct requests to controllers, but not for JSP pages (yet).

Feel free to vote for the issue.

So far I could not sugest a workaround for you rather then writing your own TeamCity plugin that will serve the information you need. If you decide to go this way you can start off REST API plugin.

BTW, Can you describe why do you need the compatible agents data outside of TeamCity?

0

Thanks Yegor,

One thing we use TeamCity for is creating disc builds of our various products (which are computer games). When we create these disc builds, there are a large amount of options that can be set (do we want an ISO image, or an electronic distribution, is it a patch, what platform is it for, do we want QA options in the code, do we want to build from a specific tag or from latest code/data, and so on and so forth).

Due to the huge amount of options we need to specify we decided we didn't want to end up with hundreds of TeamCity build configurations, instead we have a standalone application that lets us setup the correct build options, and then sends the job to TeamCity. On our TeamCity network, we have two machines that are setup for performing disc builds (they have SSD hard drives, and other settings that make them produce disc builds multiple times faster than our other build agents), so at the moment our application just sends our job to a build configuration, and then TeamCity decides which agent to perform said build on.

The problem we have is we tag our SVN data for important builds, and also branch of towards the end of projects, our data set is about 100 GB, and we end up finding that our builds take much longer to complete because of the amount of time it takes to switch SVN between one tag and another. So what the production team would like to be able to do is have some control over which builds get performed on which agent. For now, I can achieve this by adding a drop down box with a hard coded list of compatible agents, but I was just trying to find out if I could automate this by scraping the 'compatible agents' from the build configuration.

We also have a number of other agents that *can* make disc builds, they will just take longer to make them, so by default production doesn't want to use said agents, but at times where multiple projects are creating ISOs at once, they would like the option of making use of all agents, so again I was hoping to be able to query some information from TeamCity to know what agents are suitable.

One thing I have found is this:

http://tt-teamcity/httpAuth/app/rest/agents

Which gives a list of all agents (along with their ID), and also a URL (per agent), that provides full information about the agent, including what environment variables they have - and as it goes, the environment variables tell me which agents are suitable for disc builds, so in a roundabout way I can actually achieve what I want.

I have voted for the issue you linked to, as it would be a nice addition.

Many thanks for helping out once again,

Steve

0

Steven,

Thank you for the detailed description! It's always interesting to know how the product is used in different setups.

We should really think on adding compatible agents information into build configuraition REST data (BTW, that can be implemented as a really simple Java plugin to TeamCity).
If you need more from the API - please file requests into our tracker so others can vote and you can get notification on resoolution.

Back to original issue with httpAuth: a collegue of mine reminded me that actually after each request via httpAuth, TeamCity should return jsessionid cookie that can later be used to request URLs without httpAuth and with no authentication. So you can probably explore that.
However, using a separate API/plugin not bound to parsing HTML looks more clean and reliable.

0

Please sign in to leave a comment.