How to set Xcode Bot to run "on commit" for all branches of remote repository?
Asked Answered
O

4

7

When creating an Xcode Bot in Xcode 6, it is linked to the current active branch in Xcode source control. There seems to be no supported way to change branches after creating the bot.

Xcode Service: Select Git Branch

I have set my bot to run "on commit". I find when I commit to that branch the bot immediately integrates the project. But when I commit to a different branch, the bot takes no action.

Ideally I would like a single Xcode Bot to look at all branches of the remote repository. When there is a new commit to any branch the bot and its tests should be run.

I do not want to create a new bot for each branch. Is there a solution?

Bug Report:
rdar://20154198

Developer Forum:
https://devforums.apple.com/thread/263490

Ohalloran answered 26/2, 2015 at 23:15 Comment(0)
O
3

Apple response from the dev forum:

This isn't something Xcode Server supports. You might be able to craft a pre-integration trigger to switch branches in the working copy and invoke seperate xcodebuild invocations, but the results reported in the UI will only be for the Xcode Server builds (the build that XCS runs after your trigger executes).

https://devforums.apple.com/thread/263490

rdar://20154198

Ohalloran answered 16/3, 2015 at 18:25 Comment(0)
D
5

There is also https://github.com/modcloth-labs/XBotBuilder developed by the same creators of the tool @jeremy-fox. It will create a bot per Pull Request, and re-run the bot for every addition in the PR.

It seems to be in early stages and without documentation but the code seems to be well organized so wouldn't be hard to get it to work or change it's behavior to do what you want.

Daladier answered 16/3, 2015 at 14:56 Comment(1)
We use this in our build process. It's incredible and could use some extra love from the communityVanzandt
H
5

For the moment we use a tool called Buildasaur (https://github.com/czechboy0/Buildasaur) to improve our CI-workflow. It's written in swift and helps to build/run/ delete bots automatically for one github repository, for example whenever a pullrequest was created or newer commits were pushed to the pullrequest. Actually it works fine on our Xcode Server 6.3. Unfortunately it works for just one repository at the same time. :-( We also hope, that Apple will implement such features soon.

Hanes answered 30/4, 2015 at 9:26 Comment(2)
I'm working on the multi-repo support :) Vote it up: github.com/czechboy0/Buildasaur/issues/12Anderlecht
Actually, Buildasaur now supports multi-repository sync.Anderlecht
D
3

This is not currently possible with Xcode Bots (current versions are Xcode Server 4.0.3 & Xcode 6.2). A Bot will only track the specific branch form which it was created.

This was possible in the past on Xcode Server 3 and Xcode 5 using https://github.com/modcloth-labs/github-xcode-bot-builder but this project hasn't been updated to work with the latest version of Xcode Server and Xcode.

I'm also really hoping Apple introduces this feature soon, it would be great to be able to have a single bot monitoring a repo for new Pull Requests and when found run an integration against that PR. For now though, it's just not possible.

Update 3/19/2015: As @Gus reports in another answer, there is a new Mac OS X based project that can help with ad hoc bot creation for feature branches/PR's called XBotBuilder - https://github.com/modcloth-labs/XBotBuilder. It should be worth noting that currently, this project only works with one github repo. So, if you have more than one repo you'd like to monitor for PR's, this is still not currently possible unless you have multiple machines each running a different instance of XBotBuilder and targeting a different repo.

Distributor answered 13/3, 2015 at 15:19 Comment(1)
Thanks. You can dupe rdar://20154198 if you'd like to help!Ohalloran
O
3

Apple response from the dev forum:

This isn't something Xcode Server supports. You might be able to craft a pre-integration trigger to switch branches in the working copy and invoke seperate xcodebuild invocations, but the results reported in the UI will only be for the Xcode Server builds (the build that XCS runs after your trigger executes).

https://devforums.apple.com/thread/263490

rdar://20154198

Ohalloran answered 16/3, 2015 at 18:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.