Can XCode Bots be added to source control or archived? - xcode-bots

We've started to use XCode bots for CI with some success. Due to the presence of libraries and pods we have some pre and post triggers that invokes cocoapods, crashlytics etc.
Is there a way to persist the bots to source control so that if the server is reinstalled or moved to a different machine, I don't need to recreate the bot and the trigger scripts?
Apart from the trigger scripts, there are git repos that need to be connected to, verified, credentialled etc.
(I know I can create bash scripts in the source folder and invoke them however the invoking step would still need to be added)

Xcode bots are stored in a database in Xcode Server. Even though you create them locally, they are stored on the Server in /Library/Developer/XcodeServer/Database
More information dissecting how Xcode bots and server work can be found here Pretty informative look underneath.
They claim that you can hook into the api yourself from the current version of server (4.x), although apple has announced the ability to that in the next version OSX Server 5.0

Related

Notify developer that the file got overwritten

We are using Microsoft Team foundation server for version control where multiple developers are working on a branch and check in and check out the code.
How can a developer A be notified via email or SMS that his code got overwritten during the checkin by developer B.
Developer A needs to know this ASAP because the code changes of developer A will not work when its deployed into QA.
We are tring to save time in a fast paced development environment and trying to avoid code overwrite issues.
The easiest way to allow continuous parallel development and prevent a checkin from one person breaking the code of others, is to use a CI server. TFS supports this through Team Build.
Though it's preferred to run team build on a dedicated build server, it can be installed side-by-side on your main TFS server and it's possible to install the Controller component centrally and use your developer's workstations as agents.
There are two types of build triggers that can help you out here:
Continuous Integration - this triggers a build of all code directly after every checkin. It will tell you quickly that something did not compile. If you are doing unit tests it can even run these and tell you that a test is failing.
Gated - this will force a developer to shelve his code and will only check in the code when the build of the latest version plus the changes in the shelveset succeed. This may seem even better, as the code in source control will never be in a broken state, but in reality I prefer the ci trigger. The main reason for that us that Gated builds can't happen in parallel (due to their nature) and can actually delay the notification that the code is broken.
You can easily configure email alerts through webaccess on specific build outcomes. You can also configure alerts on source changes, but there is no option to only warn people who have edited these specific files before.
You can also run the Build Notification tool from the task tray to show a notification in Windows.
Though this will not tell the person whose code has just been overwritten that it's no longer working, it will tell the person I rewriting that code that he should pay more attention when checking in ;).
Of course you can configure a team alert that notifies everyone when the build breaks (as that's generally called), and there are funny ways to show the build status through small apps like "siren of shame", which provides a build monitor service that can be connected to a USB alarm-light that turns on and provides noise whenever someone does something stupid.
If you need to avoid this problem during check-in & merge, then I would recommend disabling multiple check-out. This allows file to only be checked out one-at-a-time and can prevent confusion on team projects.
If you need to do farther down the line, you can create TFS Alerts when any code is checked in and sent out to a distribution list, but it would not notify when specific contributions from a specific developer is altered - only a list of altered files during the check-in.

problems with continuous integration in xcode 5

I am just learning how to setup my continuous integration bots in xcode 5 and having a really bad time. First, I was having problems with code signing identities, but after reading this great blog post, that problem disappeared.
Post:
http://matt.vlasach.com/xcode-bots-hosted-git-repositories-and-automated-testflight-builds/#comment-21
Now, after fixing those errors, other errors appeared. Every time I integrate, I get a warning like this:
The file "Pods.xcconfig" couldn't be opened because there is no such file.
And I also get an error, saying a header for a pod is not found. I assume this error is a consequence of the previous warning.
Everything works perfect locally, running on devices, archiving, the problem only happens when i try to integrate with the bots.
Should I add something to the PodFile? or is it something on the osx server itself?
I really need help before I go crazy about this!!
Thank you.
Better solution is to add a new scheme, which is used only via server (duplicate your normal scheme). Then select option manage schemes, expand 'build' and add new Pre-action with following code:
cd ${SRCROOT}
echo "Installing Pods"
pod install
You can update and many other things over here. The only problem is that the build where it updates has old content, you have to once again tap integrate. Remember to keep this scheme shared.
--edit--
You ofc have to commit this and run bot on this scheme (you can change it in your server -> safari local xcode bot url -> settings -> scheme.
You are receiving this error because your mac server doesn't have the pods created in the directory that the Xcode bot is checking them out into. This is as expected because it would be odd to check-in the results of the pod install into your source control system. I wasn't able to find a way for the BOT to run the pod install/update commands so I came up with the following workaround:
Ensure your bot is configured to NOT clean before each integration
Run your bot then search through the resulting logs for the path that files are being checked out to.
Search for "IDEDerivedDataPathOverride" That path will end in /DerivedData, if you look in the parent folder of that you will see a "source" folder. This is where your bot will continue to checkout updates for your project
Note: The source directory is owned by your server user, you will need to access it as that user. Use the su command to do so
Install cocoapods on your mac server if you haven't already
On the mac server, in the source directory found above, navigate to where your Podfile is located
Run pod install and ensure all your specified pods are installed
Double check the file permissions of the newly created pod directories and ensure they are owned by the same user as the other files. Use chown to fix if necessary
Fire off the Bot and watch it complete successfully!
The only issue with this solution is that if a clean is ever performed you will need to run pod install again. This was good enough for tonight, I'll have to look for a way to script the pod install later utilizing the Pre-actions in the Build section of the Scheme used in the bot definition.

Recommend method to update codes and install newer version of the script

The developer of the script often updates the scripts and releases newer versions.
For instance, If am currently using the version 2.0, i'd create changes within the script to suit my requirements. However, if there is a new version released with new features, I would want to have the newer features while maintaining the changes I did manually.
If i simply update and replace, my changes would be gone. So I need a few tips that would enable to me to update to the newer version of the script effectively.
Its a heavy script based on Magento with many files.
Sorry to answer with such a simple solution, but have you looked into using Git (github.com) to help manage code updates and revisions? I use it successfully in a windows / linux development environment for a magento / wcf-workflow / asp.net / windows service combined solution for over 3 years now. I have history back until the first bit of code that was written.
We all have our own origin repository forked from the upstream, and it also allows one person to be in charge of code merges via the merge request option.
It also has the ability to be configured to automatically push to a server if you push to a specific branch.
You might look into it. It has been an extreme benefit to our small team of 5 people.

Can Xcode run straight from source control without install

I am managing a build lab and have several products/branches to provide service to and I would like my build machines not to be specialized to any one product/branch.
The scenario I would like to have is that souce and all tools needed to build it are checked into source control and just sync and build with some prep/env setup before hand via script.
This is very doable with Visual Studio and many other tools. Is it possible with Xcode? Has anyone gotten a scenario like this to work?
Some system components may need to be shared. Since this is such an atypical scenario, documentation will not be readily available. I would suggest asking on the Xcode-users mailing list that Apple maintains, as you may get a more certain answer.
I doubt if this possible. There are 2 possible ways I know of.
First, which we also follow in our project:
Source code for all projects in checked in the common repository.
A remote server is configured to point to this repository.
Remote server has XCode pre-installed. A pre-written scripts with steps including workspace cleanup, checkout fresh code, build the code, package the output is already feed into the remote server. Of these XCode related commands are using xcodebuild.
Remote server can be configured in 3 ways: a) Build the source code on every checkin, b) Build the source code triggered by user, c) Scheduled building of the source code.
Build results are emailed to the configured email addresses.
Second way is the continuous integration with MAC OS X server.
Just in case you found out the exact system config you are looking for, please post an answer here to enlighten us as well.

Overwriting an iPhone app from a different Xcode Project

One of the apps I've developed is submitted and approved to the appstore.
Because of some big changes and a more generic code I created a new XCode project for this app.
The problem is when trying to install the same app (based on bundle identifier) from the new XCode project, it quits with a crash. If I try to install again (Build & Run/Debug) from XCode, it seems to successfully overwrite and run. So it seems the first time there are some merge / overwrite conflicts. A second install, over the failed first attempt makes it work.
I wouldn't want this to happen with app updates downloaded from the store.
I've read that the idea is not to build from XCode, but use an Ad Hoc Build through iTunes instead. This would simulate a more natural end-user process. I've tried this, but somehow it won't sync / overwrite the existing app from the appstore (no errors, the app is just not changing).
Does someone have a hint on how to solve this?
Any help on this matter would be greatly appreciated!
I run into this problem all the time. I use one Developer Profile for all my dev work (and thus, one bundle identifier).
You have to delete the old App from the phone, and do a Clean Build.
These are similar problems. (1) (2)
As it seems working with an Ad Hoc build through iTunes does work.
Yesterday I double-clicked, but never got the iTunes message warning me of an older version existing in my apps and whether I want to replace it.
Dragging the .IPA into the iTunes app section did give me this message. Telling it to replace and next syncing works okay. iTunes sync status bar displays the message "YourAppName Updating". Afterwards launching it works fine with stored data intact.
The flow described here worked for me:
How to test an iPhone application update

Resources