continuous integration - print("hello, world · continuous integration johannes seitz -...

48
Continuous Integration Johannes Seitz - @Ookami86

Upload: others

Post on 11-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

ContinuousIntegration

JohannesSeitz- @Ookami86

Page 2: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

WhatisContinuousIntegration?ThatJenkinsjob may benecessary,butnotsufficient.

Page 3: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Waysofworkinginateam

Integrating often Integrating ina„BigBang“

Allchanges integratedCommitsBranches

Page 4: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Integrating ina„BigBang”e.G.Long-lived feature branching,Some Implementations of“GitFlow“

Pros: Cons:

• Branchhandlingcomplexity• Mergescangetverycomplex• Uncalculable “Stabilisation”phases• Refactoringmaymakeyouunpopular

• Cherry-pickingfeaturesforreleaseiseasy• Individualdeveloperskeepfocussedontheir

branh

Page 5: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

https://martinfowler.com/bliki/FrequencyReducesDifficulty.html

„Ifithurts,doitmoreoften!“

Page 6: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Integrating oftene.G.Trunk-Based Development,Shortlived (1-3days) feature branching

Pros: Cons:

• Cherry-pickingfeaturesforreleaseisharder• Individualteammembersmayfeellessproductive• Storiesneedtobesmallenough

• Mergeconflictsareusuallysmall• Refactorings areeasier• Littletonobranchingoverhead• Thereisnochaoticintegrationphase• Featuresdon’trotinabandonedbranches• Enablescontinuousdelivery

Page 7: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient
Page 8: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Thecontroversy

• https://jamesmckay.net/2011/07/why-does-martin-fowler-not-understand-feature-branches/

• https://continuousdelivery.com/2011/07/on-dvcs-continuous-integration-and-feature-branches/

Taste everything [all advice] but only swallow what tastes right for you. – Virginia Satir, the „Mother“ of Systemic Family Therapy

Page 9: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Techniques fora morefrequentintegration

Page 10: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient
Page 11: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

BigRefactoringsContinuously integrated

Page 12: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient
Page 13: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Don‘trip outtheoldcode(yet)!

https://printhelloworld.de/posts/refactoring-in-baby-steps/

Page 14: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Branch byabstraction

Page 15: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Branch byabstraction

Page 16: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Branch byabstraction

Page 17: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Branch byabstraction

Page 18: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Branch byabstraction

Pros• Compare oldvsnewinProd• Integrating early andoften• Refactorings „enpassant“• Use@Deprecatedor[Obsolete]

Cons• Should beused sparsely• Worksbestwithwhole teamapproaches

Page 19: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

https://printhelloworld.de/posts/refactoring-in-baby-steps/

Babysteps

Page 20: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Unfinished FeaturesContinuously integrated

Page 21: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Featuretoggles (Changes)

Page 22: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Featuretoggles (Newfeatures)

UI

Domain

DB

Page 23: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Featuretoggles

Pros:• Allows canary releases offeatures

• Featuresareintegrated allthetime

• Productisalways shippable• Unfinished features caneasilybetested

Cons:• Toggles become aformoftechdebt unless removed

• Painful todoifyourarchitectureisanonmodular mess

Page 24: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

DBschema changesContinuously integrated

Page 25: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Schemaversioning

ImageSource:https://flywaydb.org/getstarted/how

Page 26: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Schemamigrations

https://martinfowler.com/articles/evodb.html

Page 27: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Schemaversioning &migrations

Pros:• Schemasareversioned• Everyone canchangetheSchemaincrementally

• Schemaisinversion control• Schemaisdocumented

Cons:• Migrations bear arisk• YourDBAmay object• Adding migrations cancauseraceconditions thatneedmanual handling

Page 28: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient
Page 29: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

LibraryChangesContinuously integrated

Page 30: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Versionpinning

Page 31: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Upgradepains:Github

Source:https://githubengineering.com/upgrading-github-from-rails-3-2-to-5-2/

„In total the project took a year and a half to upgrade from Rails 3.2 to Rails 5.2“

„Upgrading Rails on an application as large and as trafficked as GitHub is no small task“

Lessons learned: Upgrade early and upgrade often.

Page 32: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

VersionPinning

• Dependency changes don’tbreakyourbuild

Cons:• Youaremissingoutonfeatures• Youaremissingoutonbugfixes• Securityholes creep in• Theinevitable updatetothelatest version willbeVERYpanful

Pros:

Page 33: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Canarybuilds

Page 34: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

CanaryBuilds

Pros:• Feedbackaboutintegrationpains ahead

• Encourages continuousintegrationwithout breakingthebuild

• Greatforsecuritypatches

Cons:• Twopipelines• Worksbestwithcomprehensivetestsuites

Page 35: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

ServiceChangesContinuously integrated

Page 36: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Consumer-Driven Contracts

ServiceProvider

Consumer

Consumer

Page 37: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Consumer-Driven Contracts

Source:https://docs.pact.io/getting_started

Page 38: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Consumer-Driven Contracts

ServiceProvider

Consumer

Consumer

Page 39: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Consumer-Driven Contracts

Pros:• Producerscantellwhen theybreakcompatibility

• Producerscantellwhichconsumers willbreak

Cons:• Consumers andproducers ofservices needtocollaborate

• APIsneedtoexpose(some)oftheirstateforgoodcontracttests

Page 40: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Thankyouforyourattention!

JohannesSeitz,Blog:printhelloworld.de,Twitter:@Ookami86

Page 41: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient
Page 42: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

BonusSection!

Page 43: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

ServicetestdoublesContinuously tested

Page 44: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

IntegrationContract Tests

ImageSource:https://martinfowler.com/bliki/ContractTest.html

Page 45: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

SharedcodeContinuously integrated

Page 46: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Monorepositories

• KönnengutbenutztwerdenumAbhängigkeitenzwischenSystemensynchronzuhalten.

Page 47: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

BuildbreakingcommitsRejected before theyreach therepo

Page 48: Continuous Integration - print("Hello, World · Continuous Integration Johannes Seitz - @Ookami86. What is Continuous Integration? That Jenkins jobmay be necessary, but not sufficient

Pre-tested commits