Jenkins Continuous Integration A quick overview of Jenkins CI Michael Peacock @michaelpeacock michaelpeacock.co.uk
May 11, 2015
Jenkins Continuous IntegrationA quick overview of Jenkins CI
Michael [email protected]
Continuous What?• Automated build and test process to verify a
software / website / web app build• Quality Assurance applied continually during
development
continuous integration (CI) implements continuous processes of applying quality control — small pieces of effort, applied
frequently. Continuous integration aims to improve the quality of software, and to reduce the time taken to deliver it, by replacing
the traditional practice of applying quality control after completing all development.*
* http://en.wikipedia.org/wiki/Continuous_integration
Jenkins!
Jenkins...
• Built with Java• Provides its own web based interface –
doesn’t interfere with your Apache installation• Recommendation: install Continuous
Integration stuff on a separate server – processing lots of builds could get resource intensive
• Available for Windows, Mac and Linux
Installation• Add the Jenkins repository key to aptitudewget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add –
• Add the repository to your sources filesudo nano /etc/apt/sources.listdeb http://pkg.jenkins-ci.org/debian binary/sudo apt-get update
• Installsudo apt-get install jenkins
Modular
Works with version control systems• SVN• Git• Mercurial• CVS
Ant
• Should be familiar to Java programmers...• Makes it really easy to:
– Move, copy, delete, rename files and folders – use it to move files around after checking out from version control e.g. Swap in a test config file
– Run commands / programs on the code – such as unit testing, code sniffing and generating documentation
• Built in to Jenkins out of the box
Testing
• Automatically run your unit tests– Find a plugin– Get ant to run your tests by executing commands– Build fails if tests fail
<target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml"> <exec executable="phpunit" failonerror="true"/> </target> <target name="phpunit" description="Run unit tests using PHPUnit and generates junit.xml and clover.xml"> <exec executable="phpunit" failonerror="true"/> </target>
<target name="phpunit" description="Run unit tests using PHPUnit and generates results as XML files"> <exec executable="phpunit" failonerror="true"/> </target>
http://www.buildsonmymachine.com/
Weather Report
You broke the build
• Stigmatises breaking the build
• Helps “encourage” / bully developers into better quality work
http://www.youbrokethebuild.com/
Record keeping
What changed in the build?
Pipeline
Chain Jenkins jobs together, triggering others (e.g. deployment) only when the first job builds successfully, ensures only tested and quality code goes online
• https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin
• (no screenshots, because I couldn’t get it to work )
Deployment
• Plug Jenkins into your deployment process• Copy files over FTP• Copy files over SSH• Execute commands on a remote server
– Tell the web server that the new site has been copied across and is ready for use
Improve
• Improve the quality of your code• Automate your:
– Testing– Quality Assurance process– Deployment to development areas– Deployment to live environment (through
pipeline)• Keep clients happier!