Jenkins Pipelines in Continuous Action (english)

Jenkins Pipelines in Continuous Action (english)

The Jenkins pipeline plugin is a good choice for realizing sophisticated continuous delivery pipelines for deploying different kinds of applications. Combined with Kubernetes it offers a premium tool chain for DevOps. On top of that, the versatility of Jenkins Pipelines has inspired us to continuously deliver lots of other things.

The talk takes you through an introductory story over to the basics and concepts of Jenkins Pipelines and finally tries to stir your fantasy by showing how we actually use Jenkins Pipelines.

875e2bcfb1dc37d05adebcf72269dc77?s=128

Oliver Milke

March 12, 2019
Tweet

Transcript

  1. // Jenkins Pipelines in Continuous Action

  2. // • > 10 years of software developement • Software

    Craftsman @cloudogu • JUG Ostfalen • Fitness / Freeletics Oliver Milke Software Craftsman https://twitter.com/OliverMilke About me https://twitter.com/cloudogu Cloudogu GmbH // 2
  3. Intro Jenkins Pipelines - overview and basics Pipeline Show Case

    //Where the journey goes Cloudogu GmbH // 3
  4. Cloudogu GmbH // 4

  5. Cloudogu GmbH // 5

  6. Cloudogu GmbH // 6 1. Efficiency 2. Quality 3. Fun

    ☺ TOP 3 good reasons for automation
  7. Cloudogu GmbH // 7 A Knightmare on Wall Street

  8. Cloudogu GmbH // 8 Facts 3.3B transactions per day $21B

    trade volumne per day 17% of the trades on NYSE and NASDAQ $365M in cash 31st July 2012
  9. Cloudogu GmbH // 9 Epic Drama software development and operations

    Dev + Ops What is the cost of bad culture?
  10. Cloudogu GmbH // 10 What is the cost of bad

    culture? infinite amount of sweat beads
  11. Cloudogu GmbH // 11 What is the cost of bad

    culture? 45 minutes of malfunction
  12. Cloudogu GmbH // 12 What is the cost of bad

    culture? $465M
  13. Cloudogu GmbH // 13 What is the cost of bad

    culture? bankruptcy https://dougseven.com/2014/04/17/knightmare-a-devops-cautionary-tale
  14. // “Experience is simply the name we give our mistakes.“

    Oscar Wilde Cloudogu GmbH // 14
  15. Cloudogu GmbH Continuous… ✓ Integration ✓ Delivery ✓ Deployment ✓

    Testing ✓ Inspection ✓ Monitoring ✓ Improvement // 16
  16. Cloudogu GmbH // 17

  17. Cloudogu GmbH // 18

  18. Cloudogu GmbH // 19

  19. Cloudogu GmbH // 20

  20. Cloudogu GmbH // 21

  21. Cloudogu GmbH Jenkins 2 Pipeline a.k.a. Pipeline as Code Jenkinsfile

    // 22 https://plugins.jenkins.io/workflow-aggregator https://jenkins.io/doc/book/pipeline/
  22. Cloudogu GmbH About the Talk accompanying article series // 23

  23. Cloudogu GmbH About the Talk accompanying article series // 24

    https://cloudogu.com/en/blog/continuous_delivery_1_basics https://cloudogu.com/en/blog/continuous_delivery_2 https://cloudogu.com/en/blog/continuous_delivery_part_3 https://cloudogu.com/en/blog/continuous_delivery_4_en
  24. Basic Concepts Cloudogu GmbH // 25 ✓

  25. // Steps & Stages • Steps of the build process

    • scm checkout • mvn package • docker build • cubectl apply • sh 'magic‘ • Logic clustering to stages • Build • Test • Deploy Cloudogu GmbH // 26
  26. Cloudogu GmbH // 27 http://localhost:8080/job/myPipeline/pipeline-syntax/ http://localhost:8080/job/myPipeline/pipeline-syntax/html http://localhost:8080/job/myPipeline/pipeline-syntax/globals * https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md Plugins

    enrich the feature set*
  27. Pro Tip #1 Replay Cloudogu GmbH // 28

  28. Jenkins Architektur Cloudogu GmbH // 29

  29. Pro Tip #2 Workspaces Cloudogu GmbH // 30

  30. Long Build Jobs parallelization 1 Agent* n Agents ⚠️ 1

    Workspace ⚠️ Setup synchronization exmaple Cloudogu GmbH // 31
  31. Long Build Jobs nightly ⚠️ @midnight ⚠️ currentBuild.getBuildCauses() ⚠️ Feedback

    Cloudogu GmbH // 32
  32. Pro Tip #3 Cloudogu GmbH // 33 http://www.cronmaker.com/ CronMaker is

    a utility which helps you to build cron expressions.
  33. Similar Pipelines a.k.a Don‘t Repeat Yourself re-use load Shared Lib

    ⚠️ Pipeline Repository ⚠️ Groovy Script Cloudogu GmbH // 34
  34. Shared Libs • tests! • declaration required • include required

    Cloudogu GmbH // 35
  35. Jenkins Architektur Cloudogu GmbH // 36

  36. Build Agents Cloudogu GmbH // 37

  37. Build Agents ⚠️ coupling of build and build agent Cloudogu

    GmbH // 38
  38. Build Agents Cloudogu GmbH // 39

  39. Docker ⚠️ Cloudogu GmbH // 40

  40. Build Agents Cloudogu GmbH // 41

  41. // Credentials • Secrets do not belong in the Jenkinsfile

    - never • Inbuilt security handling https://jenkins.io/doc/book/using/using-credentials/ Cloudogu GmbH // 42
  42. Continuous Delivery …just another step ? Cloudogu GmbH // 43

  43. Example Pipeline Cloudogu GmbH // 44

  44. Cloudogu GmbH // 45

  45. Cloudogu GmbH // 46 Cloudogu Training EcoSystem Consulting

  46. Dogus Cloudogu GmbH // 47 Lint Setup Build Integration Tests

    Provision Wait 4 Dependencies Verify Clean Checkout ~ 10 minutes
  47. cloudogu.com Cloudogu GmbH // 48 Build Checkout Deploy ~ 5

    minutes
  48. k8s training slides Cloudogu GmbH // 49 Build Checkout Deploy

    Nexus package Deploy Kubernetes ~ 3 minutes
  49. Internal PDF manual Cloudogu GmbH // 50 Meta Data Checkout

    Deploy Build ~ 1 minute
  50. demo.cloudogu.net Cloudogu GmbH // 51 Decide Color Apply Demo Content

    Destroy Old Instance Checkout Create New Instance Switch DNS Record ~ 22 minutes
  51. private CES demo instances Cloudogu GmbH // 52 Apply or

    Destroy Demo Content Checkout Verify ~ 3 minutes
  52. // Wrap Up • Jenkins Pipelines is Classic Jenkins as

    Code • Steps grouped in Stages • Code Generator for exploration • Don‘t Repeat Yourself • Test automation is part of the story • Parallise if needed • Use Docker build agents for step execution Cloudogu GmbH // 53
  53. // Wrap Up • Delivery in a containerized world is

    much easier • Automation is extremely valuable ☺ • Learning from mistakes is essential Cloudogu GmbH // 54
  54. Thank You https://cloudogu.com | https://twitter.com/cloudogu See you at our booth!

    Oliver Milke