automationteamcityconfluence-rest-api

TeamCity filter builds by tags or time period


Is it possible, through the rest API, to request all the builds with a specific tag? Along the same lines, can I get all the builds from a specific time period? For example, request the builds from 7 am to 7 pm of a specific date?

Background, I am trying to automatically pin builds based on a parameter. I had a custom script that used the rest api to pin builds and I used this script in a command line build step. The problem is, TeamCity won't allow you to pin a build that is in progress. So to get around this I am trying to do the following: I have a build step that uses a custom script to tag a build, then the idea is that I will have a script that I will run every night or so that grabs all the tagged builds, or builds from a specific time period and pin them.

Any other ideas are welcome as well.


Solution

  • From the rest API documentation: https://confluence.jetbrains.com/display/TCD10/REST+API#RESTAPI-BuildRequests you can use the ?locator=tag:<tagName> tag to get all the builds with a specific tag name.