Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

continuous integration needs sudo: xcode-select, bamboo, and multiple Xcode's

Having now pushed as many terms into the subject line:

We have a build machine (Mac) that is a bamboo agent. Due to the need to be able to build older versions of the app we have several different installs of Xcode on the machine.

To automate this we need to be able to issue xcode-select for the build machine. This command however requires Sudo; which I haven't found an acceptable solution to for CI. (All I've come up with is clear texting the sudo password in a SUDO_ASKPASS env passed or leaving the sudo/build passwd blank.)

This is being done through bamboo, so I'd prefer not to have to reinvent the wheel as well.

like image 279
Dru Freeman Avatar asked Dec 07 '25 13:12

Dru Freeman


1 Answers

Instead of using SUDO_ASKPASS you can simply edit your sudoers file (with visudo) and add the line:

%admin  ALL=NOPASSWD: /usr/bin/xcode-select

This will prevent the system from asking the password for sudo code-select when you are an admin on the machine.

like image 151
KPM Avatar answered Dec 10 '25 13:12

KPM