Continously delivering

102
James Cowie Senior Magento Engineer @ Magento Magento 2016 Master Continuously delivering

Transcript of Continously delivering

Page 1: Continously delivering

James CowieSenior Magento Engineer @ MagentoMagento 2016 Master

Continuously delivering

Page 2: Continously delivering

Continuous Integration

Page 3: Continously delivering

Say goodbye to long and tense integrationsIncrease visibility which enables greater communicationCatch issues fast and nip them in the budProceed in the confidence you’re building on a solid foundationReduce integration problems allowing delivery of software more rapidly

Benefits

Page 4: Continously delivering
Page 5: Continously delivering

Continuous Delivery / Deployment

Page 6: Continously delivering

short cyclesSprints

reliably releasedWorking software over comprehensive documentation

faster .. FrequentlyResponding to change over following a plan

Page 7: Continously delivering

Accelerated Time to MarketBuilding the Right ProductImproved Productivity and EfficiencyReliable ReleasesImproved Product QualityImproved Customer Satisfaction

Benefits

Page 8: Continously delivering

Code done Unit Tests Integrate Acceptance Tests

Deploy toproduction

Code done Unit Tests Integrate Acceptance Tests

Deploy toproduction

Manual

Continuous Delivery

Continuous Deployment

Auto

Author
Get better image
Page 9: Continously delivering

Development process so far.

Page 10: Continously delivering

Pipeline Servers

Page 11: Continously delivering

QA

Page 12: Continously delivering

QA UAT

Page 13: Continously delivering

QA UAT Live

Page 14: Continously delivering

QA UAT Live

Page 15: Continously delivering

QA UAT Live

RELEASE

Page 16: Continously delivering

QA UAT Live

RELEASE RELEASE

Page 17: Continously delivering

QA UAT Live

RELEASE RELEASE

Page 18: Continously delivering

QA UAT Live

RELEASE RELEASE

Page 19: Continously delivering

What is time ?

Page 20: Continously delivering

https://en.wikipedia.org/wiki/Scrum_(software_development)

Page 21: Continously delivering

QA UAT Live

RELEASE RELEASE

2 Weeks ?

Page 22: Continously delivering

How does this look in source control

Page 23: Continously delivering

QA UAT Live

DevelopRelease Candidate

Master

Page 24: Continously delivering

QA UAT Live

DevelopRelease Candidate

Master

Page 25: Continously delivering
Page 26: Continously delivering

DevelopRelease Candidate

Master

Page 27: Continously delivering
Page 28: Continously delivering

Increased Time to deploy

Page 29: Continously delivering

What did I want improved ?

Page 30: Continously delivering

FeedbackFeedback Feedback

Page 31: Continously delivering

Time started

Time Feedback

given = Feedback time

Page 32: Continously delivering

Cognitive load & Human retentionProject flowValidation

Feedback Time

Page 33: Continously delivering

Feedback from who ?

QA Team

Team Lead StakeholderReal User

Page 34: Continously delivering

WhyInternal Feedback External Feedback

Page 35: Continously delivering

WhyInternal Feedback

Code analysis

Acceptance Criteria

Exploratory Testing

Regression Testing

Page 36: Continously delivering

WhyExternal Feedback

Are people using this feature?

How are people using this feature?

Is this feature solving a problem?

How does it look?

Page 37: Continously delivering

QA UAT

2 weeks

Page 38: Continously delivering

UAT LIVE

2 weeks

Page 39: Continously delivering

What options did I see?

Page 40: Continously delivering

Feature Branches

Page 41: Continously delivering
Page 42: Continously delivering

Always deployable Feature completeTests

The rules of feature branching

Page 43: Continously delivering

feature.project.pipeline.com

feature2.project.pipeline.com

Mainline Release V1

Live

QA.project.pipeline.com

Page 44: Continously delivering

Manual processFeature branch rot

Disadvantages

AdvantagesNo reverse mergingClear to see features

Page 45: Continously delivering
Page 46: Continously delivering

Disable / EnableLogical switch

What are feature toggles ?

Page 47: Continously delivering

Mainline Live

Feature toggle disabled

Feature toggle disabled

Page 48: Continously delivering
Page 49: Continously delivering

//$MyNewFeature->run();

Super simple toggle ( git commit –m ”Disable/Enable feature X”

Page 50: Continously delivering

<?php…if ($someFeature)->isEnabled() {…..}…

Page 51: Continously delivering

Packages

Page 52: Continously delivering

Meet “Qandidate\Toggle”

Page 53: Continously delivering

<?php// Create the ToggleManager$manager = new ToggleManager(new InMemoryCollection());

// A toggle that will be active when the user id is less than 42$operator = new LessThan(42);$condition = new OperatorCondition('user_id', $operator);$toggle = new Toggle('toggling', array($condition));

// Add the toggle to the manager$manager->add($toggle);

// Create and check a new context for a user with id 42$context = new Context();$context->set('user_id', 42);var_dump($manager->active('toggling', $context)); // false

Page 54: Continously delivering

<?php// Create the ToggleManager$manager = new ToggleManager(new InMemoryCollection());

// A toggle that will be active when the user id is less than 42$operator = new LessThan(42);$condition = new OperatorCondition('user_id', $operator);$toggle = new Toggle('toggling', array($condition));

// Add the toggle to the manager$manager->add($toggle);

// Create and check a new context for a user with id 42$context = new Context();$context->set('user_id', 42);var_dump($manager->active('toggling', $context)); // false

Page 55: Continously delivering

<?php// Create the ToggleManager$manager = new ToggleManager(new InMemoryCollection());

// A toggle that will be active when the user id is less than 42$operator = new LessThan(42);$condition = new OperatorCondition('user_id', $operator);$toggle = new Toggle('toggling', array($condition));

// Add the toggle to the manager$manager->add($toggle);

// Create and check a new context for a user with id 42$context = new Context();$context->set('user_id', 42);var_dump($manager->active('toggling', $context)); // false

Page 56: Continously delivering

<?php// Create the ToggleManager$manager = new ToggleManager(new InMemoryCollection());

// A toggle that will be active when the user id is less than 42$operator = new LessThan(42);$condition = new OperatorCondition('user_id', $operator);$toggle = new Toggle('toggling', array($condition));

// Add the toggle to the manager$manager->add($toggle);

// Create and check a new context for a user with id 42$context = new Context();$context->set('user_id', 42);var_dump($manager->active('toggling', $context)); // false

Page 57: Continously delivering

Adding toggles ?

Page 58: Continously delivering

$ curl -XPUT 127.0.0.1:8000/toggles/search_beta -d '{ "name" : "search_beta", "status" : "conditionally-active", "conditions" : [ { "name" : "operator-condition", "key" : "user_id", "operator" : { "name" : "in-set", "values" : [42, 1337] } } ]}'

Page 59: Continously delivering

https://github.com/qandidate-labs/qandidate-toggle-ui

Page 60: Continously delivering

Services

Page 61: Continously delivering

Feature toggle dashboardMany rules for togglesStatistics

Page 62: Continously delivering

Technical DebtExtra code and configurationJS / CSS ?

Disadvantages

Page 63: Continously delivering

Deploy all the thingsA-B TestingEasy revert Client engagement in deploy

Benefits

Page 64: Continously delivering

End to end workflow

Page 65: Continously delivering

PHPMDPHPLintPHPCPDPHPUnit

Page 66: Continously delivering

Peer review

Page 67: Continously delivering

Build release candidate

Page 68: Continously delivering

Static code analysis

Page 69: Continously delivering

Deploy to first pipeline

Page 70: Continously delivering

Testing

Page 71: Continously delivering

Go live

Page 72: Continously delivering

My proposed workflow

Page 73: Continously delivering

Plan

Code

Build

TestDeploy

Page 74: Continously delivering

BDDUser StoriesBusiness ValueExample WorkshopsFeature TogglesFeature BranchesTDD

Our solution

Page 75: Continously delivering

Starts the conversationValueIntentThe Why!

BDD ( Behaviour Driven Development )

Page 76: Continously delivering

Becomes Acceptance CriteriaThought about scenarios Validation of the work

User Stories

Page 77: Continously delivering

What value does this story have.What does it impact How measurable is the story

Business Value

Page 78: Continously delivering

Final chance to “pull a story” Understanding Readiness for development

Example Workshop

Page 79: Continously delivering

Feature Toggles

Page 80: Continously delivering

feature/PROJ-NumberDelete once passed reviewShort lived

Feature Branches

Page 81: Continously delivering

No feature without • Behat• PHPSpec• * Some PHPUnit for M2 *

TDD ( Test Driven Development )

Page 82: Continously delivering

How?

Page 83: Continously delivering

Github + Git

Page 84: Continously delivering
Page 85: Continously delivering

Sysconfig for toggleHelper module for validation

Magento 2

Page 86: Continously delivering

Static AnalysisRunning of testsDeployment mechanism

Scrutinizer

Page 87: Continously delivering
Page 88: Continously delivering

Deploying ?

Page 89: Continously delivering
Page 90: Continously delivering

deployment: - branch: develop commands: - { command: '(cap qa deploy)', idle_timeout: 600 } - branch: master commands: - sudo apt-get install -y sshpass - { command: '(cap uat deploy)', idle_timeout: 600 } - branch: release/* commands: - sudo apt-get install -y sshpass - { command: '(cap prod deploy)', idle_timeout: 600 }

Page 91: Continously delivering

State

Page 92: Continously delivering

Every change needs a scriptMigrationsMagento setup scripts.

Page 93: Continously delivering

Every environments needs a config

Page 94: Continously delivering

Environment variablesEnvironment config files

Page 95: Continously delivering

Other services and platforms

Page 96: Continously delivering

Many More..

Page 97: Continously delivering

Further reading

Page 98: Continously delivering
Page 99: Continously delivering
Page 100: Continously delivering
Page 101: Continously delivering
Page 102: Continously delivering

Q and A

@jcowieJamescowie (github)