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

Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

James Cowie

Senior Magento Engineer @ Magento

Magento 2016 Master

Continuously delivering

Page 2: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Continuous Integration

Page 3: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

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: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 5: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Continuous Delivery / Deployment

Page 6: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

short cyclesSprints

reliably releasedWorking software over comprehensive documentation

faster .. FrequentlyResponding to change over following a plan

Page 7: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

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

Benefits

Page 8: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Code done Unit Tests IntegrateAcceptance Tests

Deploy toproduction

Code done Unit Tests IntegrateAcceptance Tests

Deploy toproduction

Manual

Continuous Delivery

Continuous Deployment

Auto

Page 9: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Development process so far.

Page 10: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Pipeline Servers

Page 11: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA

Page 12: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT

Page 13: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT Live

Page 14: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT Live

Page 15: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT Live

RELEASE

Page 16: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT Live

RELEASE RELEASE

Page 17: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT Live

RELEASE RELEASE

Page 18: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT Live

RELEASE RELEASE

Page 19: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

What is time ?

Page 20: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

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

Page 21: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT Live

RELEASE RELEASE

2 Weeks ?

Page 22: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

How does this look in source control

Page 23: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT Live

Develop

Release Candidate

Master

Page 24: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT Live

Develop

Release Candidate

Master

Page 25: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 26: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Develop

Release Candidate

Master

Page 27: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 28: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Increased Time to deploy

Page 29: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

What did I want improved ?

Page 30: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

FeedbackFeedback Feedback

Page 31: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Time started

Time Feedback

given = Feedback time

Page 32: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Cognitive load & Human retention

Project flow

Validation

Feedback Time

Page 33: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Feedback from who ?

QA Team

Team Lead StakeholderReal User

Page 34: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

WhyInternal Feedback External Feedback

Page 35: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Why

Internal Feedback

Code analysis

Acceptance Criteria

Exploratory Testing

Regression Testing

Page 36: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Why

External Feedback

Are people using this feature?

How are people using this feature?

Is this feature solving a problem?

How does it look?

Page 37: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

QA UAT

2 weeks

Page 38: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

UAT LIVE

2 weeks

Page 39: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

What options did I see?

Page 40: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Feature Branches

Page 41: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 42: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Always deployable Feature completeTests

The rules of feature branching

Page 43: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

feature.project.pipeline.com

feature2.project.pipeline.com

Mainline Release V1

Live

QA.project.pipeline.com

Page 44: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Manual process

Feature branch rot

Disadvantages Advantages

No reverse merging

Clear to see features

Page 45: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 46: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Disable / Enable

Logical switch

What are feature toggles ?

Page 47: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Mainline Live

Feature toggle disabled

Feature toggle disabled

Page 48: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 49: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

//$MyNewFeature->run();

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

Page 50: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

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

Page 51: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Packages

Page 52: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Meet “Qandidate\Toggle”

Page 53: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

<?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: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

<?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: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

<?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: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

<?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: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Adding toggles ?

Page 58: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

$ 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: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

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

Page 60: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Services

Page 61: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Feature toggle dashboardMany rules for togglesStatistics

Page 62: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Technical DebtExtra code and configurationJS / CSS ?

Disadvantages

Page 63: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

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

Benefits

Page 64: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

End to end workflow

Page 65: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

PHPMDPHPLintPHPCPDPHPUnit

Page 66: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Peer review

Page 67: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Build release candidate

Page 68: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Static code analysis

Page 69: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Deploy to first pipeline

Page 70: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Testing

Page 71: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Go live

Page 72: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

My proposed workflow

Page 73: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Plan

Code

Build

TestDeploy

Page 74: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

BDDUser StoriesBusiness ValueExample WorkshopsFeature TogglesFeature BranchesTDD

Our solution

Page 75: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Starts the conversationValueIntentThe Why!

BDD ( Behaviour Driven Development )

Page 76: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Becomes Acceptance CriteriaThought about scenarios Validation of the work

User Stories

Page 77: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

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

Business Value

Page 78: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

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

Example Workshop

Page 79: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Feature Toggles

Page 80: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

feature/PROJ-NumberDelete once passed reviewShort lived

Feature Branches

Page 81: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

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

TDD ( Test Driven Development )

Page 82: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

How?

Page 83: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Github + Git

Page 84: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 85: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Sysconfig for toggle

Helper module for validation

Magento 2

Page 86: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Static Analysis

Running of tests

Deployment mechanism

Scrutinizer

Page 87: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 88: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Deploying ?

Page 89: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 90: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

deployment:-

branch: developcommands:

- { command: '(cap qa deploy)', idle_timeout: 600 }

-

branch: mastercommands:

- 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: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

State

Page 92: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Every change needs a script

MigrationsMagento setup scripts.

Page 93: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Every environments needs a config

Page 94: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Environment variablesEnvironment config files

Page 95: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 96: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

https://github.com/davidalger/capistrano-magento2

Page 97: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

gem install capistrano-magento2

mkdir -p tools/cap

Page 98: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

# Load DSL and set up stagesrequire 'capistrano/setup'

# Load Magento deployment tasksrequire 'capistrano/magento2/deploy'

# Load custom tasks from `lib/capistrano/tasks` if you have any definedDir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }

Page 99: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

cap staging deploy

Page 100: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Other services and platforms

Page 101: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Many More..

Page 102: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Further reading

Page 103: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 104: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 105: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 106: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them
Page 107: Continuously delivering - PushON · 2019-06-03 · Say goodbye to long and tense integrations Increase visibility which enables greater communication Catch issues fast and nip them

Q and A

@jcowieJamescowie (github)