Skip to content

Builds#build_artifacts fails to retrieve artifacts w/ TeamCity API 9.X #47

Description

@fortinmike

It seems like the root key in JSON output for TeamCity artifacts has changed in v9.X; it used to be "files", now it is "file". This causes teamcity-ruby-client to always return nil from Builds#build_artifacts when using the v9.X API.

https://gist.github.com/fortinmike/ac80adfbade2b2d5e0c7

I suppose this is a bug in TeamCity's API as the XML output stays the same from v8.X to v9.X. Still, this makes teamcity-ruby-client fail to fetch artifacts when using the default non-versioned API endpoint. Took me some time to figure it out.

Maybe falling back like this would be a reasonable workaround?

def build_artifacts(build_id)
    response = get("builds/#{build_id}/artifacts")
    response['files'] || response['file']
end

I have not noticed other issues with teamcity-ruby-client using the v9.X API apart from that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions