stack72 / TeamCitySharp

No Longer Maintained - please use https://github.com/mavezeau/TeamCitySharp
Other
200 stars 165 forks source link

StartDate/FinishDate empty since update to TeamCity 8.1 #66

Open sdraht opened 10 years ago

sdraht commented 10 years ago

I use Builld.StartDate (FinishDate would work as well) to detect which builds I already know and which are new (and to describe the builds with their date): var newBuilds = this.client.Builds.SuccessfulBuildsByBuildConfigId(this.buildType).Where(b => b.StartDate > this.lastCheck); Unfortunately these dates are always empty since upgrade to TeamCity 8.1, http://confluence.jetbrains.com/display/TCD8/Upgrade+Notes also states that there has been some change in the REST API:

REST API ... In the lists of builds, "startDate" attribute is not longer included in the "build" node. It has become an element instead of attribute to match the full build data representation. Would be nice if this could be fixed without breaking compatibility to older TeamCity versions.

guillaume86 commented 10 years ago

I have the same issue

nchaly commented 10 years ago

Just a speculation -

For workaround you could patch Builds.ByBuildLocator: add fields=$long,build($short,startDate,finishDate) to url.

In terms of good design that would require some additional work. First, a caller should specify additional fields taking server version into consideration. Second, fields specification should be provided somehow to caller. Probably some IFieldsSpec, with default one returning nothing, and Build81FieldSpec returning $long,build($short,startDate,finishDate)? This can be also combined with attribute-based (however it would be concealed from library clients).

Probably, this should go the same way as SQL (never make select *), and specify fields explicitly all the time?

guillaume86 commented 9 years ago

Yes I used this line to get everything back:

var buildWrapper = _caller.GetFormat<BuildWrapper>("/app/rest/builds?locator={0}&fields=$long,build($short,startDate,finishDate,changes(change($short,comment)))", locator);