Bitbucket CI CD pipeline for iOS project
Asked by mohit Mishra:

I hav an iOS code in our bitbucket repo \& want to create a CICD pipline for it.

As we know for iOS build we need xcodebuild terminal commands to be executed to create the IPA file from our yaml script.

So in my yaml file i need to add the xcodebuild commands but to run them, there should be xcodebuild present in the server first, which only macos support.

So do i need to use Runner to create a macos setup and thn i can get a setup of macos where i can install \& execute my xcodebuild commands ?


Answers:
author: Theodora Boudale
body: Hi [@mohit Mishra](/t5/user/viewprofilepage/user-id/5059983) and welcome to the community!

Pipelines builds that run in our own infrastructure don't support MacOS builds, so you can use a MacOS Runner on a Mac of yours.

If you use a MacOS Runner, the builds do not run in Docker containers, but directly on the MacOS machine. So if you install the tools you need on that machine, they should be available when the commands of your bitbucket-pipelines.yml file are executed.

Please keep in mind the following (I am copying from our documentation):
> MacOS Runners use Bash to run pipeline steps on your MacOS machine (host device). This allows the runner to execute applications on the host, but does not provide a clean build environment for every step. Any side effects generated by the step (such as, installing any applications, starting a database service, or editing a file outside of the build directory) would potentially affect the next step to be run (including new pipeline runs). To compensate for this, the runner try to empty the build directory empty after each step. It is your responsibility to make sure the scripts you run in each step won't have a major impact on other steps.

You can find more info on MacOS runners here: <https://support.atlassian.com/bitbucket-cloud/docs/set-up-runners-for-macos/>

We also have a feature request to provide support for MacOS builds in Pipelines that run in our own infrastructure: <https://jira.atlassian.com/browse/BCLOUD-22154> If this is something you'd be interested in, you can add your vote and comment to the feature request.

If you have any questions, please feel free to let me know.

Kind regards,  
Theodora

comments: author: mohit Mishra
body: Thank you for the answer.

Actually i am having a Ubuntu machine \& my lead is having macos on which we r doing manual building process that we need to automate.

So in such case i am not sure what can be the solution,

may be i need to have a ec2 server on AWS where i will hav a macos OS on it and will have to connect my runner to it and run xcodebuild commands from my yaml file to the server to get IPA ?

Is there any other way around!!


author: Theodora Boudale
body: Hi [@mohit Mishra](/t5/user/viewprofilepage/user-id/5059983),

You are very welcome!

If it's not possible to use your lead's MacOS for that purpose, then you can look into macOS in a Cloud instance from a provider that offers that, and set up your Pipelines Runner there.

I'm not aware of any other way to work around this.

Kind regards,  
Theodora


author: Michael Hohlfeld
body: Maybe the new **XCode Cloud** can help ...

<https://developer.apple.com/xcode-cloud/>

<https://developer.apple.com/documentation/Xcode/About-Continuous-Integration-and-Delivery-with-Xcode-Cloud>


Tags: bitbucket-cloud

cloud

continuous-delivery

ios