简体   繁体   中英

REST API Teamcity - Get list of builds NOT containing a specific tag?

I want to get a list of all builds which have tag:cal_diff_sel but do not have tag:cal_diff_unres.

I can easily list builds with both:

http://<server>/guestAuth/app/rest/builds?locator=tag:cal_diff_sel,tag:cal_diff_unres

but putting ~ or ! within or before tag:cal_diff_unres does nothing useful.

Obviously for a simple count I can query for each and then subtract, but if I want the actual builds, I need to run both queries to exhaustion (nextHref) and then subtract the lists, which seems rather wasteful.

I found nothing in the official docs.

Damnit, why do I always find the answer moments after posting? I swear I tried this before and it didn't work.

http://<server>/guestAuth/app/rest/builds?locator=defaultFilter:false,tag:cal_diff_sel,not:tag:cal_diff_unres

You're correct that not:tag:cal_diff_unres is the current syntax to achieve this. The legacy syntax should work too: not:tags:(cal_diff_unres) . Docs here .

I wanted to add to that, though--unfortunately, you can't use more than one "not" tag clause (either in the legacy syntax or the current).

If you try to use more than one "not" tag clause in the legacy syntax, you just get a bad result--ie a build or builds that only exclude one of the excluded tags. If you use the current syntax, you get a 400 bad request with the following exception: "Only single 'not' dimension is supported in locator."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM