Mohammad Abu Musa
Mohammad Abu Musa

Reputation: 1133

Jenkins build fails on the web interface but works on ant

here is the output I get when I build from the web interface, but it is successful when I do it from the CLI. what could be the problem? why Jenkins can't find it? I can run the commands without problem

    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 [email protected]:heroleads/deployment.git # timeout=10
Fetching upstream changes from [email protected]:heroleads/deployment.git
 > git --version # timeout=10
using GIT_SSH to set credentials 
 > git -c core.askpass=true fetch --tags --progress [email protected]: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

Upvotes: 0

Views: 2533

Answers (2)

David W.
David W.

Reputation: 107080

The error is:

/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

When you say you can run this from the command line, do you mean:

  1. You went into Jenkins and disabled the job. (This prevents it from building while you're attempting to debug the issue.)
  2. You logged into the server that's running Jenkins.
  3. You logged in as the user that's running the Jenkins process.
  4. You changed to the directory '/var/lib/jenkins/jobs/Symphony2/workspace` That's the only real way to check.
  5. Then, you ran the command ant Buildfile: /var/lib/jenkins/jobs/Symphony2/workspace/build.xml just like Jenkins did.

If not, you can't say for sure that it builds from the command line.

The error message is telling you that Ant cannot find the command phpcb. This is why you want to log in as the Jenkins user and rerun the command right from the command line on the Jenkins server. I bet it has to do with where the phpcb command is on the Jenkins server (i.e., if it was actually installed) and your $PATH setting. Try logging in on the Jenkins server and type in type phpcb or which phpcb or whence phpcb and see the output. If it can find the phpcb command, it'll tell you which directory it's located in.

My standard is to put a symbolic link from the actual location of the command to the /usr/local/bin or /usr/share/bin directory, and then have that one directory in my $PATH. I even place it at the beginning of my $PATH in order to allow newer versions of a command to override the system default.

The mantra But, it works on my machine™ is a common refrain I hear developers tell me all of the time. It means that they have something on their system in their environment that's different from the official specifications. I tell them that if I can't build it, it doesn't count. -- Not that I'm bitter...

By the way, what's the status of Phing which is PHP's version of Ant. Phing's tasks are PHP specific and the whole program is PHP oriented. Phing even runs under PHP and not Java.

Upvotes: 0

Slav
Slav

Reputation: 27505

Jenkins runs process as jenkins user. Make sure your 'phpcb' and associated paths are accessible to the jenkins user.

sudo su - jenkins phpcb

If the above doesn't work, you need to properly install/configure phpcb for jenkins user

Upvotes: 1

Related Questions