Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to allow Jenkins to use usr/bin/security?

I'm building an iPhone app with Jenkins so at some point it needs to use /usr/bin/security. Unfortunately Jenkins can't find that command.

Here's the console log excerpt:

[workspace] $ /usr/bin/security find-identity -p codesigning -v FATAL: Cannot run program "/usr/bin/security" (in directory "/Users/jenkins/.jenkins/jobs/Obfuscated iOS/workspace"): error=2, No such file or directory java.io.IOException: Cannot run program "/usr/bin/security" (in directory "/Users/jenkins/.jenkins/jobs/Obfuscated iOS/workspace"): error=2, No such file or directory

Something like this typically means there is a permissions issue, so I have tried sudo chmod 777 /usr/bin/security but the build yields the same result.

Furthermore, when I try /usr/bin/security find-identity -p codesigning -v from terminal it works just fine.

How do I get Jenkins to be able to use this tool and any other iOS tools it might need?

More info:

The odd part is that other iOS related tools like /usr/bin/xcodebuild and /usr/bin/agvtool work fine as seen below:

[workspace] $ /usr/bin/xcodebuild -version Xcode 6.4 Build version 6E35b Fetching marketing version number (CFBundleShortVersionString) from project. [workspace] $ /usr/bin/agvtool mvers -terse1 Found marketing version (CFBundleShortVersionString): 4.0.0. Marketing version (CFBundleShortVersionString) found in project configuration: 4.0.0. Fetching technical version number (CFBundleVersion) from project. [workspace] $ /usr/bin/agvtool vers -terse

More on permissions:

ls -le yields

-rwxr-xr-x  1 root   wheel    224032 Aug  1 20:43 security

This looks normal to me when compared to other tools in the same directory like xcodebuild.

Jenkins PATH

I checked the Jenkins System Configuration page and it lists this for PATH:
/usr/bin:/bin:/usr/sbin:/sbin

Running in a build step works!

If I create a new job with only a build step with the command, /usr/bin/security find-identity -p codesigning -v, then it runs fine.

This suggests that internally the command is being run by another process.

like image 727
kraftydevil Avatar asked Nov 02 '15 17:11

kraftydevil


1 Answers

The problem was occurring because of the value used in "Build output directory":

enter image description here

Removing ${WORKSPACE} resolved the issue with calling /usr/bin/security.

like image 98
kraftydevil Avatar answered Sep 28 '22 06:09

kraftydevil