TeamCity Nant REST Authentication

1.7k views Asked by At

In TeamCity, is there any way to pull all the pinned artifacts from a Build Configuration rather than just the last pinned build?

EDIT: Thanks to redsquares advice, I am attempting to solve this problem using the REST API with Nant.

I have changed from getting the pinned builds, to builds with specific tags, as this allows me to configure multiple lists if needed.

I thought I could just use the get task in Nant as follows and then follow that with the xmlpeek task to gather the information from the xml file:

<get dest="tagged.xml" src="http://<teamcity_server>:1000/httpAuth/app/rest/buildTypes/id:bt103/builds?tag=release">
    <proxy host="<teamcity_server>" port="1000">
        <credentials username="uid" password="pwd"/>
    </proxy>
</get>

I am positive the uid and pwd are correct. Despite this I keep getting the following error:

Unable to download 'http://<teamcity_server>:1000/httpAuth/app/rest
/buildTypes/id:bt101/builds?tag=release' to 'H:\<path>\tagged.xml'.
    The remote server returned an error: (401) Unauthorized.

Is the Proxy task configured incorrectly?

1

There are 1 answers

3
redsquare On BEST ANSWER

In teamcity 6 you can use the rest API to grab the artifacts for a project.

You could write a powershell script to connect to the rest api and get all pinned builds then download the artifacts for those builds.

More info and options here.