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

Post on 11-Jul-2020

0 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

ContinuousIntegration

JohannesSeitz- @Ookami86

WhatisContinuousIntegration?ThatJenkinsjob may benecessary,butnotsufficient.

Waysofworkinginateam

Integrating often Integrating ina„BigBang“

Allchanges integratedCommitsBranches

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

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

„Ifithurts,doitmoreoften!“

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

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

Techniques fora morefrequentintegration

BigRefactoringsContinuously integrated

Don‘trip outtheoldcode(yet)!

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

Branch byabstraction

Branch byabstraction

Branch byabstraction

Branch byabstraction

Branch byabstraction

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

Cons• Should beused sparsely• Worksbestwithwhole teamapproaches

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

Babysteps

Unfinished FeaturesContinuously integrated

Featuretoggles (Changes)

Featuretoggles (Newfeatures)

UI

Domain

DB

Featuretoggles

Pros:• Allows canary releases offeatures

• Featuresareintegrated allthetime

• Productisalways shippable• Unfinished features caneasilybetested

Cons:• Toggles become aformoftechdebt unless removed

• Painful todoifyourarchitectureisanonmodular mess

DBschema changesContinuously integrated

Schemaversioning

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

Schemamigrations

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

Schemaversioning &migrations

Pros:• Schemasareversioned• Everyone canchangetheSchemaincrementally

• Schemaisinversion control• Schemaisdocumented

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

LibraryChangesContinuously integrated

Versionpinning

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.

VersionPinning

• Dependency changes don’tbreakyourbuild

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

Pros:

Canarybuilds

CanaryBuilds

Pros:• Feedbackaboutintegrationpains ahead

• Encourages continuousintegrationwithout breakingthebuild

• Greatforsecuritypatches

Cons:• Twopipelines• Worksbestwithcomprehensivetestsuites

ServiceChangesContinuously integrated

Consumer-Driven Contracts

ServiceProvider

Consumer

Consumer

Consumer-Driven Contracts

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

Consumer-Driven Contracts

ServiceProvider

Consumer

Consumer

Consumer-Driven Contracts

Pros:• Producerscantellwhen theybreakcompatibility

• Producerscantellwhichconsumers willbreak

Cons:• Consumers andproducers ofservices needtocollaborate

• APIsneedtoexpose(some)oftheirstateforgoodcontracttests

Thankyouforyourattention!

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

BonusSection!

ServicetestdoublesContinuously tested

IntegrationContract Tests

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

SharedcodeContinuously integrated

Monorepositories

• KönnengutbenutztwerdenumAbhängigkeitenzwischenSystemensynchronzuhalten.

BuildbreakingcommitsRejected before theyreach therepo

Pre-tested commits

top related