Gitlab CD for iOS on server - ios

I'm trying to create Continuous Deployment pipeline for an iOS project with Gitlab tools.
It's suggested to use own mac in order to run tests and Archive in this tutorial.
So, there, probably, should be a way to create runner on a server, not on own machine, right? Because otherwise the owner of the Apple distribution signature would be the onlyone who can trigger deployment process.

Related

Build ios .ipa using jenkins and fastlane (host ubuntu)

any idea if it is possible to generate .ipa (ios app ) with jenkins installed on ubuntu machine.
If it is a NO (and i think its)
any other solution guys
i saw travis but it doesn't support bitbucket
I tried circleCi but you need to pay if you want a suuport for ios
so the only solution i find it is to use the distributed arch of jenkins , that means :
I will install a Jenkins master on my Ubuntu machine and another slave node on a mac machine and give it the access so i can build my own ipa every time there is triggers on my repo.

Continuous integration/deployment iOS Android app

We have developed Xamarin.iOS and Xamarin.Android app using Visual studio.
and we want a way to automate deployment as we have repository on bitbucket
On search we found there are Jenkins, and MacinCloud, Bitrise.
What will be best option to execute following process.
1. Get code from repository .
2. Build ipa,apk for both android and iOS platform.
3. Deploy to Appstore/Testflight.
Do any of above provide facility to configure and deploy app for multiple environment(DEV/ST/PROD).
Thanks
To address your goals 1-by-1:
Get code from repository
You will want a CI/CD tool: Jenkins, Azure Pipelines, Bamboo will help you automate the build process. The first step in most of these tools will be to grab the source code from the repository.
Build ipa,apk for both android and iOS platform
You will need a Mac computer for the .ipa. There is no easy way around this requirement as you need XCode and an Apple developer account in order to build the signed .ipa for iOS deployments. The android apk can be built on pretty much any platform though. Because you will need a Mac, you may end up having to setup a remote agent for your CI/CD service in order to build on that machine.
Deploy to Appstore/Testflight
You can either script this part, use a plugin with your CI/CD tool, or use a 3rd party entirely. Some popular 3rd party options are Microsoft's Appcenter (formally HockeyApp) or Fastlane.
Do any of above provide facility to configure and deploy app for multiple environment(DEV/ST/PROD)?
Yes. All of the CI/CD tools mentioned above support this. Additionally, the Google Play store supports different release tracks, and you can setup different deployment strategies with iOS depending on the tooling you end up selecting.

Uploading iOS .ipa file to testflight via Jenkins

I might be late to the CI/CD party but better late than never. So far, I am able to setup Jenkins on a separate MAC which does not contain XCode. I use this MAC as a 24x7 small server for minor operations. A lot of time was wasted for archiving and then uploading that build to testflight for my iOS apps so I thought of setting up a CI/CD process.
After the Jenkins setup, I am able to generate the .ipa file for specified target (release/debug).
Now I want to upload this .ipa file to Testflight. This is what I know already:
Via ALTool: As per this answer, I should use AlTool. AlTool is nothing but the Application Loader inside XCode. I don't want to install XCode on this separate MAC, so this is not what I can work with.
Via shell script: If you see the question of the answer in the above point, the user has mentioned a script. I have tried that as well and it fails.
Via Shenzen: This is deprecated. On the Github page itself, they have mentioned to use Fastlane.
Via Testflight plugin: This is also deprecated.
So basically, what I feel is Jenkins alone itself can not distribute iOS builds to testflight, unless we use ALTool which requires XCode to be installed. Is there a workaround to do it purely via Jenkins?
Yes, there is a better option, strongly recommend Fastlane.
You can check here and here is specifically for TestFlight
You need to have Fastlane on the Jenkins but it is execution is easy and fast.
Also as we discussed you can implement connection by yourself using AppStoreConnect API
Fastlane Pilot action is a better option.
You need to add Environment Variables in Jenkins
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD - This is application-specific password generated on https://appleid.apple.com. Pilot automatically fetches password for a transporter from environment variable named FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD
FASTLANE_PASSWORD This is apple developer account password
Add below command in shell script of Jenkins
fastlane pilot upload — ipa IPA_PATH
Reference link

Continuous Integration with hybrid mobile app

I have a problem. I need to build a job in my Jenkins server hosted by macmini (localhost) to automatic build a deploy for my mobile hybrid apps. That's apps was building with ionic2, and need a deploy for Android (apk) and for iOS (ipa).
But when i run a build from Jenkins, with this shell command
I get this error
that's not all... because i try to execute, from the jenkins folder, the npm i and the result was this:
When i try to build my application from other "folder" and not from jenkins, they works correctly. How i can solve?
Without more information hard to say; you can either just script the things you do when you deploy "manually", or you might want to try a CLI tool like https://www.bitrise.io/cli or https://fastlane.tools which can auto-scan your project and configure a suitable configuration which is then easier to tweak.
In case of Bitrise CLI the base config can be generated with bitrise init in the repo root, and you can also use a visual editor to modify your configuration: https://discuss.bitrise.io/t/how-to-experiment-with-bitrise-configs-locally-on-your-mac-linux/1751
After a lot of time, just find the solution. Jenkins have a own "tools management". So i need to install, into jenkins, a property version of nodeJS, Npm and all other tools i need to deploy the application.
So, first of all you need to install property plugin (in my case nodejs).
After this, going into Jenkins Management System and configure a NodeJS version. That's all

Build iPhone Application on build server

Using the xcodebuild command it is fairly simple to build iPhone projects on a Mac based build server. However an issue I run into, when building a new project is that I need to install the provisioning profile on the machine.
I think it is not a very good practise to check in the provisioning profile along with the code (Is that right?). So how do I make sure that at build time the provisioning profiles are available via some sort of automated mechanism.
You could check the certificates and the private key into your source code control system assuming that they aren't publicly available.
Other than that there are two options, either use an automated system builder type tool, such as Chef or roll your own shell script to set up build machines.
You could create a Chef recipe that builds a new Jenkins based CI server, downloads the provisioning profile (and the private key) from an internal server and installs it into the Jenkins user's Library/MobileDevices/Provisioning Profiles directory (and login.keychain) on the new CI server.
You could also automate this part of the setup of the server using a shell script:
curl -O http://your_server/ABCD.mobileprovision
cp ABCD.mobileprovision ~/Library/MobileDevices/Provisioning\ Profiles
curl -O http://your_server/DeveloperCerts.p12
security import DeveloperCerts.p12 -P this_is_your_password -T codesign -T security

Resources