Coder Social home page Coder Social logo

jenkins-ci-php's People

Contributors

iliyan-trifonov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

jenkins-ci-php's Issues

data container

Can I use this setup or it isn't correct?

// first setup data container
docker create -v /data/jenkins:/var/lib/jenkins --name data-jenkins busybox:latest /bin/true

docker run -d --name myjenkins -p 8080:8080 --volumes-from data-jenkins -e 'TIME_ZONE=ETC/UTC' iliyan/jenkins-ci-php:latest

Stucking at PHPunit

I'm using this image for a couple of days and had one problem that I really don't know why:

Jenkins always get stuck in PHPUnit "Generating code coverage report in PHPUnit XML format..." process.

On my real machine only take less than 2 minutes, but in docker it's taking forever, and cpu usage is 100%. The project is an official Laravel 4.3 example, created by composer create-project laravel/laravel --prefer-dist, and the build.xml, phpunit.xml is like this:

build.xml

<?xml version="1.0" encoding="UTF-8"?>
<project name="name-of-project" default="build">
 <!-- By default, we assume all tools to be on the $PATH -->
 <property name="toolsdir" value=""/>

 <!-- Uncomment the following when the tools are in ${basedir}/vendor/bin -->
 <!-- <property name="toolsdir" value="${basedir}/vendor/bin/"/> -->

 <target name="build"
         depends="prepare,lint,phploc-ci,pdepend,phpmd-ci,phpcs-ci,phpcpd-ci,phpunit,phpdox"
         description=""/>

 <target name="build-parallel"
         depends="prepare,lint,tools-parallel,phpunit,phpdox"
         description=""/>

 <target name="tools-parallel" description="Run tools in parallel">
  <parallel threadCount="2">
   <sequential>
    <antcall target="pdepend"/>
    <antcall target="phpmd-ci"/>
   </sequential>
   <antcall target="phpcpd-ci"/>
   <antcall target="phpcs-ci"/>
   <antcall target="phploc-ci"/>
  </parallel>
 </target>

 <target name="clean"
         unless="clean.done"
         description="Cleanup build artifacts">
  <delete dir="${basedir}/build/api"/>
  <delete dir="${basedir}/build/coverage"/>
  <delete dir="${basedir}/build/logs"/>
  <delete dir="${basedir}/build/pdepend"/>
  <delete dir="${basedir}/build/phpdox"/>
  <property name="clean.done" value="true"/>
 </target>

 <target name="prepare"
         unless="prepare.done"
         depends="clean"
         description="Prepare for build">
  <mkdir dir="${basedir}/build/api"/>
  <mkdir dir="${basedir}/build/coverage"/>
  <mkdir dir="${basedir}/build/logs"/>
  <mkdir dir="${basedir}/build/pdepend"/>
  <mkdir dir="${basedir}/build/phpdox"/>
  <property name="prepare.done" value="true"/>
 </target>

 <target name="lint" description="Perform syntax check of sourcecode files">
  <apply executable="php" failonerror="true">
   <arg value="-l" />

   <fileset dir="${basedir}/app/controllers">
    <include name="**/*.php" />
    <modified />
   </fileset>

   <fileset dir="${basedir}/app/tests">
    <include name="**/*.php" />
    <modified />
   </fileset>
  </apply>
 </target>

 <target name="phploc"
         description="Measure project size using PHPLOC and print human readable output. Intended for usage on the command line.">
  <exec executable="${toolsdir}phploc">
   <arg value="--count-tests" />
   <arg path="${basedir}/app/controllers" />
   <arg path="${basedir}/app/tests" />
  </exec>
 </target>

 <target name="phploc-ci"
         depends="prepare"
         description="Measure project size using PHPLOC and log result in CSV and XML format. Intended for usage within a continuous integration environment.">
  <exec executable="${toolsdir}phploc">
   <arg value="--count-tests" />
   <arg value="--log-csv" />
   <arg path="${basedir}/build/logs/phploc.csv" />
   <arg value="--log-xml" />
   <arg path="${basedir}/build/logs/phploc.xml" />
   <arg path="${basedir}/app/controllers" />
   <arg path="${basedir}/app/tests" />
  </exec>
 </target>

 <target name="pdepend"
         depends="prepare"
         description="Calculate software metrics using PHP_Depend and log result in XML format. Intended for usage within a continuous integration environment.">
  <exec executable="${toolsdir}pdepend">
   <arg value="--jdepend-xml=${basedir}/build/logs/jdepend.xml" />
   <arg value="--jdepend-chart=${basedir}/build/pdepend/dependencies.svg" />
   <arg value="--overview-pyramid=${basedir}/build/pdepend/overview-pyramid.svg" />
   <arg path="${basedir}/app/controllers" />
  </exec>
 </target>

 <target name="phpmd"
         description="Perform project mess detection using PHPMD and print human readable output. Intended for usage on the command line before committing.">
  <exec executable="${toolsdir}phpmd">
   <arg path="${basedir}/app/controllers" />
   <arg value="text" />
   <arg path="${basedir}/build/phpmd.xml" />
  </exec>
 </target>

 <target name="phpmd-ci"
         depends="prepare"
         description="Perform project mess detection using PHPMD and log result in XML format. Intended for usage within a continuous integration environment.">
  <exec executable="${toolsdir}phpmd">
   <arg path="${basedir}/app/controllers" />
   <arg value="xml" />
   <arg path="${basedir}/build/phpmd.xml" />
   <arg value="--reportfile" />
   <arg path="${basedir}/build/logs/pmd.xml" />
  </exec>
 </target>

 <target name="phpcs"
         description="Find coding standard violations using PHP_CodeSniffer and print human readable output. Intended for usage on the command line before committing.">
  <exec executable="${toolsdir}phpcs">
   <arg value="--standard=PSR2" />
   <arg value="--extensions=php" />
   <arg value="--ignore=autoload.php" />
   <arg path="${basedir}/app/controllers" />
   <arg path="${basedir}/app/tests" />
  </exec>
 </target>

 <target name="phpcs-ci"
         depends="prepare"
         description="Find coding standard violations using PHP_CodeSniffer and log result in XML format. Intended for usage within a continuous integration environment.">
  <exec executable="${toolsdir}phpcs" output="/dev/null">
   <arg value="--report=checkstyle" />
   <arg value="--report-file=${basedir}/build/logs/checkstyle.xml" />
   <arg value="--standard=PSR2" />
   <arg value="--extensions=php" />
   <arg value="--ignore=autoload.php" />
   <arg path="${basedir}/app/controllers" />
  </exec>
 </target>

 <target name="phpcpd"
         description="Find duplicate code using PHPCPD and print human readable output. Intended for usage on the command line before committing.">
  <exec executable="${toolsdir}phpcpd">
   <arg path="${basedir}/app/controllers" />
  </exec>
 </target>

 <target name="phpcpd-ci"
         depends="prepare"
         description="Find duplicate code using PHPCPD and log result in XML format. Intended for usage within a continuous integration environment.">
  <exec executable="${toolsdir}phpcpd">
   <arg value="--log-pmd" />
   <arg path="${basedir}/build/logs/pmd-cpd.xml" />
   <arg path="${basedir}/app/controllers" />
  </exec>
 </target>

 <target name="phpunit"
         depends="prepare"
         description="Run unit tests with PHPUnit">
  <exec executable="${toolsdir}phpunit" failonerror="true">
   <arg value="--configuration"/>
   <arg path="${basedir}/build/phpunit.xml"/>
  </exec>
 </target>

 <target name="phpdox"
         depends="phploc-ci,phpcs-ci,phpmd-ci"
         description="Generate project documentation using phpDox">
  <exec executable="${toolsdir}phpdox" dir="${basedir}/build"/>
 </target>
</project>

phpunit.xml

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
         backupStaticAttributes="false"
         bootstrap="../bootstrap/autoload.php"
         colors="true"
         convertErrorsToExceptions="true"
         convertNoticesToExceptions="true"
         convertWarningsToExceptions="true"
         processIsolation="false"
         stopOnFailure="false"
         syntaxCheck="false"
         strict="true"
         verbose="true"
>

    <logging>
        <log type="coverage-html" target="coverage"/>
        <log type="coverage-clover" target="logs/clover.xml"/>
        <log type="coverage-crap4j" target="logs/crap4j.xml"/>
        <log type="coverage-xml" target="logs/coverage"/>
        <log type="junit" target="logs/junit.xml" logIncompleteSkipped="false"/>
    </logging>

    <testsuites>
        <testsuite name="Application Test Suite">
            <directory suffix="Test.php">../app/tests/</directory>
            <exclude>../vendor</exclude>
        </testsuite>
    </testsuites>

    <filter>
    <blacklist>
        <directory suffix=".php">../vendor</directory>
    </blacklist>
    <whitelist addUncoveredFilesFromWhitelist="true">
      <directory suffix=".php">../src</directory>
      <exclude>
        <file>../vendor/autoload.php</file>
        <file>../bootstrap/autoload.php</file>
      </exclude>
    </whitelist>
  </filter>
</phpunit>

Is something wrong in my xml files?

Fatal error on docker pull

$ sudo docker pull iliyan/jenkins-ci-php:1.0.2

FATA[0000] Post http:///var/run/docker.sock/v1.16/images/create?fromImage=iliyan%2Fjenkins-ci-php%3A1.0.2: dial unix /var/run/docker.sock: no such file or directory

[Closed]: it was a local problem with boot2docker

Problem with file permission

After creating a fresh container, I got an some exception in the log file

docker run -d --name jenkins-php -p 18080:8080 -e 'TIME_ZONE=Europe/Paris' -v /Users/XXX/jenkins:/var/lib/jenkins iliyan/jenkins-ci-php

INFO: Restart in 10 seconds
Jan 11, 2016 3:25:55 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
INFO: Accepted connection #3 from /127.0.0.1:55080
Jan 11, 2016 3:25:58 PM hudson.TcpSlaveAgentListener$ConnectionHandler run
INFO: Accepted connection #4 from /127.0.0.1:55082
Running from: /usr/share/jenkins/jenkins.war
Feb 05, 2016 2:46:19 PM winstone.Logger logInternal
INFO: Beginning extraction from war file
Feb 05, 2016 2:46:19 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: jetty-winstone-2.9
Feb 05, 2016 2:46:21 PM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: NO JSP Support for , did not find org.apache.jasper.servlet.JspServlet
Jenkins home directory: /var/lib/jenkins found at: EnvVars.masterEnvVars.get("JENKINS_HOME")
Feb 05, 2016 2:46:22 PM hudson.WebAppMain recordBootAttempt
WARNING: Failed to record boot attempts
java.io.FileNotFoundException: /var/lib/jenkins/failed-boot-attempts.txt (Permission denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    at hudson.WebAppMain.recordBootAttempt(WebAppMain.java:295)
    at hudson.WebAppMain.contextInitialized(WebAppMain.java:131)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:282)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at winstone.Launcher.<init>(Launcher.java:156)
    at winstone.Launcher.main(Launcher.java:356)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at Main._main(Main.java:293)
    at Main.main(Main.java:98)

Feb 05, 2016 2:46:22 PM hudson.WebAppMain contextInitialized
SEVERE: Failed to initialize Jenkins
java.lang.NullPointerException
    at com.trilead.ssh2.util.IOUtils.closeQuietly(IOUtils.java:12)
    at hudson.WebAppMain.recordBootAttempt(WebAppMain.java:300)
    at hudson.WebAppMain.contextInitialized(WebAppMain.java:131)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:282)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at winstone.Launcher.<init>(Launcher.java:156)
    at winstone.Launcher.main(Launcher.java:356)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at Main._main(Main.java:293)
    at Main.main(Main.java:98)

Feb 05, 2016 2:46:22 PM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: Failed startup of context w.{,file:/var/cache/jenkins/war/},/var/cache/jenkins/war
java.lang.NullPointerException
    at com.trilead.ssh2.util.IOUtils.closeQuietly(IOUtils.java:12)
    at hudson.WebAppMain.recordBootAttempt(WebAppMain.java:300)
    at hudson.WebAppMain.contextInitialized(WebAppMain.java:131)
    at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:782)
    at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:424)
    at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:774)
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:249)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95)
    at org.eclipse.jetty.server.Server.doStart(Server.java:282)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64)
    at winstone.Launcher.<init>(Launcher.java:156)
    at winstone.Launcher.main(Launcher.java:356)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at Main._main(Main.java:293)
    at Main.main(Main.java:98)

Looks like there is an issue with the file permission for the home directory

$ ls -la /var/lib
drwxr-xr-x  1    1000 staff     68 Feb  5 13:46 jenkins

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.