2012-01-01 7 views
3

면책 사항 : 평생 동안 PHP를 사용하지 마십시오. 유닉스와 젠킨스 입문자스트림을 열지 못했습니다 : Jenkins job에서 권한이 거부되었습니다.

나는 Ubantu 시스템에 젠킨스를 설치했다. PHPUnit - 3.6.5 및 PHP 5.3.3

간단한 단위 테스트를 실행하는 빌드 파일이 있습니다.

ant phpunit 

하지만 동일한 젠킨스 작업에서 실행하기위한 작업을 설정할 때, 나는 예외가 발생 - -

phpunit: 
    [exec] PHPUnit 3.6.5 by Sebastian Bergmann. 
    [exec] 
    [exec] Configuration read from /home/tarunb/Documents/Tarun/mydemo/phpunit.xml.dist 
    [exec] 
    [exec] PHP Warning: fopen(/home/tarunb/Documents/Tarun/mydemo/build/logs/junit.xml): failed to open stream: Permission denied in /usr/share/php/PHPUnit/Util/Printer.php on line 106 
    [exec] PHP Stack trace: 
    [exec] PHP 1. {main}() /usr/bin/phpunit:0 
    [exec] PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:44 
    [exec] PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:125 
    [exec] PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:187 
    [exec] PHP 5. PHPUnit_Util_Log_JUnit->__construct() /usr/share/php/PHPUnit/TextUI/TestRunner.php:299 
    [exec] PHP 6. PHPUnit_Util_Printer->__construct() /usr/share/php/PHPUnit/Util/Log/JUnit.php:141 
    [exec] PHP 7. fopen() /usr/share/php/PHPUnit/Util/Printer.php:106 
    [exec] .<?xml version="1.0" encoding="UTF-8"?> 
    [exec] <testsuites> 
    [exec] <testsuite name="php-demo" tests="1" assertions="1" failures="0" errors="0" time="0.008163"> 
    [exec]  <testsuite name="MyClassTest" file="/home/tarunb/Documents/Tarun/mydemo/tests/MyClassTest.php" tests="1" assertions="1" failures="0" errors="0" time="0.008163"> 
    [exec]  <testcase name="testDemo" class="MyClassTest" file="/home/tarunb/Documents/Tarun/mydemo/tests/MyClassTest.php" line="7" assertions="1" time="0.008163"/> 
    [exec]  </testsuite> 
    [exec] </testsuite> 
    [exec] </testsuites> 
    [exec] 
    [exec] 
    [exec] Time: 0 seconds, Memory: 4.50Mb 
    [exec] 
    [exec] OK (1 test, 1 assertion) 
    [exec] 
    [exec] Writing code coverage data to XML file, this may take a moment.PHP Warning: DOMDocument::save(/home/tarunb/Documents/Tarun/mydemo/build/logs/clover.xml): failed to open stream: Permission denied in /usr/share/php/PHP/CodeCoverage/Report/Clover.php on line 348 
    [exec] PHP Stack trace: 
    [exec] PHP 1. {main}() /usr/bin/phpunit:0 
    [exec] PHP 
    [exec] 
    [exec] Generating code coverage report, this may take a moment. 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:44 
    [exec] PHP 3. PHPUnit_TextUI_Command->run() /usr/share/php/PHPUnit/TextUI/Command.php:125 
    [exec] PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:187 
    [exec] PHP 5. PHP_CodeCoverage_Report_Clover->process() /usr/share/php/PHPUnit/TextUI/TestRunner.php:352 
    [exec] PHP 6. DOMDocument->save() /usr/share/php/PHP/CodeCoverage/Report/Clover.php:348 
    [exec] PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Could not write to /home/tarunb/Documents/Tarun/mydemo/build/coverage/index.dashboard.html.' in /usr/share/php/Text/Template.php:150 

내가 이해 내가 같은 명령에서 그것을 실행할 때 모든 잘 간다 젠킨스 (내가 좋아하는 명령에서 잘 작동)에서 PHP 단위 테스트를 실행하려고 할 때이 권한 문제입니다. 나는 sudo 사용자로 Jenkins를 시작했다.

sudo /etc/init.d/jenkins start 

그러나 유용하지 않다. 나는 분명히 어떤 것을 놓치고 있습니까?

답변

3

젠킨스는 기본 모드에서 악마를 시작하는 방법과 상관없이 모든 실행에 대해 jenkins 사용자로 전환합니다.

폴더에 sudo chown -R jenkins .을 사용해보십시오.

시스템 전체 설치의 경우 /var/lib/jenkins/jobs/yourjob/ 일 수 있지만 귀하의 측면에서는 /home/tarunb/Documents/Tarun/mydemo/ 인 것으로 보입니다. PHP 프로젝트 젠킨스를 실행하는 방법에 대한 자세한 내용은

체크 아웃 : jenkins-php.org

+0

Setting up Jenkins for PHP Projects 내가 실제로 그것을 설정하는 게시물을 따라 무엇을 생각한다. sudo chown -R jenkins : jenkins 나는 jenkins : jenkins ' – Tarun

+0

뒤에 피연산자가 누락되어 예외가 발생합니다.이 예외는/var/lib/jenkins/jobs/yourjob/및/home/tarunb/Documents/Tarun/mydemo/ – Tarun

+1

현재 디렉토리와 그 안에있는 모든 파일을 의미하는'.' 기호로 시도하십시오 :'sudo chown -R jenkins : jenkins .' –

관련 문제