Top Banner
38

Continuous Delivery @ Codemotion

Apr 15, 2017

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Continuous Delivery @ Codemotion
Page 2: Continuous Delivery @ Codemotion

Scaling up CI to a CD Pipeline

BUILD TEST DEPLOY

Page 3: Continuous Delivery @ Codemotion

➔ Social Casino Startup

➔ Web and Mobile

➔ 250K DAU

➔ ~20 Technical Staff

➔ No QA

@Plumbee_Gameshttp://www.plumbee.com

Engineering Manager at Plumbee Ltd@[email protected]

Page 4: Continuous Delivery @ Codemotion

Scaling up CI to a CD Pipeline

BUILD TEST DEPLOY

Page 5: Continuous Delivery @ Codemotion

Mission + People

BUILD TEST DEPLOY

Any organisation’s pipeline is shaped by:

● The requirements to achieve its mission

● The views of the team on Software Development

Page 6: Continuous Delivery @ Codemotion

Decisions

● Tools

● Test Strategy

● Frequency on deployment

● On-call strategy

BUILD TEST DEPLOY

Page 7: Continuous Delivery @ Codemotion

it’s all about building an

Engineering Culture

BUILD TEST DEPLOY

Page 8: Continuous Delivery @ Codemotion

Trunk vs Branching

Page 9: Continuous Delivery @ Codemotion

Trunk vs Branching

● Fast ● Safe

Page 10: Continuous Delivery @ Codemotion

Trunk vs Branching

● Fast

● Minimises merge pain

● Safe

● Asynchronous

Page 11: Continuous Delivery @ Codemotion

Trunk vs Branching

● Fast

● Minimises merge pain

● Old Fashioned

● Safe

● Asynchronous

● Git is cool!

Page 12: Continuous Delivery @ Codemotion

Trunk

“The most direct way to improve as a software developer is to be absolutely fearless when it comes to changing your code”

Jeff AtwoodStack Exchange/Discourse founder

Page 13: Continuous Delivery @ Codemotion

Trunk

“Don’t be scared of changing your code. Pave your way to not to break things”

Miguel SerranoThe guy talking right now

Page 14: Continuous Delivery @ Codemotion

Versioning

JAR1.0-SNAPSHOT

WAR1.4-SNAPSHOT

JAR1.4-SNAPSHOT

Page 15: Continuous Delivery @ Codemotion

JAR1.0-SNAPSHOT

WAR1.4-SNAPSHOT

JAR1.4-SNAPSHOT

Versioning

Nondeterministic!

The exact sequence of builds is not reproducible

Page 16: Continuous Delivery @ Codemotion

JAR1.0-SNAPSHOT

WAR1.4-SNAPSHOT

JAR1.4-SNAPSHOT

Versioning

Releases require:

● Update snapshots to static version number

● Ensure there are no snapshot dependencies

● Code freeze while releasing

● Manual updates

JAR1.0

WAR1.4

JAR1.4

Page 17: Continuous Delivery @ Codemotion

JAR1.0-SNAPSHOT

WAR1.4-SNAPSHOT

JAR1.4-SNAPSHOT

Versioning

Releases require:

● Update snapshots to a static number

● Ensure there are no snapshot dependencies

● Code freeze while releasing

● Manual updates

} mvn release:prepare

mvn release:perform

JAR1.0

WAR1.4

JAR1.4

Page 18: Continuous Delivery @ Codemotion

Versioning

Rules

● Every artifact is assigned a new version at build time

● Every artifact gets its dependencies versions updated to the latest version in every build

● Every artifact is ready to be deployed

JAR1.0

WAR1.4

JAR1.4

Page 19: Continuous Delivery @ Codemotion

JAR1.0-SNAPSHOT

WAR1.4-SNAPSHOT

JAR1.4-SNAPSHOT

Versioning

Page 20: Continuous Delivery @ Codemotion

JAR

JAR

JAR

JAR

JAR

WAR

Test

DEPLOY

JAR

JAR WAR DEPLOY

Page 21: Continuous Delivery @ Codemotion

JAR

JAR

JAR

JAR

JAR

WAR

Test

DEPLOY

JAR

JAR WAR DEPLOY

Actual Pipeline ~= 154 builds

Page 22: Continuous Delivery @ Codemotion

Pipeline Graph

C

E

D

A

StagingTestB

A developer makes a change in module A

Page 23: Continuous Delivery @ Codemotion

Pipeline Graph

B

C

E

D

A

StagingTest

Page 24: Continuous Delivery @ Codemotion

Pipeline Graph

B

C

E

D

A

StagingTest

Page 25: Continuous Delivery @ Codemotion

Pipeline Graph

B

C

E

D

A

StagingTest

#1

#2

Page 26: Continuous Delivery @ Codemotion

Pipeline Graph

B

C

E

D

A

StagingTest

x2

x3 x3

● 7 Modules, 12 Builds● 1 changeset triggers 3 deploys

#Builds(n) = #UniquePaths(A->n)

Page 27: Continuous Delivery @ Codemotion

Build Explosion!

#Builds grow exponentially when the graph grows

...but computing power is cheap (linux)

Page 28: Continuous Delivery @ Codemotion

Build Explosion!

#Builds grow exponentially when the graph grows

...but computing power is cheap (linux)

Option: ignore intermediate results

… while wasting resources

Test

#1

#2

#3the only one with changeset applied to all nodes

Page 29: Continuous Delivery @ Codemotion

#Builds

B

C

D

C

A

WAR Test

● Join: Build doesn’t start until all the previous one have succeeded

● #Build = #Modules● Test runs once per changeset

Page 30: Continuous Delivery @ Codemotion

Smart pipelines in Jenkins

● Build Flow Plugin○ https://github.com/jenkinsci/build-flow-plugin

● Workflow Plugin○ https://github.com/jenkinsci/workflow-plugin

Page 31: Continuous Delivery @ Codemotion

Build Flow Plugin

join = parallel ({

build(“B”)

build(“C”),

})

build(“D”, param1 : join )

B

C

D

Page 32: Continuous Delivery @ Codemotion

BUILD TEST STAGING PRODUCTION

EngineeringBusiness+ Engineering

Continuous Delivery

BUILD TEST DEPLOY

Page 33: Continuous Delivery @ Codemotion

STAGING PRODUCTION

Continuous Delivery

Schema Update

IT Provisioning

Config updates

Roll out

Non-Technical

Page 34: Continuous Delivery @ Codemotion

BUILD TEST STAGING PRODUCTION

Continuous Delivery

BUILD TEST PRODUCTION

Continuous Deployment

Page 35: Continuous Delivery @ Codemotion

BUILD TEST PRODUCTION DEPLOY RELEASE

Release and Deploy are decoupled

● Changes in Production are incremental -> Less risky

● Bug Fixes are the sole responsibility of the Engineers

Engineering Business

Continuous Deployment

Page 36: Continuous Delivery @ Codemotion

BUILD TEST PRODUCTIONDEPLOY RELEASE

Feature Toggles allow decoupling Release from Deployment

Also helpful for:● Canary Releases (release features to subset of users)● A/B Tests

Engineering Business

Continuous Deployment

Page 37: Continuous Delivery @ Codemotion

BUILD TEST PRODUCTION

Continuous Deployment

Limitations:

➔ Legal & Regulatory➔ Distribution (App Stores!)➔ Not suitable for critical software

Page 38: Continuous Delivery @ Codemotion

Q&A