Jenkins构建在Web界面上失败但在ant上运行

时间:2015-05-19 14:08:33

标签: ant jenkins

这是我从Web界面构建时获得的输出,但是当我从CLI执行此操作时它是成功的。可能是什么问题呢?为什么詹金斯找不到它?我可以毫无问题地运行命令

    Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/Symphony2/workspace
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
 > git config remote.origin.url git@github.com:heroleads/deployment.git # timeout=10
Fetching upstream changes from git@github.com:heroleads/deployment.git
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git -c core.askpass=true fetch --tags --progress git@github.com:heroleads/deployment.git +refs/heads/*:refs/remotes/origin/*
 > git rev-parse refs/remotes/origin/alpha^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/alpha^{commit} # timeout=10
Checking out Revision 39912e9529d983b6e9342caf42f898e17e2820a4 (refs/remotes/origin/alpha)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 39912e9529d983b6e9342caf42f898e17e2820a4
 > git rev-list bcf31ba311d5d412ef2f268a72fdddf884318f5e # timeout=10
[workspace] $ ant
Buildfile: /var/lib/jenkins/jobs/Symphony2/workspace/build.xml

clean:
   [delete] Deleting directory /var/lib/jenkins/jobs/Symphony2/workspace/app/build/api
   [delete] Deleting directory /var/lib/jenkins/jobs/Symphony2/workspace/app/build/code-browser
   [delete] Deleting directory /var/lib/jenkins/jobs/Symphony2/workspace/app/build/coverage
   [delete] Deleting directory /var/lib/jenkins/jobs/Symphony2/workspace/app/build/logs
   [delete] Deleting directory /var/lib/jenkins/jobs/Symphony2/workspace/app/build/pdepend

prepare:
    [mkdir] Created dir: /var/lib/jenkins/jobs/Symphony2/workspace/app/build/api
    [mkdir] Created dir: /var/lib/jenkins/jobs/Symphony2/workspace/app/build/code-browser
    [mkdir] Created dir: /var/lib/jenkins/jobs/Symphony2/workspace/app/build/coverage
    [mkdir] Created dir: /var/lib/jenkins/jobs/Symphony2/workspace/app/build/logs
    [mkdir] Created dir: /var/lib/jenkins/jobs/Symphony2/workspace/app/build/pdepend

vendors:
     [exec] Loading composer repositories with package information
     [exec] Updating dependencies (including require-dev)
     [exec] Nothing to install or update
     [exec] Writing lock file
     [exec] Generating autoload files
     [exec] Updating the "app/config/parameters.yml" file
     [exec] Clearing the cache for the dev environment with debug true
     [exec] Trying to install assets as symbolic links.
     [exec] Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
     [exec] The assets were installed using symbolic links.
     [exec] Installing assets for Genemu\Bundle\FormBundle into web/bundles/genemuform
     [exec] The assets were installed using symbolic links.
     [exec] Installing assets for AppBundle into web/bundles/app
     [exec] The assets were installed using symbolic links.
     [exec] Installing assets for Acme\DemoBundle into web/bundles/acmedemo
     [exec] The assets were installed using symbolic links.
     [exec] Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
     [exec] The assets were installed using symbolic links.

parameters:

lint:

phploc:
     [exec] phploc 2.1.1 by Sebastian Bergmann.
     [exec] 
     [exec] Directories                                         24
     [exec] Files                                               39
     [exec] 
     [exec] Size
     [exec]   Lines of Code (LOC)                             2954
     [exec]   Comment Lines of Code (CLOC)                    1027 (34.77%)
     [exec]   Non-Comment Lines of Code (NCLOC)               1927 (65.23%)
     [exec]   Logical Lines of Code (LLOC)                     521 (17.64%)
     [exec]     Classes                                        336 (64.49%)
     [exec]       Average Class Length                          14
     [exec]         Minimum Class Length                         0
     [exec]         Maximum Class Length                        84
     [exec]       Average Method Length                          2
     [exec]         Minimum Method Length                        0
     [exec]         Maximum Method Length                       24
     [exec]     Functions                                       42 (8.06%)
     [exec]       Average Function Length                        2
     [exec]     Not in classes or functions                    143 (27.45%)
     [exec] 
     [exec] Cyclomatic Complexity
     [exec]   Average Complexity per LLOC                     0.12
     [exec]   Average Complexity per Class                    2.96
     [exec]     Minimum Class Complexity                      1.00
     [exec]     Maximum Class Complexity                     28.00
     [exec]   Average Complexity per Method                   1.37
     [exec]     Minimum Method Complexity                     1.00
     [exec]     Maximum Method Complexity                    12.00
     [exec] 
     [exec] Dependencies
     [exec]   Global Accesses                                   33
     [exec]     Global Constants                                 0 (0.00%)
     [exec]     Global Variables                                 0 (0.00%)
     [exec]     Super-Global Variables                          33 (100.00%)
     [exec]   Attribute Accesses                                95
     [exec]     Non-Static                                      95 (100.00%)
     [exec]     Static                                           0 (0.00%)
     [exec]   Method Calls                                     131
     [exec]     Non-Static                                     102 (77.86%)
     [exec]     Static                                          29 (22.14%)
     [exec] 
     [exec] Structure
     [exec]   Namespaces                                        15
     [exec]   Interfaces                                         0
     [exec]   Traits                                             0
     [exec]   Classes                                           23
     [exec]     Abstract Classes                                 0 (0.00%)
     [exec]     Concrete Classes                                23 (100.00%)
     [exec]   Methods                                          122
     [exec]     Scope
     [exec]       Non-Static Methods                           111 (90.98%)
     [exec]       Static Methods                                11 (9.02%)
     [exec]     Visibility
     [exec]       Public Methods                               118 (96.72%)
     [exec]       Non-Public Methods                             4 (3.28%)
     [exec]   Functions                                         16
     [exec]     Named Functions                                  2 (12.50%)
     [exec]     Anonymous Functions                             14 (87.50%)
     [exec]   Constants                                          1
     [exec]     Global Constants                                 0 (0.00%)
     [exec]     Class Constants                                  1 (100.00%)

pdepend:
     [exec] PHP_Depend 1.1.4 by Manuel Pichler
     [exec] 
     [exec] Parsing source files:
     [exec] .......................................                         39
     [exec] 
     [exec] Executing Coupling-Analyzer:
     [exec] ...........                                                    233
     [exec] 
     [exec] Executing CyclomaticComplexity-Analyzer:
     [exec] ...........                                                    235
     [exec] 
     [exec] Executing Dependency-Analyzer:
     [exec] ........                                                       162
     [exec] 
     [exec] Executing Inheritance-Analyzer:
     [exec] ..                                                              46
     [exec] 
     [exec] Executing NodeCount-Analyzer:
     [exec] ........                                                       163
     [exec] 
     [exec] Executing NodeLoc-Analyzer:
     [exec] .........                                                      187
     [exec] 
     [exec] Generating pdepend log files, this may take a moment.
     [exec] 
     [exec] Time: 00:00; Memory: 12.25Mb

phpmd-ci:

phpcs-ci:
     [exec] Result: 2

phpcpd:
     [exec] phpcpd 2.0.2 by Sebastian Bergmann.
     [exec] 
     [exec] Found 4 exact clones with 171 duplicated lines in 6 files:
     [exec] 
     [exec]   - /var/lib/jenkins/jobs/Symphony2/workspace/src/AppBundle/Resources/public/plugins/datatables/examples/server_side/scripts/ids-objects.php:42-80
     [exec]     /var/lib/jenkins/jobs/Symphony2/workspace/src/AppBundle/Resources/public/plugins/datatables/examples/server_side/scripts/objects.php:18-56
     [exec]  
     [exec]   - /var/lib/jenkins/jobs/Symphony2/workspace/src/AppBundle/Resources/public/plugins/datatables/examples/server_side/scripts/objects.php:8-56
     [exec]     /var/lib/jenkins/jobs/Symphony2/workspace/src/AppBundle/Resources/public/plugins/datatables/examples/server_side/scripts/post.php:22-70
     [exec]  
     [exec]   - /var/lib/jenkins/jobs/Symphony2/workspace/src/AppBundle/Resources/public/plugins/datatables/examples/server_side/scripts/jsonp.php:32-69
     [exec]     /var/lib/jenkins/jobs/Symphony2/workspace/src/AppBundle/Resources/public/plugins/datatables/examples/server_side/scripts/ids-arrays.php:42-79
     [exec]  
     [exec]   - /var/lib/jenkins/jobs/Symphony2/workspace/src/AppBundle/Resources/public/plugins/datatables/examples/server_side/scripts/jsonp.php:22-70
     [exec]     /var/lib/jenkins/jobs/Symphony2/workspace/src/AppBundle/Resources/public/plugins/datatables/examples/server_side/scripts/server_processing.php:22-70
     [exec]  
     [exec] 5.79% duplicated lines out of 2954 total lines of code.
     [exec] 
     [exec] Time: 409 ms, Memory: 4.75Mb
     [exec] Result: 1

phpdox:
     [exec] phpDox 0.7.0 - Copyright (C) 2010 - 2015 by Arne Blankerts
     [exec] 
     [exec] [19.05.2015 - 13:49:34] Using config file '/var/lib/jenkins/jobs/Symphony2/workspace/app/Resources/jenkins/phpdox.xml'
     [exec] [19.05.2015 - 13:49:34] Registered collector backend 'parser'
     [exec] [19.05.2015 - 13:49:34] Registered enricher 'build'
     [exec] [19.05.2015 - 13:49:34] Registered enricher 'git'
     [exec] [19.05.2015 - 13:49:34] Registered enricher 'checkstyle'
     [exec] [19.05.2015 - 13:49:34] Registered enricher 'phpcs'
     [exec] [19.05.2015 - 13:49:34] Registered enricher 'pmd'
     [exec] [19.05.2015 - 13:49:34] Registered enricher 'phpunit'
     [exec] [19.05.2015 - 13:49:34] Registered enricher 'phploc'
     [exec] [19.05.2015 - 13:49:34] Registered output engine 'xml'
     [exec] [19.05.2015 - 13:49:34] Registered output engine 'html'
     [exec] [19.05.2015 - 13:49:34] Starting to process project 'Symfony2 App'
     [exec] [19.05.2015 - 13:49:34] Configuration change detected - cleaning cache
     [exec] [19.05.2015 - 13:49:34] Starting collector
     [exec] [19.05.2015 - 13:49:34] Scanning directory './src' for files to process
     [exec] 
     [exec] .......................................             [39]
     [exec] 
     [exec] [19.05.2015 - 13:49:34] Saving results to directory 'app/build/phpdox'
     [exec] [19.05.2015 - 13:49:34] Resolving inheritance
     [exec] 
     [exec] .......................                             [23]
     [exec] 
     [exec] [19.05.2015 - 13:49:34] The following unit(s) had missing dependencies during inheritance resolution:
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\Form\RegistrationType (missing Symfony\Component\Form\AbstractType)
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\EventListener\UserRegistrationListener (missing Symfony\Component\EventDispatcher\EventSubscriberInterface)
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\AppBundle (missing Symfony\Component\HttpKernel\Bundle\Bundle)
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\Tests\Controller\DefaultControllerTest (missing Symfony\Bundle\FrameworkBundle\Test\WebTestCase)
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\Document\Asset (missing Solilokiam\SummernoteBundle\Model\SummernoteAsset)
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\Controller\DefaultController (missing Symfony\Bundle\FrameworkBundle\Controller\Controller)
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\Controller\TestController (missing Symfony\Bundle\FrameworkBundle\Controller\Controller)
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\Controller\WelcomeController (missing Symfony\Bundle\FrameworkBundle\Controller\Controller)
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\Entity\Account (missing FOS\UserBundle\Model\User)
     [exec] [19.05.2015 - 13:49:34]  - AppBundle\Entity\User (missing FOS\UserBundle\Model\User, HWI\Bundle\OAuthBundle\Connect\AccountConnectorInterface, HWI\Bundle\OAuthBundle\Security\Core\User\OAuthAwareUserProviderInterface)
     [exec] [19.05.2015 - 13:49:34]  - Acme\DemoBundle\Form\ContactType (missing Symfony\Component\Form\AbstractType)
     [exec] [19.05.2015 - 13:49:34]  - Acme\DemoBundle\AcmeDemoBundle (missing Symfony\Component\HttpKernel\Bundle\Bundle)
     [exec] [19.05.2015 - 13:49:34]  - Acme\DemoBundle\Command\HelloWorldCommand (missing Symfony\Component\Console\Command\Command)
     [exec] [19.05.2015 - 13:49:34]  - Acme\DemoBundle\Tests\Controller\DemoControllerTest (missing Symfony\Bundle\FrameworkBundle\Test\WebTestCase)
     [exec] [19.05.2015 - 13:49:34]  - Acme\DemoBundle\Twig\Extension\DemoExtension (missing Twig_Extension)
     [exec] [19.05.2015 - 13:49:34]  - Acme\DemoBundle\DependencyInjection\AcmeDemoExtension (missing Symfony\Component\HttpKernel\DependencyInjection\Extension)
     [exec] [19.05.2015 - 13:49:34]  - Acme\DemoBundle\Controller\SecuredController (missing Symfony\Bundle\FrameworkBundle\Controller\Controller)
     [exec] [19.05.2015 - 13:49:34]  - Acme\DemoBundle\Controller\WelcomeController (missing Symfony\Bundle\FrameworkBundle\Controller\Controller)
     [exec] [19.05.2015 - 13:49:34]  - Acme\DemoBundle\Controller\DemoController (missing Symfony\Bundle\FrameworkBundle\Controller\Controller)
     [exec] [19.05.2015 - 13:49:34] Collector process completed
     [exec] 
     [exec] [19.05.2015 - 13:49:34] Starting generator
     [exec] [19.05.2015 - 13:49:34] Loading enrichers
     [exec] [19.05.2015 - 13:49:34] Starting event loop.
     [exec] 
     [exec] ..................................................  [50]
     [exec] ..................................................  [100]
     [exec] ..................................................  [150]
     [exec] ..................................................  [200]
     [exec] ..................................................  [250]
     [exec] ..................................................  [300]
     [exec] ..................................................  [350]
     [exec] ..................................................  [400]
     [exec] ..........................                          [426]
     [exec] 
     [exec] [19.05.2015 - 13:49:35] Generator process completed
     [exec] [19.05.2015 - 13:49:35] Processing project 'Symfony2 App' completed.
     [exec] 
     [exec] 
     [exec] Time: 0 seconds, Memory: 9.00Mb
     [exec] 

phpunit:
     [exec] PHPUnit 4.6.6 by Sebastian Bergmann and contributors.
     [exec] 
     [exec] Configuration read from /var/lib/jenkins/jobs/Symphony2/workspace/app/build/phpunit.xml
     [exec] 
     [exec] 
     [exec] 
     [exec] Time: 128 ms, Memory: 14.75Mb
     [exec] 
     [exec] No tests executed!

phpcb:

BUILD FAILED
/var/lib/jenkins/jobs/Symphony2/workspace/build.xml:127: Execute failed: java.io.IOException: Cannot run program "phpcb": error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
    at java.lang.Runtime.exec(Runtime.java:617)
    at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Java13CommandLauncher.java:41)
    at org.apache.tools.ant.taskdefs.Execute.launch(Execute.java:428)
    at org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:442)
    at org.apache.tools.ant.taskdefs.ExecTask.runExecute(ExecTask.java:628)
    at org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:669)
    at org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:495)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.Main.runBuild(Main.java:851)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:186)
    at java.lang.ProcessImpl.start(ProcessImpl.java:130)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
    ... 23 more

Total time: 36 seconds
Build step 'Invoke Ant' marked build as failure
[WARNINGS] Parsing warnings in console log with parser YUI Compressor
[CHECKSTYLE] Collecting checkstyle analysis files...
[CHECKSTYLE] Finding all files that match the pattern build/logs/checkstyle.xml
[PMD] Collecting PMD analysis files...
[PMD] Finding all files that match the pattern build/logs/pmd.xml
[DRY] Collecting duplicate code analysis files...
[DRY] Finding all files that match the pattern build/logs/pmd-cpd.xml
Recording plot data
Publishing Clover coverage report...
Clover xml file does not exist in: /var/lib/jenkins/jobs/Symphony2/workspace called: build/logs/clover.xml and will not be copied to: /var/lib/jenkins/jobs/Symphony2/builds/13/cloverphp/clover.xml
Could not find 'build/coverage/build/logs/clover.xml'.  Did you generate the XML report for Clover?
[CRAP4J] Collecting Crap4J analysis files...
[CRAP4J] Searching for report files within build/logs/crap4j.xml
[CRAP4J] Using the new FileSetBuilder
[CRAP4J] No crap4j report files were found. Configuration error?
Build step 'Report Crap' marked build as failure
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at BUILD level /var/lib/jenkins/jobs/Symphony2/workspace/build/api to /var/lib/jenkins/jobs/Symphony2/builds/13/htmlreports/API_Documentation
ERROR: Specified HTML directory '/var/lib/jenkins/jobs/Symphony2/workspace/build/api' does not exist.
[xUnit] [INFO] - Starting to record.
[xUnit] [INFO] - Processing PHPUnit-3.x (default)
[xUnit] [INFO] - [PHPUnit-3.x (default)] - No test report file(s) were found with the pattern 'build/logs/junit.xml' relative to '/var/lib/jenkins/jobs/Symphony2/workspace' for the testing framework 'PHPUnit-3.x (default)'.  Did you enter a pattern relative to the correct directory?  Did you generate the result report(s) for 'PHPUnit-3.x (default)'?
[xUnit] [ERROR] - No test reports found for the metric 'PHPUnit' with the resolved pattern 'build/logs/junit.xml'. Configuration error?.
[xUnit] [INFO] - Failing BUILD.
[xUnit] [INFO] - There are errors when processing test results.
[xUnit] [INFO] - Skipping tests recording.
[xUnit] [INFO] - Stop build.
[JDepend] JDepend plugin is ready
[JDepend] Couldn't generate JDepend file at 'build/logs/jdepend.xml'java.io.FileNotFoundException: /var/lib/jenkins/jobs/Symphony2/workspace/build/logs/jdepend.xml (No such file or directory)
Finished: FAILURE

2 个答案:

答案 0 :(得分:1)

Jenkins以jenkins用户身份运行流程。确保你的'phpcb&#39; jenkins用户可以访问相关路径。

sudo su - jenkins phpcb

如果以上操作不起作用,您需要为phpcb用户正确安装/配置jenkins

答案 1 :(得分:0)

错误是:

  

/var/lib/jenkins/jobs/Symphony2/workspace/build.xml:127:执行失败:java.io.IOException:无法运行程序&#34; phpcb&#34;:error = 2,没有这样的文件或目录

当你说你可以从命令行运行它时,你的意思是:

  1. 你进入詹金斯并且禁用了这份工作。 (这会阻止您在尝试调试问题时构建它。)
  2. 您已登录运行Jenkins的服务器。
  3. 您以运行Jenkins进程的用户身份登录。
  4. 您更改为目录&#39; / var / lib / jenkins / jobs / Symphony2 / workspace` 这是唯一真正的检查方式。
  5. 然后,就像詹金斯一样运行了ant Buildfile: /var/lib/jenkins/jobs/Symphony2/workspace/build.xml命令。
  6. 如果没有,您无法确定是否从命令行构建

    错误消息告诉您Ant无法找到命令phpcb。这就是您希望以Jenkins用户身份登录并直接从Jenkins服务器上的命令行重新运行命令的原因。我敢打赌它与Jenkins服务器上phpcb命令的位置(即实际安装)和$PATH设置有关。尝试登录Jenkins服务器并输入type phpcbwhich phpcbwhence phpcb并查看输出。如果它能找到phpcb命令,它会告诉你它所在的目录。

    我的标准是将一个符号链接从命令的实际位置放到/usr/local/bin/usr/share/bin目录,然后在我的$PATH中放置一个目录。我甚至将它放在$PATH的开头,以便允许更新版本的命令覆盖系统默认值。

    咒语 但是,它适用于我的机器 是一个常见的副词,我听到开发人员一直告诉我。这意味着他们的系统在他们的环境中有一些与官方规范不同的东西。我告诉他们,如果我不能建立它,它就不算数。 - 不是我痛苦......

    顺便说一下,Phing的状态是什么,这是PHP的Ant版本。 Phing的任务是特定于PHP的,整个程序是面向PHP的。 Phing甚至可以在PHP下运行而不是Java。

相关问题