A good utility to build yours IOS apps, this plugin create MacOs agents for yours builds.
It can stock your Keychains file on Jenkins and send it to the MacOs Nodes.
- Allow to configure a Mac as Jenkins slave
- Run multiples builds on a single Mac
- Isolates each construction from each other
- Run builds on a cloud of Macs
- Configure environment variables
- Stock keychain file as credentials on Jenkins
- Inject keychain on Node filesystem
- Clean all files created after each build
This plugin has been tested against macOS 10.14 Mojave and macOS 10.15 Catalina , although theoretically it should work with older version as long as it supports sysadminctl command.
Restart MacOs after configuration change
Enable SSH for all users
Go to System Preferences -> Sharing, and enable Remote Login for All users :
In /etc/ssh/sshd_config file, uncomment and update values of parameters MaxAuthTries, MaxSessions, ClientAliveInterval and ClientAliveCountMax to your need.
example of configuration for 10 Jenkins and 1 Mac with 10 users allowed :
- MaxAuthTries 10
- MaxSessions 100
- ClientAliveInterval 30
- ClientAliveCountMax 150
For more informations about sshd_config consult the Official Documentation
Configure a Jenkins User
Create an user on the Mac with administrator privileges. It will be your connection user for Mac Plugin Global configuration.
Add sudo NOPASSWD to this user in /etc/sudoers : see how to configure sudo without password
To maximize security, you can configure it only for "chmod" and "sysadminctl" command used by the plugin :
[USERNAME] ALL = NOPASSWD: /usr/sbin/sysadminctl -addUser mac-?????????? -password ??????????, /usr/sbin/sysadminctl -deleteUser mac-??????????, /bin/chmod -R 700 /Users/mac-??????????/
In jenkins global configuration, add a new Mac Cloud :
Configure fields of Mac Cloud :
Select JNLP for the connector and refer your Jenkins URL. This URL must be accessible by outside, localhost is not working.
Add a new Mac Host and fill the properties in the fields :
The number of simultaneous builds on the same Mac Host depends of the property "Max users". More you have Mac Hosts configured, more you can build simultaneous on many machines. The plugin was tested with a limit of 7 users per Mac hosts.
The supported credentials for now is User and Password. Put an account of your mac with sudo NOPASSWORD configured (see Configure a Jenkins User).
Refer the label of your agent. Select JNLP for the connector and refer your Jenkins URL. This URL must be accessible by outside, localhost is not working.
In a project configuration, refers the label :
Since v1.1.0, you have the possibility to stock keychain files into Jenkins to inject it in the Jenkins Mac agent. For this, check "Upload a keychain file" :
Add a new Secret file credentials. Prefers to store it as System Credentials to not allow any project to use it directly :
The Keychain will be send to the Mac agent with SCP in ~/Library/Keychains/ directory before the JNLP connection.
Since 1.1.0, you can set environment variables on Mac host. Theses variables will be set on the Node and will be accessible in the build.
You can define a custom LOGGER to log every output of the plugin on the same place. To do it, go to System logs in the Jenkins configuration :
Configure the Logger of the plugin :
Save your configuration.
After configuration, when you run a job with a Mac Cloud label, it will create a jenkins agent on the mac you setted as host and run the build on it.
You can see it on the home page of Jenkins :