So I have a cluster of OSX boxes which I control via Jenkins. I wanted to automate the system updates via a Jenkins job.
The process it must follow:
1) Run system Update
2) Reboot system
3) Login
So how I did it:
1) Enable cmuser to execute softwareupdate & shutdown without providing password:
cmosx01:~ cmuser$ sudo visudo .... cmuser ALL=(ALL) NOPASSWD: /usr/bin/softwareupdate cmuser ALL=(ALL) NOPASSWD: /sbin/shutdown ...
2) Go into each box & configure cmuser to automatically log in
System Preferences
Users & Groups
Unlock so you can make changes
Login Options
Automatic login: cmuser
3) Create wulti-configuration project in Jenkins & configure it to point to all your boxes.
This project has 2 build steps (Execute Shell):
sudo /usr/sbin/softwareupdate -i -a sudo /sbin/shutdown -r now