Using Jenkins as Native Packages Factory - Jenkins User Conference Paris 2012

4,585 views
4,301 views

Published on

Jenkins User Conference tal

Published in: Technology

Using Jenkins as Native Packages Factory - Jenkins User Conference Paris 2012

  1. 1. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Using Jenkins as Native Packages Factory Henri Gomez Axway http://www.axway.com
  2. 2. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf About me !   CI Architect @ Axway ! Was Senior Ops Director ! Was Developer, TL and Architect ! JPackage Project Founder ! OpenJDK 7 & 8 packages for OSX !   ASF Member (Tomcat & XMLRPC)
  3. 3. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Native Packages !   Heart of OS applications stack !   Dependency handling !   Automatic or selective updates !   Widely used by Ops !   Well suited for Cloud based Operations
  4. 4. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Linux Packaging !   RPM (Redhat Package Manager) –  RHEL/CentOS/ Fedora –  SLES/OpenSuse –  Mandriva !   DEB –  Debian –  Ubuntu
  5. 5. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Package Definition !   A file(.rpm, .deb) !   An archive (Datas & Programs) !   Executed code at install, update or remove time. !   Architecture related. –  Intel, ARM, PowerPC –  32 or 64bits !   Or architecture neutral –  Java application –  Ruby library
  6. 6. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Package Benefits ! Describing requirement ! Provide programs, datas and settings ! Registering in system service(ie: logrotate) ! Enforcing dedicated run account !   Total control over runtime cycle-life –  Installation –  Update –  Uninstallation A package is much more than an archive
  7. 7. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Maven common facts !   DSL build based !   Dependency Management –  At build time –  At deploy time !   Packages repositories –  In local mode –  Remotely via HTTP !   Nexus and Artifactory could act as RPM repositories
  8. 8. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf From application to RPM !   2 approachs –  OS Vendor way: •  Rebuilt from sources tarballs •  Require tarballs in build path –  Enterprise way: •  Rebuilt from Binaries (stored in Artifacts Repository) •  Avoid duplicate processing •  Trusting your delivery process
  9. 9. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf RPM building – SPEC FILE !   Sources !   Architecture ! Build Requirements ! Deploy Requirements ! Build ! Assembly !   Contents locations and rights
  10. 10. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Jenkins as a Packages Factory !   Jenkins Master –  Get contents from SCM (Subversion, Git) –  Prepare build environment –  Trigger build on slaves !   Jenkins Slaves –  One slave by target (OS/Arch) platform –  Confident in OS compatibility –  Deployment on RPM repositories
  11. 11. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Axway Packages Factory !   Builder –  5 target OS •  CentOS 5 / 6 in 32 and 64 bits •  OpenSuse 12.1 in 32 and 64 bits •  Suse SLES 11 in 64 bits !   Distributor –  Apache HTTPd server –  Packages Repositories hosting and servicing •  4 repos for CentOS 5/6 in 32/64 bits •  1 repo for OpenSuse 12.1 32/64 and SLES 11.
  12. 12. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Axway Packages Factory Builder CentOS 5 32 bits CentOS 5 64 bits CentOS 6 32 bits CentOS 6 64 bits OpenSuse 12.1 32 bits OpenSuse 12.1 64 bits Suse SLES 11 64 bits i5 3.0Ghz, 16GB RAM, 500Gb HD Host OS OpenSuse 12.1 VirtualHost 4.1.8 7 Hosted VMs
  13. 13. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Jenkins Factory in-depth !   Builder –  take control on slaves via SSH –  Trigger build jobs after SCM change –  Trigger jobs on 5/6 VMs via Matrix Plugin !   Slaves –  Build package on OS / Arch –  Send build packages to distributor via SCP !   Distributor –  Reindex repositories via cron if something change
  14. 14. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Jenkins Factory in-depth Repositories reindexed by cron if update detected Parallel build on Build binaries slaves (Matrix) uploaded via SCP New packages immediatly available remotely via HTTP
  15. 15. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Initial method – 1 Job / OS-Arch
  16. 16. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Initial method – 1 Job / OS-Arch
  17. 17. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Final method – 1 Job with Matrix
  18. 18. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Final method – 1 Job with Matrix
  19. 19. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Packages Tricks ! CentOS/RHEL use one repo by arch –  One repository for x86 32bits with native/noarch –  One repository for x86 64bits with native/noarch è One slave by architecture for native è Use one slave builder by arch even for noarch packages ! OpenSuse/SLES use a common repository –  One dir for x86 32bits –  One dir for x86 64bits –  One dir for noarch è  One slave by architecture for native è  You could use 32 or 64 bits builder for noarch packages
  20. 20. Jenkins User Conference Paris, 17 April 2012 #jenkinsconf Thank You To Our Sponsor

×