xcodeosx-serverxcode-bots

Using script to fire Xcode bot


Is there a way to manually fire existing Xcode bots using shell scripts? I have a manual bot and I'd like to fire it based on certain custom logic criteria.


Solution

  • Yes.

    You'll need to do a couple of things: Firstly, I'm going to call your Xcode Server's IP address XCS_IP, usually localhost if you're on the machine where Xcode Server's running.

    Where username and password are credentials of a user that is allowed to create bots on the server, an admin will do.

    If you're interested in more details, I have an app in Swift that uses that API and many more: https://github.com/czechboy0/Buildasaur/blob/master/BuildaCIServer/XcodeServer.swift#L324

    And checkout my article on how to find Xcode Server's API "documentation": http://honzadvorsky.com/blog/2015/5/4/under-the-hood-of-xcode-server.

    TL;DR? On your Mac, look at /Applications/Xcode.app/Contents/Developer/usr/share/xcs/xcsd/routes/routes.js, where you can find the available APIs.

    Hope this helped.