My jenkins server is running on macOS Monterey, I believe this is important because my older server on macOS Catalina has no such issue.
I have some files on an external drive which I can access and use via the terminal without any issues but when I attempt to access them via the jenkins shell I get an "Operation not permitted" error.
In this test job I can list the volumes but cannot list the contents of /Volumes/TOSHIBA
This is my Jenkins job output showing "Operation not permitted" in response to an ls command on a remote volume:
Started by user admin
Running as SYSTEM
Building in workspace /Users/jenkins/.jenkins/workspace/TEST
[TEST] $ /bin/sh -xe /var/folders/8s/cg63pnc957vd9w0njmncpymw0000gp/T/jenkins11405831661869547820.sh
+ ls /Volumes
Macintosh HD
TOSHIBA
+ ls /Volumes/TOSHIBA
ls: /Volumes/TOSHIBA: Operation not permitted
Build step 'Execute shell' marked build as failure
Finished: FAILURE
What I've tried so far:
Running job as jenkins user with "sudo su jenkins"
Using a symbolic link to sneak into the external drive directory from a local path
Changing the jenkins default shell from sh to zsh
Adding full disk access in the mac "Security & Privacy" settings to: java, jshell, jenkins, and jenkins-cli.
Still "Operation not permitted" in every case
ls
. Now, my “off the top of the head” guess is this is a permissions issue. Try running the command prepended withsudo
. (Notsudo su
as it’s redundant) – Allan Mar 17 '23 at 13:58+ sudo ls /Volumes/TOSHIBA ls: /Volumes/TOSHIBA: Operation not permitted
– monoceros Mar 17 '23 at 15:12ls
that mount point? – Allan Mar 17 '23 at 15:32ls
the mount point in a terminal without any issues with the server running or not. And yes I think that question might be related, however I've tried giving jenkins full-disk access and it still can't see my external drive. I'm looking into if there is another tool being used that will also need full-disk access granted – monoceros Mar 17 '23 at 16:59