Here is a list for common problems found while integrating sf2 and jenkins.
First problem I ran into was that I had set jenkins user on debian to handle all jenkins tasks. git was set to work with my current debian ubuntu account, however when jenkins was working it did not have settings for identity set on git. That was solved running config –global user.email and user.name respetively.
Second problem I ran into was the following warning:
FATAL: Unable to find build script at /var/lib/jenkins/jobs/FormModelProjectBundle/workspace/build.xml
Yes I had to modify build.xml from the website instructions and adapt it and place it at the root of my project folder.
Third problem I found is that I did not have installed ant:
sudo apt-get install ant
After this I got this sucker:
[exec] Cannot find specified rule-set "/var/lib/jenkins/jobs/FormModelProjectBundle/workspace/build/phpmd.xml".
So I added the following under build/ :
<?xml version="1.0" encoding="utf-8" ?> <phpmd failonerror="off" failonruleviolation="off"> <ruleset>unusedcode</ruleset> <ruleset>codesize</ruleset> <ruleset>design</ruleset> <ruleset>naming</ruleset> </phpmd>
Then it was giving me an error saying that it couldn’t find phpunit. And it is because I had to place -c app as argument and path respectively (check the repo for FormModelProjectBundle).
Then I ran into a problem with the classloaders:
[exec] PHP Fatal error: Class 'Doctrine\Common\Annotations\AnnotationRegistry' not found in /var/lib/jenkins/jobs/FormModelProjectBundle/workspace/app/autoload.php on line 43
This was because i needed to run a bin/vendors update task into the build:
<target name="vendors" description="Update vendors"> <exec executable="bin/vendors" failonerror="true"> <arg value="update" /> </exec> </target> // and at the end <target name="build" depends="clean,vendors,parallelTasks,phpunit,phpcb"/>
Then also realized that I had to log somewhere (this code goes inside the phpunit.xml):
<logging> <log type="coverage-html" target="build/coverage" title="Name of Project" charset="UTF-8" yui="true" highlight="true" lowUpperBound="35" highLowerBound="70"/> <log type="coverage-clover" target="build/logs/clover.xml"/> <log type="junit" target="build/logs/junit.xml" logIncompleteSkipped="false"/> </logging>
You can solve many more problems. If you have found more please post them on comments so we can keep track of common issues.
Also I transferred the ant version to a phing build version here so it can work with phpstorm https://github.com/cordoval/FormModelProjectBundle/blob/master/buildphing.xml. This you can use with jenkins.
Pushed to git repo and now running jenkins!
Please consider donating for most sf2 posting!
Some of the giants whose shoulders lifted me to see further: