Jenkins cannot start xcodebuild from project folder

I am trying to set up a CI environment for an iOS application. So far, I got xcodebuild for building the test build correctly from the command line, but when Jenkins tries to execute it, I get the following reading in the console:

Started by user anonymous Building in workspace /Users/Shared/Jenkins/Home/jobs/Unit Tests/workspace Working directory is /Users/iosappdev/Documents/Xcode Projects/rules. [rules] $ /usr/bin/xcodebuild -version FATAL: Cannot run program "/usr/bin/xcodebuild" (in directory "/Users/iosappdev/Documents/Xcode Projects/rules"): error=13, Permission denied java.io.IOException: Cannot run program "/usr/bin/xcodebuild" (in directory "/Users/iosappdev/Documents/Xcode Projects/rules"): error=13, Permission denied at java.lang.ProcessBuilder.start(ProcessBuilder.java:460) at hudson.Proc$LocalProc.<init>(Proc.java:244) at hudson.Proc$LocalProc.<init>(Proc.java:216) at hudson.Launcher$LocalLauncher.launch(Launcher.java:707) at hudson.Launcher$ProcStarter.start(Launcher.java:338) at hudson.Launcher$ProcStarter.join(Launcher.java:345) at au.com.rayh.XCodeBuilder.perform(XCodeBuilder.java:224) 

Any thoughts? I'm new to Jenkins, but I did my best to answer this question using Google Fu. I initially ran into this problem with manually installing Jenkins (at home), but recently used the OSX installer, and this led to the same error.

I assume this has more to do with Unix / Linux / OSX permissions than Jenkins / Xcode, but not enough experience to determine this for sure.

Edit

Project directory permissions are set to 775.

I also tried changing the ownership of the Jenkins user.

Here's the output for when I tried to run xcodebuild as a daemon user ($ sudo -u daemon xcodebuild):

 dev-imac:rules iosappdev$ sudo -u daemon xcodebuild shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied 2012-03-21 11:05:46.161 xcodebuild[1411:70b] [MT] DVTAssertions: ASSERTION FAILURE in /SourceCache/IDEXcode3ProjectSupport/IDEXcode3ProjectSupport-1196/Xcode3Sources/XcodeIDE/Frameworks/DevToolsBase/pbxcore/Xcode3Model/Xcode3Project.m:266 Details: Assertion failed: [directoryPath isAbsolutePath] Object: <Xcode3Project> Method: +projectFilesInDirectory: Thread: <NSThread: 0x40010a260>{name = (null), num = 1} Hints: None Backtrace: 0 0x000000010025b85f -[DVTAssertionHandler handleFailureInMethod:object:fileName:lineNumber:messageFormat:arguments:] (in DVTFoundation) 1 0x000000010025b6b5 _DVTAssertionFailureHandler (in DVTFoundation) 2 0x00000001011559bc +[Xcode3Project projectFilesInDirectory:] (in DevToolsCore) 3 0x00000001008a424b -[Xcode3CommandLineBuildTool _resolveInputOptions] (in Xcode3Core) 4 0x00000001008aa097 -[Xcode3CommandLineBuildTool run] (in Xcode3Core) 5 0x00000001001d7db6 (in xcodebuild) 6 0x00000001001d7c2c (in xcodebuild) 
+7
ios continuous-integration jenkins xcodebuild
source share
2 answers

Verify that the user Jenkins is using has the correct permissions. Go to http://[jenkins_server]/systemInfo and search for user.name .

+5
source share

Above it reads:

Building in workspace /Users/Shared/Jenkins/Home/jobs/Unit Tests/workspace Working directory is /Users/iosappdev/Documents/Xcode Projects/rules. [rules] $ /usr/bin/xcodebuild -version

Somehow, the job moved to the "wrong" directory. Maybe you set the task using a custom workspace? Jenkins probably works as a user daemon and therefore does not have access to files under iosappdev.

The usual way to use Jenkins is so that you can pass the source code to the version control repository. Jenkins jobs are then configured to check the code from the repository in the Jenkins workspace and its assembly, and then report the results.

I'm not sure what can be achieved by trying to get Jenkins to go directly to your working directory and build there. If this is really what you are trying to do, you should tell us why you think this is a good idea.

0
source share

All Articles