I would like to automate integration tests of our OS X installer. The installer requires administrator authentication. Right now, we do manual testing (fire up a clean VM, download the installer, run it and check the installed product), but I would like to automate at least the initial testing of the installer. We use Jenkins for our CI server.
The Jenkins build slave could call
sudo installer -pkg <my package> -target /
but the Jenkins build slave (rightly) appears to run the build job as an unprivileged user.
How can I (1) run the installer via Jenkins or (2) verify the installer contents and functionality without running it?
For that scenario, I added a ALL=NOPASSWD line in my sudoers file that allows the jenkins user to run /usr/sbin/installer without providing a password.
In this example the username is 'qa' - the steps were:
sudo visudo
Add the /usr/sbin/installer line (replacing "qa" with your jenkins user)
qa ALL=NOPASSWD: /usr/sbin/installer
After that, assuming jenkins is running as that user, it should be able to run the installer program without a password.