0

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

Alex
  • 9,600
  • What does ls show in a plain terminal. (I would quote the exact command but I can't copy it from an image) – mmmmmm Mar 17 '23 at 13:46
  • It appears that you’re opening a new Bourne (not Badh) shell and then running ls. Now, my “off the top of the head” guess is this is a permissions issue. Try running the command prepended with sudo. (Not sudo su as it’s redundant) – Allan Mar 17 '23 at 13:58
  • Same error: + sudo ls /Volumes/TOSHIBA ls: /Volumes/TOSHIBA: Operation not permitted – monoceros Mar 17 '23 at 15:12
  • If you stop the Jenkins server, can you ls that mount point? – Allan Mar 17 '23 at 15:32
  • Also, is this question related to this? – Allan Mar 17 '23 at 15:50
  • I can ls 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

0 Answers0