"Actual Parameters on Agent" with REST API

Hi there,

how can I retrieve parameters that were set e.g. by a build script via the REST API?
I can see them in the web interface under section "Actual Parameters on Agent".

Thanks in advance,
Alexander

9 comments
Comment actions Permalink

Hi Alexander,

Where do ou want to retrieve them? In a build? In a TeamCity agent plugin?

System proprties and environment variables are passed to the build script. Configuration parameters can be used as a reference in an environment variable.
Also, all them can be read from the files on agent during the build (see value of system.teamcity.build.properties.file env.TEAMCITY_BUILD_PROPERTIES_FILE )

0
Comment actions Permalink

I want to read them with the REST API.

E.g.: GET .../TeamCity/httpAuth/app/rest/buildTypes/bt97/builds/id:619 gives me

<properties>

     <property name="propertyxyz" value=""/>

</properties>

This Property is set during the build in a build script (to 'valuexyz' for example). I would expect to find the final value at this URL, but it's empty.

Is there a way to get around this? We have TeamCity 7.0 installed.

-Alexander

0
Comment actions Permalink

Hi,

Try GET .../TeamCity/httpAuth/app/rest/buildTypes/bt97/builds/id:619/resulting-properties
However, this request might change in the next versions of TeamCity.

0
Comment actions Permalink

I'm SO glad I saw this post. I was trying to figure out how to parse the html on the page to get at the resulting properties.

That said, besides reading the API source code, how could I have discovered this from the API itself?

0
Comment actions Permalink

Dave,

http://.../app/rest/application.wadl produces the most up-to-date and complete list of URLs supported (as it is generated from the actual code).

0
Comment actions Permalink

I still do not see the resulting parameters/app/rest/buildTypes/btype/builds/id:1234 or via /app/rest/builds/id:1234.

I only see the parameters that are defined before execution, the actual parameters on the agent as shown in the parameters tab do not seem to be available?

0
Comment actions Permalink

Just for future scavengers...
This information is not available from the rest api.  You can get it from the hidden ".teamcity/properties/build.finish.properties.gz" file on each build.

specifically something like this:
"/repository/download/$buildType/$buildId:id/.teamcity/properties/build.finish.properties.gz"

returns a gzipped java properties file.

Cheers.
--dave

0
Comment actions Permalink

Not sure why resulting-properties added to the end of the rest call didn't work for Dave Horner but appears to me to be working in local testing.

In fact appears to be documented here: https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-BuildParameters

0

Please sign in to leave a comment.