3
聲明:從未在我的生活中使用PHP。 Unix和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
我明白這是當我試圖從詹金斯執行php單元測試時的權限問題(從命令行得很好)。我開始詹金斯作爲sudo用戶
sudo /etc/init.d/jenkins start
但無濟於事。我錯過了一些明顯的事情嗎?
你猜怎麼着,我的確是跟着你的崗位設置。當我試着 - sudo chown -R jenkins:jenkins我得到了異常 - chown:在'jenkins:jenkins' – Tarun 2012-01-01 14:44:57
之後缺少操作數,並且我在這兩個目錄中都得到了這個例外 -/var/lib/jenkins/jobs/yourjob /和/ home/tarunb/Documents/Tarun/mydemo/ – Tarun 2012-01-01 14:52:03
嘗試用'.'表示當前目錄及其內的所有文件:'sudo chown -R jenkins:jenkins .' – 2012-01-01 17:46:07