Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Continuous Integration with Jenkins and Java EE

696 views

Published on

In this talk, we will analyze how to use Jenkins as a tool to perform Continuous Integration and Continuous Delivery in a Java EE architecture, using Wildfly as Application Server and Maven as a dependency handler, exploiting the wildfly-maven-plugin.

Published in: Technology
  • Be the first to comment

Continuous Integration with Jenkins and Java EE

  1. 1. Continuous Integration with Jenkins and Java EE Francesco Marchitelli
  2. 2. marchitelli.francesco@gmail.com @marcyborg
  3. 3. Agenda
  4. 4. What is CI ● In software engineering, 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.
  5. 5. History • Continuous Integration emerged in the Extreme Programming (XP) community, and XP advocates Martin Fowler and Kent Beck first wrote about Continuous Integration circa 1999.
  6. 6. Martin Fowler ● Continuous Integration is a software development practice where members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. ● Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible.
  7. 7. Features of Continuous Integration
  8. 8. Hell of Integration
  9. 9. How to avoid it?
  10. 10. SCM
  11. 11. Automate Build
  12. 12. Auto-Testing Build
  13. 13. Commit on Baseline
  14. 14. Every Commit Could Be a Build
  15. 15. Fast Build
  16. 16. Test Env Same As Production
  17. 17. Easy to Retrieve Last Version
  18. 18. Live Update
  19. 19. Automate Deployment
  20. 20. CI Benefit ●Project Management  Detect system development problems earlier  Reduce risks of cost, schedule, and budget ●Code Quality  Measurable and visible code quality  Continuous automatic regression unit test
  21. 21. CI Overview
  22. 22. What is CD?
  23. 23. What is CD?
  24. 24. CI vs CD
  25. 25. Principles of Continuous Delivery
  26. 26. Principle #1 Every Build is a Potential Release
  27. 27. Principle #2 Eliminate Manual Bottlenecks
  28. 28. Automate Whatever Possible Principle #3
  29. 29. Have Automated Tests You Can Trust Principle #4
  30. 30. Build Pipelines The Conveyer Belts of Continuous Delivery
  31. 31. Jenkins 1. An open source CI server 2. More then 85000 installations 3. Plug-in extensibility (Over 900 plugins) 4. MIT license
  32. 32. Jenkins Features ● Trigger a build ● Get source code from repository ● Automatically build and test ● Generate report & notify ● Deploy ● Distributed Build
  33. 33. Jenkins Requirement ● Web Server (Tomcat, WebLogic, …) ● Build tool (Maven, Ant) ● SCM (Git, Svn, Cvs, …)
  34. 34. Jenkins Plugins ● Build triggers ● Source code management ● Build tools ● Build notifiers ● Build reports ● Artifact uploaders ● UI plugins ● Authentication and user management
  35. 35. Build Trigger ● Manually click build button ● Build periodically ● Build whenever a SNAPSHOT dependency is built ● Build after other projects are built ● Poll SCM ● IRC, Jabber, …
  36. 36. Build Report ● Static Code Analysis • Checkstyle, PMD, Findbugs, Compiler Warning ● Test Report & Code Coverage • JUnit, TestNG, Cobertura, Clover ● Open Tasks
  37. 37. Security Management ●Security Realm • LDAP • Jenkins's own user database • Delegate to servlet container ●Authorization • Anyone can do anything • Logged-in users can do anything • Matrix-based security • Project-based Matrix Authorization Strategy • Legacy mode
  38. 38. Configuration as Code: Job DSL Plugin ●Create new pipelines quickly ●Refactor jobs ●Trace changes ●Work with your favorite tool set
  39. 39. Jenkins job pipeline
  40. 40. Job DSL Plugin ●Install Job DSl Plugin ●Create free-style project ●Add “Source Code Management” ●Add “Process Job DSLs” build step ●Configure scripts ●Run job
  41. 41. Everything is Groovy def branches = ['master', 'feature-a'] branches.each { branch -> job("jenkins-${branch}") { scm { github('marcyborg/helloworld-rs', branch) } … } }
  42. 42. node { def server = Artifactory.newServer url: SERVER_URL, credentialsId: CREDENTIALS def rtMaven = Artifactory.newMavenBuild() stage 'Build' git url: 'https://github.com/marcyborg/helloworld-rs.git' stage 'Artifactory configuration' rtMaven.tool = MAVEN_TOOL // Tool name from Jenkins configuration rtMaven.deployer releaseRepo:'libs-release-local', snapshotRepo:'libs-snapshot-local', server: server rtMaven.resolver releaseRepo:'libs-release', snapshotRepo:'libs-snapshot', server: server def buildInfo = Artifactory.newBuildInfo() stage 'Exec Maven' rtMaven.run pom: 'maven-example/pom.xml', goals: 'clean install', buildInfo: buildInfo stage 'Publish build info' server.publishBuildInfo buildInfo }
  43. 43. Maven lifecycle
  44. 44. Minimize build jobs for the main build
  45. 45. Split unit and integration tests
  46. 46. JBoss Wildfly ● Previously named JBoss Application Server ● Named change to better differentiate Community from Supported product ● Support Java EE 7 ● Fast, Lightweight, Manageable ● Developer Friendly ● Open Source
  47. 47. Wildfly-Maven-plugin
  48. 48. Jenkins to Wildfly using Maven
  49. 49. Installing Git in Jenkins
  50. 50. Creating a Git project in Jenkins
  51. 51. Installing Github in Jenkins
  52. 52. Creating a Github project in Jenkins
  53. 53. Installing Maven in Jenkins
  54. 54. Creating a Maven Github project in Jenkins
  55. 55. Thanks!
  56. 56. Please Leave a Feedback! https://goo.gl/uV7Aw3

×