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

Pipeline as Code

Pipeline as Code

Introduction to the benefits which come with Jenkins 2 like Jenkinsfile and the workflow stage view plugin. #T3DD17

Peter Foerger

July 14, 2017
Tweet

More Decks by Peter Foerger

Other Decks in Technology

Transcript

  1. agenda • introduction into Jenkins (Pipeline) • Jenkins basic information

    • scaling a build infrastructure • pipelines • why should we use pipelines • pipeline advantages • syntax • best practises • demo 3
  2. 9 »Continuous Integration doesn’t get rid of bugs, but it

    does make them dramatically easier to find and remove.« Martin Fowler, Chief Scientist, ThoughtWorks
  3. continuous integration 10 • code in scm • check-in and

    push at least daily • automated compiling, testing, integrating and building • reporting and code analysis • deploy to integration environment
  4. 12 »continuous delivery is the ability to get changes of

    all types–including new features, configuration changes, bug fixes and experiments–into production, or into the hands of users, safely and quickly in a sustainable way.« Jez Humble, continuousdelivery.com
  5. 13 »continuous delivery is the ability to get changes of

    all types–including new features, configuration changes, bug fixes and experiments–into production, or into the hands of users, safely and quickly in a sustainable way.« Jez Humble, continuousdelivery.com
  6. 14 »continuous delivery is the ability to get changes of

    all types–including new features, configuration changes, bug fixes and experiments–into production, or into the hands of users, safely and quickly in a sustainable way.« Jez Humble, continuousdelivery.com
  7. 15 »continuous delivery is the ability to get changes of

    all types–including new features, configuration changes, bug fixes and experiments–into production, or into the hands of users, safely and quickly in a sustainable way.« Jez Humble, continuousdelivery.com
  8. Jenkins intro 18 master • stateful • management of jobs,

    credentials, ... • plugins (always run on master) slaves • actually run the jobs • stateless
  9. scaling a build infrastructure 19 jobs = number of developers

    * 3.333 masters = number of jobs/500 executors = number of jobs * 0.03 Source: https://jenkins.io/doc/book/architecting-for-scale/
  10. new in jenkins 2 • drop-in upgrade • three major

    changes • better out-of-the-box experience • revamped UI • pipeline as code 20
  11. why should we use pipelines? • developer experience • self

    contained • fully automated and documented • reusable • durable • pausable • extensible 22
  12. advantages • can be reviewed, forked, iterated upon and audited

    • running pipelines survive master restart • can stop and wait for human input • support complex CI/CD requirements • DSL can be extended through shared libraries 23
  13. declarative vs. scripted • declarative: validation => better error reporting

    • declarative: better GUI support (Blue Ocean) • scripted: rapid prototyping • scripted: nearly full power of Groovy (good and bad) 25
  14. tools • Blue Ocean editor • command-line pipeline linter •

    “Replay” feature • Pipeline Unit Testing Framework (3rd Party) 29
  15. show case – Blue Ocean • sophisticated visualizations of continuous

    delivery (CD) Pipelines, allowing for fast and intuitive comprehension of pipeline’s status.
 • pipeline editor makes creation of Pipelines approachable by guiding the user through an intuitive and visual process to create a Pipeline.
 • personalization to suit the role-based needs of each member of the team.
 • pinpoint precision when intervention is needed and/or issues arise. Blue Ocean shows where in the pipeline attention is needed
 • native integration for branch and pull requests enables maximum developer productivity when collaborating on code with others in GitHub and Bitbucket.
 31
  16. show case – classic • first steps • string interpolation

    • environment • build parameters • tools • artifact archival • stages 33
  17. string interpolation def singleQuoted = 'Jenkins' def doubleQuoted = "Pipeline"

    def trippleSingleQuoted = '''dkd''' def trippleDoubleQuoted = “""dkd""" 35 only the double quoted strings support string interpolation