SlideShare uma empresa Scribd logo
1 de 46
Baixar para ler offline
RECIPES FOR
CONTINUOUS DELIVERY
Gurpreet Luthra - Lead Consultant, ThoughtWorks
1
_zenx_
TOPICS
2
• Continuous Integration (CI)
• Continuous Deployment (CD?) / Continuous Delivery (CD)
• Phoenix Servers
• Branching for Release
• Feature Branches
• Trunk Based Development
• Pull Request Model
• Toggles
• Branch by Abstraction & Strangulation
3
CONTINUOUS INTEGRATION
3
CONTINUOUS INTEGRATION
https://www.thoughtworks.com/continuous-integration
4
4
https://www.thoughtworks.com/continuous-integration
THE PRACTICES
5
• Maintain a single source repository
• Automate the build
• Make your build self-testing
• Every commit should build on an integration machine
• Keep the build fast
• Test in a clone of the production environment
• Make it easy for anyone to get the latest executable
• Everyone can see what’s happening
• Automate deployment
HOW TO DO IT
6
• Developers check out code into their private workspaces.
• When done, commit the changes to the repository.
• The CI server monitors the repository and checks out
changes when they occur.
• The CI server builds the system and runs unit and
integration tests.
• The CI server releases deployable artefacts for testing.
• The CI server assigns a build label to the version of the
code it just built.
• The CI server informs the team of the successful build.
TEAM RESPONSIBILITIES
7
• Check in frequently
• Don’t check in broken code
• Don’t check in untested code
• Don’t check in when the build is broken
• Don’t go home after checking in until the system builds
THE UNDERLYING ASSUMPTION
8
• The quality and impact of your CI processes are solely
dependant on the quality of your TESTS.
• If you don’t write good quality tests, with reasonable
coverage, all the CI infrastructure in the world can’t
protect you.
THE UNDERLYING ASSUMPTION
8
• The quality and impact of your CI processes are solely
dependant on the quality of your TESTS.
• If you don’t write good quality tests, with reasonable
coverage, all the CI infrastructure in the world can’t
protect you.
WRITE GOOD TESTS!!!
CONTINUOUS DELIVERY
9
Image from: http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment
CONTINUOUS DELIVERY
9
Image from: http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment
PHOENIX SERVERS
10
• Configuration Drift
• Snowflake servers
• No SSH servers
• Immutable Servers
• Phoenix servers
PLEASE READ: http://martinfowler.com/bliki/PhoenixServer.html
and http://martinfowler.com/bliki/ImmutableServer.html
VM (OR CONTAINERS) AS BUILD AGENTS
11
SLIDE COPIED FROM: http://decks.eric.pe/pantheon-ci/#9
BUILD AGENTS AS PHONEIX SERVERS
12
BUILD AGENTS AS PHONEIX SERVERS
13
BUILD AGENTS AS PHONEIX SERVERS
14
PHOENIX SERVERS
15
PHOENIX SERVERS
15
Diagram and full article at: https://boxfuse.com/blog/no-ssh
BRANCHING FOR RELEASE
16
Image from: http://paulhammant.com/blog/branch_by_abstraction.html
BRANCHING FOR RELEASE
17
FOR EACH RELEASE HOW MUCH EFFORT DO YOU PUT
IN TO CREATE CI PIPELINES ?
FEATURES BRANCHES
18
Image from: http://blogs.riskotech.com/riskfactor/post/An-Alternate-Branching-Strategy.aspx
THE REALITY OF FEATURE BRANCHES
19
Image from: http://paulhammant.com/blog/branch_by_abstraction.html
BRANCH TRACKING
20
A GIT BRANCHING MODEL
21
A GIT BRANCHING MODEL
21
Image from: http://nvie.com/posts/a-successful-git-branching-model/
TRUNK BASED DEVELOPMENT
22
• Trunk Based Development (TBD) is where all developers
(for a particular deployable unit) commit to one shared
branch under source-control called “trunk” or “mainline”.
• Branches are made only for a release in the shared
repository.
• Trunk always stays GREEN.
• Developers never break the build with any commit.
Alternatively, broken commits are immediately rolled
back. Or such commits may be blocked before being
merged with the trunk.
• Developers don’t work in ISOLATION, in their “happy
branches” for days. Update your workstation daily!
TRUNK BASED DEVELOPMENT
23
Image from: http://paulhammant.com/2014/01/08/googles-vs-facebooks-trunk-based-development/
PULL REQUEST MODEL
24
master
fork’s master
Fork
branch
feature-1 branch
branch
Raise pull request
Update to latest
Raise pull request
feature-2 branch
review + no mergereview + merge
review + merge
PULL REQUEST MODEL
25
Image from: code.tutsplus.com/tutorials/travis-ci-what-why-how--net-34771
TRUNK BASED DEVELOPMENT
26
Feature branching is a poor man’s modular architecture,
instead of building systems with the ability to easily swap in
and out features at runtime/deploy time, you’re coupling
yourself to the source control providing this mechanism
through manual merging.
- Daniel Bodart
Mentioned By
http://martinfowler.com/bliki/FeatureBranch.html
AND
http://sethgoings.com/feature-branching
TRUNK BASED DEVELOPMENT
27
OK. I WILL TRY & AVOID FEATURE BRANCHES. HOW DO
I ENSURE I CAN DEVELOP BIG FEATURES, YET, KEEP
TRUNK GREEN & STABLE?
FEATURE TOGGLES
28
• Release Toggles
• Business Toggles
• Build Time Toggles
• Run Time Toggles
• A/B Testing
• Canary Releases
• Rollback in production
PLEASE READ
http://martinfowler.com/articles/feature-toggles.html
Pete Hodgson
EXAMPLES
29
• Introduce a simple search box on your home page
• Add a new feature to favorite products + My Favorite page
(client side only, nothing on server side)
• Upgrade from Java7 and Java 8 (slowly across servers)
• Improve your search algo (in case it returns no results, then
apply, distance algo)
• Change upload logic for images (earlier each image was
assigned a thread). New logic: Create a queue, perform a de-
dup, assign to a thread, batch size of 5, upload.
• Add FB Integration (FB Like + Count -- pulled from FB)
• Change JS code to use Require.JS for dependencies
• Introduce dependency injection via Spring/Guice
• Change Repository code from Hibernate to Toplink
IMPLEMENTATION
30
• Simple IF statement (top most layer)
• DB / File / Code based configuration
• Polymorphic Substitution / Injection
• Plugin Based / Dynamic JAR Lookup / Discovery
• Hook based extensions
• Toggle Based Frameworks (Use Google!)
• Many more..
BRANCH BY ABSTRACTION
31
BRANCH BY ABSTRACTION
31
BRANCH BY ABSTRACTION
31
BRANCH BY ABSTRACTION
31
BRANCH BY ABSTRACTION
31
IMAGES AND ARTICLE:
http://martinfowler.com/bliki/BranchByAbstraction.html
BRANCH BY ABSTRACTION
32
• Technique for making large scale changes in a gradual way
• Use an abstraction layer to allow multiple implementations to
co-exist
• Use the notion of one abstraction and multiple
implementations to perform the migration from one
implementation to the other
• Ensure that the system builds and runs correctly at all times
YES. IT’S JUST GOOD OBJECT ORIENTED DESIGN.
STRANGULATION PATTERN
33
• Slowly strangulate one system for another.
• Slow strangulate one model / one component for another.
PLEASE READ
http://agilefromthegroundup.blogspot.in/2011/03/strangulation-pattern-of-choice-for.html
IMAGE FROM:
https://dzone.com/articles/legacy-java-applications
WHERE TO NEXT?
34
• Write good tests. Make them blazing fast. Depend on them!
• Commit & push frequently to Trunk. Build should be ALWAYS
Green.
• Every morning, pull latest code to your machine.
• Consider using Immutable Servers / Phoenix Servers.
• Figure out creative ways to keep software ready-for-release.
• Plan for rollbacks, or for functionality switches.
• Consider strategies like Toggles or Branch-by-Abstraction.
• Don’t work in ISOLATED branches.
• Be thoughtful in your code… and in your design.
WHERE TO NEXT?
34
• Write good tests. Make them blazing fast. Depend on them!
• Commit & push frequently to Trunk. Build should be ALWAYS
Green.
• Every morning, pull latest code to your machine.
• Consider using Immutable Servers / Phoenix Servers.
• Figure out creative ways to keep software ready-for-release.
• Plan for rollbacks, or for functionality switches.
• Consider strategies like Toggles or Branch-by-Abstraction.
• Don’t work in ISOLATED branches.
• Be thoughtful in your code… and in your design.
AIM FOR Continuous Delivery!
THANK YOU
35
Gurpreet Luthra - Lead Consultant, ThoughtWorks
_zenx_
Thank you for all your thoughts on CI & CD by
Martin Fowler, Paul Hammant, Jez Humble, Pete Hodgson, ThoughtWorkers
and
of course Calvin & Hobbes

Mais conteúdo relacionado

Destaque

Continuous integration with jenkins
Continuous integration with jenkinsContinuous integration with jenkins
Continuous integration with jenkins
Pei-Tang Huang
 
Openmrs Use Examples PDF
Openmrs Use Examples PDFOpenmrs Use Examples PDF
Openmrs Use Examples PDF
djazayeri
 
Openmrs Use Examples PPT
Openmrs Use Examples PPTOpenmrs Use Examples PPT
Openmrs Use Examples PPT
djazayeri
 
Bahmni Introduction
Bahmni IntroductionBahmni Introduction
Bahmni Introduction
Vivek Singh
 
Building an OpenMRS Distribution - Lessons from KenyaEMR
Building an OpenMRS Distribution - Lessons from KenyaEMRBuilding an OpenMRS Distribution - Lessons from KenyaEMR
Building an OpenMRS Distribution - Lessons from KenyaEMR
rowanseymour
 
XP In the Real World
XP In the Real WorldXP In the Real World
XP In the Real World
Carlos Lopes
 

Destaque (20)

How Continuous Delivery and Lean Management Make your DevOps Amazeballs
How Continuous Delivery and Lean Management Make your DevOps AmazeballsHow Continuous Delivery and Lean Management Make your DevOps Amazeballs
How Continuous Delivery and Lean Management Make your DevOps Amazeballs
 
Trunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsTrunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and Economics
 
Harnessing The Power of CDNs
Harnessing The Power of CDNsHarnessing The Power of CDNs
Harnessing The Power of CDNs
 
DevOps - Continuous Integration & Continuous Deployment - with Microsoft & Op...
DevOps - Continuous Integration & Continuous Deployment - with Microsoft & Op...DevOps - Continuous Integration & Continuous Deployment - with Microsoft & Op...
DevOps - Continuous Integration & Continuous Deployment - with Microsoft & Op...
 
Git Branching for Agile Teams
Git Branching for Agile Teams Git Branching for Agile Teams
Git Branching for Agile Teams
 
Product management for open source software - Nandini Ravi and Gurpreet Luthra
Product management for open source software - Nandini Ravi and Gurpreet LuthraProduct management for open source software - Nandini Ravi and Gurpreet Luthra
Product management for open source software - Nandini Ravi and Gurpreet Luthra
 
Bahmni Connect
Bahmni ConnectBahmni Connect
Bahmni Connect
 
Continuous integration with jenkins
Continuous integration with jenkinsContinuous integration with jenkins
Continuous integration with jenkins
 
BadAss: Making Search Awesome - Jonti Bolles | SearchHOU
BadAss: Making Search Awesome - Jonti Bolles | SearchHOUBadAss: Making Search Awesome - Jonti Bolles | SearchHOU
BadAss: Making Search Awesome - Jonti Bolles | SearchHOU
 
Openmrs Use Examples PDF
Openmrs Use Examples PDFOpenmrs Use Examples PDF
Openmrs Use Examples PDF
 
Openmrs Use Examples PPT
Openmrs Use Examples PPTOpenmrs Use Examples PPT
Openmrs Use Examples PPT
 
OpenMRS Reference Application, Getting Started
OpenMRS Reference Application, Getting StartedOpenMRS Reference Application, Getting Started
OpenMRS Reference Application, Getting Started
 
Is Trunk-based Development Easy in Game Development?
Is Trunk-based Development Easy in Game Development?Is Trunk-based Development Easy in Game Development?
Is Trunk-based Development Easy in Game Development?
 
Visits in OpenMRS 1.9
Visits in OpenMRS 1.9Visits in OpenMRS 1.9
Visits in OpenMRS 1.9
 
Bahmni Introduction
Bahmni IntroductionBahmni Introduction
Bahmni Introduction
 
Building an OpenMRS Distribution - Lessons from KenyaEMR
Building an OpenMRS Distribution - Lessons from KenyaEMRBuilding an OpenMRS Distribution - Lessons from KenyaEMR
Building an OpenMRS Distribution - Lessons from KenyaEMR
 
Study of OpenMRS
Study of OpenMRSStudy of OpenMRS
Study of OpenMRS
 
Bahmni
BahmniBahmni
Bahmni
 
XP In the Real World
XP In the Real WorldXP In the Real World
XP In the Real World
 
Multiple projects, different goals, one thing in common: the codebase! at Agi...
Multiple projects, different goals, one thing in common: the codebase! at Agi...Multiple projects, different goals, one thing in common: the codebase! at Agi...
Multiple projects, different goals, one thing in common: the codebase! at Agi...
 

Último

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 

Último (20)

OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT  - Elevating Productivity in Today's Agile EnvironmentHarnessing ChatGPT  - Elevating Productivity in Today's Agile Environment
Harnessing ChatGPT - Elevating Productivity in Today's Agile Environment
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

Recipes for Continuous Delivery

  • 1. RECIPES FOR CONTINUOUS DELIVERY Gurpreet Luthra - Lead Consultant, ThoughtWorks 1 _zenx_
  • 2. TOPICS 2 • Continuous Integration (CI) • Continuous Deployment (CD?) / Continuous Delivery (CD) • Phoenix Servers • Branching for Release • Feature Branches • Trunk Based Development • Pull Request Model • Toggles • Branch by Abstraction & Strangulation
  • 5. 4
  • 7. THE PRACTICES 5 • Maintain a single source repository • Automate the build • Make your build self-testing • Every commit should build on an integration machine • Keep the build fast • Test in a clone of the production environment • Make it easy for anyone to get the latest executable • Everyone can see what’s happening • Automate deployment
  • 8. HOW TO DO IT 6 • Developers check out code into their private workspaces. • When done, commit the changes to the repository. • The CI server monitors the repository and checks out changes when they occur. • The CI server builds the system and runs unit and integration tests. • The CI server releases deployable artefacts for testing. • The CI server assigns a build label to the version of the code it just built. • The CI server informs the team of the successful build.
  • 9. TEAM RESPONSIBILITIES 7 • Check in frequently • Don’t check in broken code • Don’t check in untested code • Don’t check in when the build is broken • Don’t go home after checking in until the system builds
  • 10. THE UNDERLYING ASSUMPTION 8 • The quality and impact of your CI processes are solely dependant on the quality of your TESTS. • If you don’t write good quality tests, with reasonable coverage, all the CI infrastructure in the world can’t protect you.
  • 11. THE UNDERLYING ASSUMPTION 8 • The quality and impact of your CI processes are solely dependant on the quality of your TESTS. • If you don’t write good quality tests, with reasonable coverage, all the CI infrastructure in the world can’t protect you. WRITE GOOD TESTS!!!
  • 12. CONTINUOUS DELIVERY 9 Image from: http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment
  • 13. CONTINUOUS DELIVERY 9 Image from: http://blog.crisp.se/2013/02/05/yassalsundman/continuous-delivery-vs-continuous-deployment
  • 14. PHOENIX SERVERS 10 • Configuration Drift • Snowflake servers • No SSH servers • Immutable Servers • Phoenix servers PLEASE READ: http://martinfowler.com/bliki/PhoenixServer.html and http://martinfowler.com/bliki/ImmutableServer.html
  • 15. VM (OR CONTAINERS) AS BUILD AGENTS 11 SLIDE COPIED FROM: http://decks.eric.pe/pantheon-ci/#9
  • 16. BUILD AGENTS AS PHONEIX SERVERS 12
  • 17. BUILD AGENTS AS PHONEIX SERVERS 13
  • 18. BUILD AGENTS AS PHONEIX SERVERS 14
  • 20. PHOENIX SERVERS 15 Diagram and full article at: https://boxfuse.com/blog/no-ssh
  • 21. BRANCHING FOR RELEASE 16 Image from: http://paulhammant.com/blog/branch_by_abstraction.html
  • 22. BRANCHING FOR RELEASE 17 FOR EACH RELEASE HOW MUCH EFFORT DO YOU PUT IN TO CREATE CI PIPELINES ?
  • 23. FEATURES BRANCHES 18 Image from: http://blogs.riskotech.com/riskfactor/post/An-Alternate-Branching-Strategy.aspx
  • 24. THE REALITY OF FEATURE BRANCHES 19 Image from: http://paulhammant.com/blog/branch_by_abstraction.html
  • 26. A GIT BRANCHING MODEL 21
  • 27. A GIT BRANCHING MODEL 21 Image from: http://nvie.com/posts/a-successful-git-branching-model/
  • 28. TRUNK BASED DEVELOPMENT 22 • Trunk Based Development (TBD) is where all developers (for a particular deployable unit) commit to one shared branch under source-control called “trunk” or “mainline”. • Branches are made only for a release in the shared repository. • Trunk always stays GREEN. • Developers never break the build with any commit. Alternatively, broken commits are immediately rolled back. Or such commits may be blocked before being merged with the trunk. • Developers don’t work in ISOLATION, in their “happy branches” for days. Update your workstation daily!
  • 29. TRUNK BASED DEVELOPMENT 23 Image from: http://paulhammant.com/2014/01/08/googles-vs-facebooks-trunk-based-development/
  • 30. PULL REQUEST MODEL 24 master fork’s master Fork branch feature-1 branch branch Raise pull request Update to latest Raise pull request feature-2 branch review + no mergereview + merge review + merge
  • 31. PULL REQUEST MODEL 25 Image from: code.tutsplus.com/tutorials/travis-ci-what-why-how--net-34771
  • 32. TRUNK BASED DEVELOPMENT 26 Feature branching is a poor man’s modular architecture, instead of building systems with the ability to easily swap in and out features at runtime/deploy time, you’re coupling yourself to the source control providing this mechanism through manual merging. - Daniel Bodart Mentioned By http://martinfowler.com/bliki/FeatureBranch.html AND http://sethgoings.com/feature-branching
  • 33. TRUNK BASED DEVELOPMENT 27 OK. I WILL TRY & AVOID FEATURE BRANCHES. HOW DO I ENSURE I CAN DEVELOP BIG FEATURES, YET, KEEP TRUNK GREEN & STABLE?
  • 34. FEATURE TOGGLES 28 • Release Toggles • Business Toggles • Build Time Toggles • Run Time Toggles • A/B Testing • Canary Releases • Rollback in production PLEASE READ http://martinfowler.com/articles/feature-toggles.html Pete Hodgson
  • 35. EXAMPLES 29 • Introduce a simple search box on your home page • Add a new feature to favorite products + My Favorite page (client side only, nothing on server side) • Upgrade from Java7 and Java 8 (slowly across servers) • Improve your search algo (in case it returns no results, then apply, distance algo) • Change upload logic for images (earlier each image was assigned a thread). New logic: Create a queue, perform a de- dup, assign to a thread, batch size of 5, upload. • Add FB Integration (FB Like + Count -- pulled from FB) • Change JS code to use Require.JS for dependencies • Introduce dependency injection via Spring/Guice • Change Repository code from Hibernate to Toplink
  • 36. IMPLEMENTATION 30 • Simple IF statement (top most layer) • DB / File / Code based configuration • Polymorphic Substitution / Injection • Plugin Based / Dynamic JAR Lookup / Discovery • Hook based extensions • Toggle Based Frameworks (Use Google!) • Many more..
  • 41. BRANCH BY ABSTRACTION 31 IMAGES AND ARTICLE: http://martinfowler.com/bliki/BranchByAbstraction.html
  • 42. BRANCH BY ABSTRACTION 32 • Technique for making large scale changes in a gradual way • Use an abstraction layer to allow multiple implementations to co-exist • Use the notion of one abstraction and multiple implementations to perform the migration from one implementation to the other • Ensure that the system builds and runs correctly at all times YES. IT’S JUST GOOD OBJECT ORIENTED DESIGN.
  • 43. STRANGULATION PATTERN 33 • Slowly strangulate one system for another. • Slow strangulate one model / one component for another. PLEASE READ http://agilefromthegroundup.blogspot.in/2011/03/strangulation-pattern-of-choice-for.html IMAGE FROM: https://dzone.com/articles/legacy-java-applications
  • 44. WHERE TO NEXT? 34 • Write good tests. Make them blazing fast. Depend on them! • Commit & push frequently to Trunk. Build should be ALWAYS Green. • Every morning, pull latest code to your machine. • Consider using Immutable Servers / Phoenix Servers. • Figure out creative ways to keep software ready-for-release. • Plan for rollbacks, or for functionality switches. • Consider strategies like Toggles or Branch-by-Abstraction. • Don’t work in ISOLATED branches. • Be thoughtful in your code… and in your design.
  • 45. WHERE TO NEXT? 34 • Write good tests. Make them blazing fast. Depend on them! • Commit & push frequently to Trunk. Build should be ALWAYS Green. • Every morning, pull latest code to your machine. • Consider using Immutable Servers / Phoenix Servers. • Figure out creative ways to keep software ready-for-release. • Plan for rollbacks, or for functionality switches. • Consider strategies like Toggles or Branch-by-Abstraction. • Don’t work in ISOLATED branches. • Be thoughtful in your code… and in your design. AIM FOR Continuous Delivery!
  • 46. THANK YOU 35 Gurpreet Luthra - Lead Consultant, ThoughtWorks _zenx_ Thank you for all your thoughts on CI & CD by Martin Fowler, Paul Hammant, Jez Humble, Pete Hodgson, ThoughtWorkers and of course Calvin & Hobbes