Adam Szeptycki Adam Szeptycki - 4 months ago 23
iOS Question

How to abort XCode Bot build?

I have a problem with Xcode bots. I'm able to compile, test and archive my project, but I would like to use external tool that checks if I did code review for last commits. I would like to be able to abort build if there is no code review.
I tried to add

exit 1
exit 0
script but it just ends given script not whole building process. So my question is how I can abort Xcode bot build (integration)?


Technically, it is possible. You can cancel an integration, which immediately aborts it. It's a very similar process to triggering an integration from the command line, which I described here, but you would first need to find out the _id of the integration by calling using the endpoint /xcode/api/bots/BOT_ID/integrations and the first integration should be the latest. Copy the _id and then call a POST on /xcode/api/integrations/INTEGRATION_ID/cancel, which will cancel the integration.

I use all these APIs in my tool Buildasaur, so check out the source code for more details.