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

Continuous Integrations with Jenkins

Continuous Integrations with Jenkins

Introductory presentation for EVRY employees about Continuous Integrations and Jenkins CI

Hans Kristian Flaatten

February 23, 2017
Tweet

More Decks by Hans Kristian Flaatten

Other Decks in Technology

Transcript

  1. ! Agenda OPTIONAL SUBHEADING • Continuous Integration (CI) • The

    CI Server • Jenkins CI • Jenkins Pipelines • DEMO • Continuous Deployment (CD)
  2. ! 5 Continuous Integration Integrating code back to a shared

    mainline • Automate build & test • Ensure reproducibility • Detect errors early • Improve quality • Reduce cost
  3. ! 8 The CI Server 1. Fetch code from source

    control 2. Build and test the software 3. Notify on success/failure
  4. ! 9 The CI Server (cont) • General purpose •

    Language, framework & tooling • Good integrations • Source control & team communication • Support complex build pipelines • Store artefacts • Run deployment • Be efficient
  5. ! 11 Jenkins CI • General purpose automation server •

    Free and open source • Works on any plattform • Released in 2005 • Sponsored by CloudBees • The largest CI plugin system https://jenkins.io/
  6. ! 12 The good, the bad & the ugly •

    You can do anything • You can do ANYTHING • Customisability vs. ease of use • It is still a JAVA application
  7. ! 13 Some terminology • Job - a unit of

    work for a project • Pipeline • View - user defined collection of jobs or a workflow • Master - the central Jenkins master, does job scheduling • Agent - executes one or more jobs within slots (executors) • Workspace - the working area where a job is carried out
  8. ! 16 Traditional Jenkins Jobs ! " # # !

    # " # Job Config Secret $ $ Code " Jenkins SCM "
  9. ! 17 Traditional Jenkins Jobs • Web UI centric •

    All jobs must be configured manually • Overhead for multiple (smaller) projects • Source code and job must be kept in sync • Chaining multiple jobs becomes messy • Build • Test • Deploy
  10. ! 19 New Jenkins Pipelines • One job per repository

    • Jenkins jobs as code • Jenkinsfile in source code repository • Always in sync with the code • All changes are logged • Written in Groovy • Declarative syntax • Domain Specific Language (DSL) • Extended by Shared Libraries
  11. ! 20 Pipeline Terms • Node - where to run

    a set to stages • Stage - a single stage in a Pipeline • Step - a single task to be executed
  12. ! 21 Jenkinsfile node('any') { stage('Build') { sh 'make' }

    stage('Test') { ... } stage('Deploy') { ... } }
  13. ! 23 Wait for user input node('any') { stage('Build') {

    sh 'make' } stage('Test') { ... } stage('Deploy to test') { ... } input('Ready for production?') stage('Deploy to prod') { ... } }
  14. ! 24 Continuous Delivery (CD) • Delivery = deployment •

    Deploy when all tests pass • Continuous Integration is a requirement • Repeatable • Automated • DevOps / Microservices
  15. ! 25 Principles • Process must be repeatable, reliable •

    Everything needs to be automated • If it hurts; do it more often • Deploy often and smaller changes • Source control everything • Done means released • Build quality in • If you build it; you deploy it