Slide 1

Slide 1 text

A presentation by @stuherbert
 for @GanbaroDigital Automate, Automate, AUTOMATE! An Introduction For Developers

Slide 2

Slide 2 text

Industry veteran: architect, engineer, leader, manager, mentor F/OSS contributor since 1994 Talking and writing about PHP since 2004 Chief Software Archaeologist Building Quality @GanbaroDigital About Stuart

Slide 3

Slide 3 text

Follow me I do tweet a lot about non-tech stuff though :) @stuherbert

Slide 4

Slide 4 text

@GanbaroDigital ?? ?? What automation do you use today?

Slide 5

Slide 5 text

@GanbaroDigital ?? ?? Why do you use automation?

Slide 6

Slide 6 text

@GanbaroDigital https://unsplash.com/photos/cDwZ40Lj9eo Story #1: Cannot Compile

Slide 7

Slide 7 text

@GanbaroDigital Why We Automate

Slide 8

Slide 8 text

@GanbaroDigital Automation is often introduced to help with ...

Slide 9

Slide 9 text

@GanbaroDigital https://unsplash.com/photos/mqpMdf1MeRE Common Practices

Slide 10

Slide 10 text

@GanbaroDigital https://unsplash.com/photos/uYO30M0NND4 De-skill

Slide 11

Slide 11 text

@GanbaroDigital https://unsplash.com/photos/iS0Aq3QPsJ4 Boredom

Slide 12

Slide 12 text

@GanbaroDigital https://flic.kr/p/8taMDz Herding Cats

Slide 13

Slide 13 text

@GanbaroDigital I'm a great believer in working backwards from outcomes.

Slide 14

Slide 14 text

@GanbaroDigital https://unsplash.com/photos/NXt5PrOb_7U Guiding Direction

Slide 15

Slide 15 text

@GanbaroDigital In the last 5 years, I've adopted ONE guiding principle behind ALL my automation.

Slide 16

Slide 16 text

@GanbaroDigital “ Automation should assist us to iterate faster.

Slide 17

Slide 17 text

@GanbaroDigital “ Catch it early, catch it often.

Slide 18

Slide 18 text

@GanbaroDigital “ Any automation that slows us down should be removed.

Slide 19

Slide 19 text

@GanbaroDigital https://flic.kr/p/pdx99h A Scenic Tour

Slide 20

Slide 20 text

@GanbaroDigital The development workflow is often described as a pipeline.

Slide 21

Slide 21 text

@GanbaroDigital Development

Slide 22

Slide 22 text

@GanbaroDigital Development Integration

Slide 23

Slide 23 text

@GanbaroDigital Development Integration Testing

Slide 24

Slide 24 text

@GanbaroDigital Development Integration Testing Deployment

Slide 25

Slide 25 text

@GanbaroDigital It's rarely a neat pipeline in practice.

Slide 26

Slide 26 text

@GanbaroDigital Development Integration Testing Deployment

Slide 27

Slide 27 text

@GanbaroDigital Development Integration Testing Deployment

Slide 28

Slide 28 text

@GanbaroDigital Development

Slide 29

Slide 29 text

@GanbaroDigital Testing Deployment Integration Coding + many more!

Slide 30

Slide 30 text

@GanbaroDigital Deployment Integration Coding w/ Local Tests Coding Testing

Slide 31

Slide 31 text

@GanbaroDigital Integration Coding w/ Feature Tests or Manual Testing Coding Testing Deployment

Slide 32

Slide 32 text

@GanbaroDigital Deployment Daily Integration With Local Tests Coding Testing Integration

Slide 33

Slide 33 text

@GanbaroDigital Daily Integration With Feature Tests or Manual Testing Coding Testing Integration Deployment

Slide 34

Slide 34 text

@GanbaroDigital Testing Integration Coding w/ No Testing Coding Deployment

Slide 35

Slide 35 text

@GanbaroDigital The development workflow happens in many places.

Slide 36

Slide 36 text

@GanbaroDigital Development Integration Testing Deployment Desktops, laptops, 
 cloud workspaces / VDM

Slide 37

Slide 37 text

@GanbaroDigital Development Integration Testing Deployment Desktops, laptops, 
 cloud workspaces / VDM above & on CI services

Slide 38

Slide 38 text

@GanbaroDigital Development Integration Testing Deployment Desktops, laptops, 
 cloud workspaces / VDM above & on CI services same as above

Slide 39

Slide 39 text

@GanbaroDigital Development Integration Testing Deployment Desktops, laptops, 
 cloud workspaces / VDM above & on CI services same as above same as above

Slide 40

Slide 40 text

@GanbaroDigital When you introduce automation, make sure that it doesn't reduce flexibility.

Slide 41

Slide 41 text

@GanbaroDigital Always remember that you'll still need to make emergency releases too!

Slide 42

Slide 42 text

@GanbaroDigital There are no specific tools in this talk. Tools come and go.

Slide 43

Slide 43 text

@GanbaroDigital Development

Slide 44

Slide 44 text

@GanbaroDigital ?? ?? What automation can we use to write code faster?

Slide 45

Slide 45 text

@GanbaroDigital 1. Code completion

Slide 46

Slide 46 text

@GanbaroDigital 2. Refactoring tools

Slide 47

Slide 47 text

@GanbaroDigital 3. Code formatting

Slide 48

Slide 48 text

@GanbaroDigital IDE Tools For Automation 1. Code completion 2. Refactoring help 3. Code formatting

Slide 49

Slide 49 text

@GanbaroDigital ?? ?? What about code generation?

Slide 50

Slide 50 text

@GanbaroDigital Many frameworks will provide template / skeleton generators.

Slide 51

Slide 51 text

@GanbaroDigital Some frameworks will rewrite your code to help you upgrade.

Slide 52

Slide 52 text

@GanbaroDigital Integration

Slide 53

Slide 53 text

@GanbaroDigital ?? ?? What is integration?

Slide 54

Slide 54 text

@GanbaroDigital “ Integration is how you deliver into your team's collective work.

Slide 55

Slide 55 text

@GanbaroDigital “Integration is adding your changes to everyone else's and proving you haven't broken anything.

Slide 56

Slide 56 text

@GanbaroDigital ?? ?? How can automation help us deliver quicker?

Slide 57

Slide 57 text

@GanbaroDigital A CI server (or service) can automate checking a merge request.

Slide 58

Slide 58 text

@GanbaroDigital ?? ?? If we have a CI server, what kinds of checks can we automate?

Slide 59

Slide 59 text

@GanbaroDigital 1. Reproducible builds

Slide 60

Slide 60 text

@GanbaroDigital 2. Unit tests pass

Slide 61

Slide 61 text

@GanbaroDigital 3. Gather code metrics

Slide 62

Slide 62 text

@GanbaroDigital 4. Static code analysis

Slide 63

Slide 63 text

@GanbaroDigital ?? ?? How many of these automated tasks help us deliver quicker?

Slide 64

Slide 64 text

@GanbaroDigital Integration Automation 1. Reproducible builds 2. Unit tests pass 3. Gather code metrics 4. Static code analysis

Slide 65

Slide 65 text

@GanbaroDigital “ The more work a CI server does the more it becomes your bottleneck.

Slide 66

Slide 66 text

@GanbaroDigital “ A CI server is a shared resource. It's everyone's bottleneck.

Slide 67

Slide 67 text

@GanbaroDigital https://xkcd.com/303/

Slide 68

Slide 68 text

@GanbaroDigital “ Catch it early, catch it often.

Slide 69

Slide 69 text

@GanbaroDigital Thanks to git, we can test our integration locally every day.

Slide 70

Slide 70 text

@GanbaroDigital Thanks to Docker, we can run them all in an isolated environment locally whenever we want.

Slide 71

Slide 71 text

@GanbaroDigital We'll come back to this towards the end of the talk.

Slide 72

Slide 72 text

@GanbaroDigital If integration automation is slow on the CI server, it'll be slow on your dev machine too.

Slide 73

Slide 73 text

@GanbaroDigital Make sure each developer can run all the integration checks on their dev machine ... ... and that they do so.

Slide 74

Slide 74 text

@GanbaroDigital “ You can't fix people problems with technical solutions.

Slide 75

Slide 75 text

@GanbaroDigital https://unsplash.com/photos/ZSrgSSGJiQs Story #2 The Best Metrics

Slide 76

Slide 76 text

@GanbaroDigital Testing

Slide 77

Slide 77 text

@GanbaroDigital ?? ?? What is testing?

Slide 78

Slide 78 text

@GanbaroDigital “ Testing is the act of proving that your code actually does what you think it does.

Slide 79

Slide 79 text

@GanbaroDigital In my experience, many developers mis-read their code.

Slide 80

Slide 80 text

@GanbaroDigital ?? ?? How does testing help us iterate faster?

Slide 81

Slide 81 text

@GanbaroDigital “ Testing helps us reduce rework.

Slide 82

Slide 82 text

@GanbaroDigital Rework is expensive.

Slide 83

Slide 83 text

@GanbaroDigital Design Dev Test Live If errors in one phase cost x3 to fix in the next:

Slide 84

Slide 84 text

@GanbaroDigital ?? ?? What testing can we automate?

Slide 85

Slide 85 text

@GanbaroDigital 1. Unit tests

Slide 86

Slide 86 text

@GanbaroDigital 2. Integration tests

Slide 87

Slide 87 text

@GanbaroDigital 3. Functional tests

Slide 88

Slide 88 text

@GanbaroDigital 4. Non-functional tests

Slide 89

Slide 89 text

@GanbaroDigital 5. Acceptance tests

Slide 90

Slide 90 text

@GanbaroDigital ?? ?? Which of these help us iterate faster?

Slide 91

Slide 91 text

@GanbaroDigital Automated Testing 1. Unit tests 2. Integration tests 3. Functional tests 4. Non-functional tests 5. Acceptance tests

Slide 92

Slide 92 text

@GanbaroDigital Automated Testing 1. Unit tests 2. Integration tests 3. Functional tests 4. Non-functional tests 5. Acceptance tests

Slide 93

Slide 93 text

@GanbaroDigital ?? ?? Do all the test approaches help us all the time?

Slide 94

Slide 94 text

@GanbaroDigital https://unsplash.com/photos/IClZBVw5W5A Right Tool For Each Job

Slide 95

Slide 95 text

@GanbaroDigital “ Unit tests help us develop libraries faster.

Slide 96

Slide 96 text

@GanbaroDigital “ Functional tests help us develop the app or API faster.

Slide 97

Slide 97 text

@GanbaroDigital “ Acceptance tests help us invoice faster.

Slide 98

Slide 98 text

@GanbaroDigital https://unsplash.com/photos/ZSrgSSGJiQs Story #2 The Best Metrics

Slide 99

Slide 99 text

@GanbaroDigital The testing failed to catch errors from the design phase.

Slide 100

Slide 100 text

@GanbaroDigital The Testing Fell Short 1. Over-reliance on unit tests w/ mocks 2. Manual functional testing 3. No representative environment to test within

Slide 101

Slide 101 text

@GanbaroDigital Deployment

Slide 102

Slide 102 text

@GanbaroDigital ?? ?? How can automating deployment help us iterate faster?

Slide 103

Slide 103 text

@GanbaroDigital We need somewhere to run and test our code.

Slide 104

Slide 104 text

@GanbaroDigital ?? ?? Can you spin up a representative environment?

Slide 105

Slide 105 text

@GanbaroDigital ?? ?? Can you spin one up on your dev box?

Slide 106

Slide 106 text

@GanbaroDigital Two Layers of Deployment 1. Representative environment 2. Deploying code into that environment

Slide 107

Slide 107 text

@GanbaroDigital Don't merge them into a single activity.

Slide 108

Slide 108 text

@GanbaroDigital ?? ?? How do you automate your deployment today?

Slide 109

Slide 109 text

@GanbaroDigital 1. GitOps

Slide 110

Slide 110 text

@GanbaroDigital 2. Shell scripts

Slide 111

Slide 111 text

@GanbaroDigital 3. Orchestration tools

Slide 112

Slide 112 text

@GanbaroDigital Deployment Automation 1. GitOps 2. Shell scripts 3. Orchestration tools

Slide 113

Slide 113 text

@GanbaroDigital GitOps is normally* backed by a CI/CD box and orchestration tools. Can you use those to deploy locally too?

Slide 114

Slide 114 text

@GanbaroDigital Shell scripts are quick and dirty. They break down in a mixed O/S environment.

Slide 115

Slide 115 text

@GanbaroDigital It takes a lot of time to automate deployments using orchestration tools.

Slide 116

Slide 116 text

@GanbaroDigital “ Code rots over time. Automation is code.

Slide 117

Slide 117 text

@GanbaroDigital “ Automation doesn't transfer between paradigm changes.

Slide 118

Slide 118 text

@GanbaroDigital

Slide 119

Slide 119 text

@GanbaroDigital

Slide 120

Slide 120 text

@GanbaroDigital

Slide 121

Slide 121 text

Thank You Can We Help You? A presentation by @stuherbert
 for @GanbaroDigital