O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Jenkins, pipeline and docker

The Jenkins open source continuous integration server now provides a “pipeline” scripting language which can define jobs that persist across server restarts, can be stored in a source code repository and can be versioned with the source code they are building. By defining the build and deployment pipeline in source code, teams can take full control of their build and deployment steps. The Docker project provides lightweight containers and a system for defining and managing those containers. The Jenkins pipeline and Docker containers are a great combination to improve the portability, reliability, and consistency of your build process.

This session will demonstrate Jenkins and Docker in the journey from continuous integration to DevOps.

  • Entre para ver os comentários

Jenkins, pipeline and docker

  1. 1. Jenkins, Pipeline, and Docker Mile High Agile 2017 Mark Waite Twitter: @MarkEWaite E-mail: mark.earl.waite@gmail.com
  2. 2. Introduction
  3. 3. Introduction • I’m Mark Waite – Technical Evangelist at CloudBees – Previously at CA Technologies, PTC, CoCreate, & HP • Builds, tools, and rapid feedback for a long time • I maintain the Jenkins git plugin
  4. 4. Continuous Delivery
  5. 5. Jenkins Pipeline
  6. 6. Jenkins Pipeline • Pipeline as Code – Capture the entire continuous delivery process – Check a Jenkinsfile into your source repo • jenkins.io/doc/book/pipeline
  7. 7. Blue Ocean
  8. 8. Blue Ocean docker run -p 8080:8080 -u root -v /var/run/docker.sock:/var/run/docker.sock jenkinsci/blueocean
  9. 9. Zero
  10. 10. A basic Java application • MarkEWaite/jhipster-sample-app • Tools – Maven – Node / Gulp – Gatling – Docker
  11. 11. Planning the pipeline
  12. 12. Planning the pipeline • Stages desired: – Build – Test o Unit o Performance o Front-end – Static Analysis – Deployment
  13. 13. Planning the pipeline • Stages desired: – Build – Test o Unit o Performance o Front-end – Static Analysis – Deployment
  14. 14. Build
  15. 15. Build • Don't reinvent your build system in Jenkins Pipeline – Think of Pipeline as glue • Goal: – Perform a reproducible build – Create an artifact which can used later o To run tests against o To deploy to an environment • In this case, we're using Maven.
  16. 16. Build pipeline { agent any stages { stage('Build') { steps { sh 'mvn' } } } }
  17. 17. Build stage('Build') { agent { docker { image 'maven:3-alpine' args '-v /root/.m2:/root/.m2' } } /* .. */ }
  18. 18. Build stage('Build') { /* .. */ steps { sh './mvnw -B clean package' stash name: 'war', includes: 'target' } }
  19. 19. Test
  20. 20. Test pipeline { agent any stages { stage('Backend Unit Test') { steps { sh './mvnw -B test' } } } }
  21. 21. Test stage('Backend Unit Test') { agent { docker { image 'maven:3-alpine' args '-v /root/.m2:/root/.m2' } } /* .. */ }
  22. 22. Test stage('Backend Unit Test') { /* .. */ steps { unstash 'war' sh './mvnw -B test' junit '**/surefire-reports/**/*.xml' } }
  23. 23. Test stage('Backend Performance Test') { /* .. */ steps { unstash 'war' sh './mvnw -B gatling:execute' } }
  24. 24. Test stage('Backend') { steps { parallel( 'Unit' : { unstash 'war' sh './mvnw -B test' junit '**/surefire-reports/**/*.xml' }, 'Performance' : { unstash 'war' sh './mvnw -B gatling:execute' }) } } }
  25. 25. Test stage('Frontend Test') { agent { docker 'node:alpine' } steps { sh 'yarn install' sh 'yarn global add gulp-cli' sh 'gulp test' } }
  26. 26. Analyze
  27. 27. Build pipeline { agent any stages { stage('Analyze') { } } }
  28. 28. Analyze • Static analysis • Code coverage checks • Quality scanning – FindBugs – PMD – etc jenkins.io/blog/2017/04/18/continuousdelivery-devops- sonarqube/
  29. 29. Deploy
  30. 30. Deploy • Don't reinvent your deployment system in Jenkins PIpeline – Think of Pipeline as glue • "Deployment" may have different meanings – Deploying to AWS/Azure – Deploying to a physical datacenter – Uploading to an app store – Uploading to an internal artifact server
  31. 31. Deploy pipeline { agent any stages { stage('Deploy') { } } }
  32. 32. Deploy stage('Deploy') { steps { sh './deploy.sh' } }
  33. 33. Build
  34. 34. Test
  35. 35. Deploy
  36. 36. Other considerations
  37. 37. Notifications • Feedback to the team is a key part of continuous delivery • Jenkins Pipeline can be used for: – Sending email – Sending messages to: o HipChat o Slack – Updating JIRA tickets jenkins.io/node/tags/notifications/
  38. 38. Manual Promotion stage('Deploy') { steps { input message: 'Deploy to production?', ok: 'Fire zee missiles!' sh './deploy.sh' } }
  39. 39. Manual Promotion
  40. 40. Zero to Continuous Delivery with Jenkins Pipeline and Blue Ocean
  41. 41. Questions?
  42. 42. Resources • jenkins.io/doc/book/pipeline • jenkins.io/projects/blueocean • Docker containers – jenkinsci/jenkins:lts-alpine – jenkinsci/blueocean • jenkinsci-users@googlegroups.com

×