Search code examples
xcode7xcode-server

How do I delete multiple integrations at once in Xcode 7?


We ran out of disk space on the CI server (!) and have decided to clean up some older integrations. However, I can find no way to multi-select integrations in the Report navigator. Is this possible?

xcode bot integrations

(I suppose there might be a way via the unofficial API but I'd rather not)


Solution

  • As far as I know, it's only possible to delete integrations one by one. You can do so by first fetching a list of bots (GET /api/bots), finding your bot's _id (let's call it BOT_ID) and then getting the list of its integrations (GET /api/bots/BOT_ID/integrations) and just collecting their ids and revs.

    Then, you can iterate and call for each integration DELETE /api/integrations/INTEGRATION_ID/REV_ID.

    The way you call each of these APIs is e.g. curl -k -u USER:PASS https://localhost:20343/api/..., so to get all bots just run curl -k -u USER:PASS https://localhost:20343/api/bots

    See more details for yourself in this file: /Applications/Xcode.app/Contents/Developer/usr/share/xcs/xcsd/routes/routes_integration.js

    If you want to know more about XCS internals, I built a Swift SDK: https://github.com/czechboy0/XcodeServerSDK and wrote about the internals in http://honzadvorsky.com/articles/2015-05-04-under-the-hood-of-xcode-server/