Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Build Promotion with Jenkins

Build Promotion with Jenkins

Talk at KCPHP User Group - January 2015.

Kevin O'Brien

January 16, 2015
Tweet

More Decks by Kevin O'Brien

Other Decks in Technology

Transcript

  1. Why do all that work? What can Jenkins do? What

    does it look like? Friday, January 16, 15
  2. Why? Friday, January 16, 15 With Jenkins, an umpire looks

    at every unit test and line of developer-written code that comes into the GIT master branch
  3. What? Commit: unit & quality tests Same artifacts throughout the

    build Version Control Source code Env. & Config Artifact Repository Acceptance: functional tests User Testing Capacity Testing Production Friday, January 16, 15 Code & Configuration come from Version control, Artifact Repository delivers the same code and configuration throughout the build.
  4. What? Jenkins Jobs Friday, January 16, 15 Projects (labeled here

    as Job01… through Job08… to list them in order of execution) instruct Jenkins to perform work on the application code.
  5. What? Jenkins Build Promotion Friday, January 16, 15 Promotions group

    Projects into a sequence of work to be done. This promotion starts by building the code artifacts and ends with deploying the artifacts to production
  6. What? PHP Code Quality Friday, January 16, 15 PHP code

    quality tools can be executed in a project
  7. What? PHP Unit Tests Friday, January 16, 15 PHP code

    unit test tools can be executed in a project
  8. What? Transfer Archive and Run Deploy Friday, January 16, 15

    Jenkins can send artifacts and execute shell scripts over SSH to deploy code to web & application servers
  9. What? See Promotion Progress Friday, January 16, 15 The Build

    History shows the work done for each of the builds (each time Jenkins pulled code from GIT). Each star represents one step in the build promotion process.
  10. What Else? PHP QA Tools - Lint smartyLint PHPLOC PHP_Depend

    PHP Mess Detector PHP_CodeSniffer PHP Copy/Paste Detector PHPUnit phpDox Friday, January 16, 15 http://jenkins-php.org http://phpqatools.org
  11. What Else? Jenkins Plugins - promoted-builds git copy artifact execute

    shell record fingerprints publish over ssh thinbackup workspace cleanup disk-usage Friday, January 16, 15
  12. What Else? Shell Scripts - Test: deployCode dropDb deployDb seedDataTables

    Production: updateDb deployCode Friday, January 16, 15
  13. What Else? Java (Oracle V Open) Composer build.xml Vagrant/VirtualBox/puphpet SSH

    authentication Environment Database Migration (phinx.org) Database Seeding (custom) File & Directory Permissions Users, Groups, Sudoers Friday, January 16, 15
  14. Looks Like... Build Trigger Developer WorkStation Remote GIT Repo Jenkins

    Push/Pull “Master” GIT hook Post- Receive on “Master” Friday, January 16, 15 Developer pushes code changes to the master branch in the remote GIT repository. A “hook” in the application’s repository tells Jenkins that the master branch has changed. Jenkins pulls the code, builds a repository and runs code quality jobs.
  15. Looks Like... Deploy Application Jenkins Test Server Production Server SSH

    move archive run deploy.sh Production Db Test Db Friday, January 16, 15 On direct, user input, Jenkins copies code to the Test or Production server, deploys code and runs database operations by running shell scripts on the servers.
  16. References: Sources PHP • https:/ /puphpet.com • https:/ /www.vagrantup.com •

    https:/ /getcomposer.org • http:/ /phpqatools.org Jenkins • http:/ /jenkins-ci.org • https:/ /wiki.jenkins-ci.org/display/JENKINS/ Friday, January 16, 15
  17. References: How Tos PHP quality testing in Jenkins • http:/

    /jenkins-php.org • http:/ /erichogue.ca/2011/05/php/continuous- integration-in-php/ Deploy with Promotions in Jenkins • https:/ /www.youtube.com/watch? v=aAE1UqWJB2U Friday, January 16, 15