2012-01-01 21 views
3

免責事項:私の人生ではPHPを使用しませんでした。 UnixとJenkins初心者ストリームを開くことに失敗しました:Jenkinsジョブの許可が拒否されました。

私はUbantuシステムにJenkinsをセットアップしました。 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 

私がいることを理解し、私は次のようなコマンドから実行するとき すべてがうまくいきますこれは私がJenkinsからphp unit testを実行しようとしているときに許可の問題です(これはコマンドのようにうまくいきます)。私は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.orgSetting up Jenkins for PHP Projects

+0

は、私が実際にそれを設定するためにあなたのポストを踏襲するもの、と思います。 jenkins:jenkinsの後にオペランドがありません – Tarun

+0

そして、私はこの例外を/ var/lib/jenkins/jobs/yourjob /と/ home /の両方で取得しています。 tarunb/Documents/Tarun/mydemo/ – Tarun

+1

'.'で現在のディレクトリとその中のすべてのファイルを試してください:' sudo chown -R jenkins:jenkins .' –

関連する問題