Search code examples
iosxcodexcode6xcode-bots

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 or exit 0 in pre-build script but it just ends given script not whole building process. So my question is how I can abort Xcode bot build (integration)?


Solution

  • 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.