Slide 1

Slide 1 text

pipeline as code Jenkins Pipeline dkd Internet Service GmbH TYPO3 Developer Days 2017 1

Slide 2

Slide 2 text

2 agenda

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

4 who`s that guy?

Slide 5

Slide 5 text

Peter Foerger • DevOps Engineer • dkd Internet Service GmbH • TCCI • TCCD • @bauschan 5

Slide 6

Slide 6 text

introduction 6

Slide 7

Slide 7 text

why a CI server? 7

Slide 8

Slide 8 text

continuous integration 8

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

continuous delivery 11

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

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

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

continuous delivery pipeline 16

Slide 17

Slide 17 text

CD !== CD 17

Slide 18

Slide 18 text

Jenkins intro 18 master • stateful • management of jobs, credentials, ... • plugins (always run on master) slaves • actually run the jobs • stateless

Slide 19

Slide 19 text

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/

Slide 20

Slide 20 text

new in jenkins 2 • drop-in upgrade • three major changes • better out-of-the-box experience • revamped UI • pipeline as code 20

Slide 21

Slide 21 text

21 pipelines

Slide 22

Slide 22 text

why should we use pipelines? • developer experience • self contained • fully automated and documented • reusable • durable • pausable • extensible 22

Slide 23

Slide 23 text

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

Slide 24

Slide 24 text

usage • directly in UI • Jenkinsfile 24

Slide 25

Slide 25 text

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

Slide 26

Slide 26 text

declarative pipeline { agent any stages { stage('Build') { steps { echo 'Building...' } } } 26

Slide 27

Slide 27 text

scripted node { stage('Build') { echo 'Building...' } } 27

Slide 28

Slide 28 text

28 development tools

Slide 29

Slide 29 text

tools • Blue Ocean editor • command-line pipeline linter • “Replay” feature • Pipeline Unit Testing Framework (3rd Party) 29

Slide 30

Slide 30 text

30 demo time

Slide 31

Slide 31 text

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

Slide 32

Slide 32 text

show case – Blue Ocean 32

Slide 33

Slide 33 text

show case – classic • first steps • string interpolation • environment • build parameters • tools • artifact archival • stages 33

Slide 34

Slide 34 text

first steps 34

Slide 35

Slide 35 text

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

Slide 36

Slide 36 text

string interpolation 36

Slide 37

Slide 37 text

environment variables 37

Slide 38

Slide 38 text

build parameters 38

Slide 39

Slide 39 text

tools • maven • jdk • gradle 39

Slide 40

Slide 40 text

tools 40

Slide 41

Slide 41 text

artefact archival 41

Slide 42

Slide 42 text

stages 42

Slide 43

Slide 43 text

dkd sagt Danke 43