rise of the machines - automate your development

191
Rise of the machines Automate your development @svenpet

Upload: sven-peters

Post on 16-Jan-2017

43.755 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Rise of the Machines - Automate your Development

Rise of the machinesAutomate your development

@svenpet

Page 2: Rise of the Machines - Automate your Development

Disclaimer

Scripts Chef, Puppet, etc better build pipelines

Page 3: Rise of the Machines - Automate your Development

Disclaimer

Ideas through examples

Page 4: Rise of the Machines - Automate your Development

Rise of the machines

Page 5: Rise of the Machines - Automate your Development

ROBOTSare coming to our day to day lives

Page 6: Rise of the Machines - Automate your Development
Page 7: Rise of the Machines - Automate your Development
Page 8: Rise of the Machines - Automate your Development
Page 9: Rise of the Machines - Automate your Development
Page 10: Rise of the Machines - Automate your Development

Rise of the machines

IN Software Development

Page 11: Rise of the Machines - Automate your Development

Sven PetersAtlassian Evangelist

@svenpetsvenpet.com

Page 12: Rise of the Machines - Automate your Development

Automation in Software Developmentmy personal story

build scripts (make)

1996JUnit

2001

2004

ant -> later maven

2005

Eclipse (code generation)

Hudson

2006

2009

Puppet

1998

GUI builder2013

Docker

Page 13: Rise of the Machines - Automate your Development

Build & TestsDeployments

Small scripts

What are we automating right now?

Page 14: Rise of the Machines - Automate your Development

What are we automating right now?

Code Reviews

Stand Ups

Ops

Support

Merging

Engineering Health

Page 15: Rise of the Machines - Automate your Development

Bots everywhere

Coding bots Ops bots Service bots Doc botsReport botsTest bots

Page 16: Rise of the Machines - Automate your Development

Welcome… orI’m new

Page 17: Rise of the Machines - Automate your Development

Add ons

PostgresScala

IntelliJ

Git

JDK

Happy installing & setup… for the next 8 hours

Page 18: Rise of the Machines - Automate your Development
Page 19: Rise of the Machines - Automate your Development
Page 20: Rise of the Machines - Automate your Development
Page 21: Rise of the Machines - Automate your Development
Page 22: Rise of the Machines - Automate your Development
Page 23: Rise of the Machines - Automate your Development
Page 24: Rise of the Machines - Automate your Development
Page 25: Rise of the Machines - Automate your Development

Agent CharlieMeet

Page 26: Rise of the Machines - Automate your Development

Download

Install

Configure

Agent CharlieMeet

Page 27: Rise of the Machines - Automate your Development

Download

Install

Configure

Agent CharlieMeet

Page 28: Rise of the Machines - Automate your Development

Puppet, Shell & RubyWorks with OSX & Ubuntu

Atlassian Plugin SDK

Bitbucket SSH Keys

Git

Mercurial

HipChat

HomeBrew

IntelliJ IDEA

JDK

Maven

PostgreSQL

Stash Keys

and much more…

Page 29: Rise of the Machines - Automate your Development

Without Agent Charlie

With Agent Charlie

Page 30: Rise of the Machines - Automate your Development

Coding botsAutomate your Coding phase

Page 31: Rise of the Machines - Automate your Development

27’’ is not enough

Page 32: Rise of the Machines - Automate your Development

Chat

EmailRepo

manager

IDE

Command

line

Issue

Tracker

Page 33: Rise of the Machines - Automate your Development

Issue tracker workflow

TODO IN PROGRESS IN REVIEW DONE

Page 34: Rise of the Machines - Automate your Development

BRANCH CODE REFACTOR PULL MERGE

Developer workflow

Page 35: Rise of the Machines - Automate your Development

BRANCH CODE REFACTOR PULL MERGE

What you should do

TODO IN PROGRESS IN REVIEW DONE

Page 36: Rise of the Machines - Automate your Development

BRANCH CODE REFACTOR PULL MERGE

What you do

TODO IN PROGRESS IN REVIEW DONE

Page 37: Rise of the Machines - Automate your Development

Keep the team updated!

Page 38: Rise of the Machines - Automate your Development
Page 39: Rise of the Machines - Automate your Development

Smart commitsmention issue_key and #trigger the issue tracker

Github JIRA YouTrack Trello Bitbucket

Page 40: Rise of the Machines - Automate your Development

Control the issue by commits

TODO IN PROGRESS IN REVIEW DONE

JRA-566 #start-Progress

JRA-566 #start-review

fixes #566

Page 41: Rise of the Machines - Automate your Development

No tool switching

Robot is just receiving

commands

Page 42: Rise of the Machines - Automate your Development

TODO IN PROGRESS IN REVIEW DONE

branchcommit

Controlled by action

pullcreate review

request

mergeclose review

Page 43: Rise of the Machines - Automate your Development
Page 44: Rise of the Machines - Automate your Development

Our workflow

TODO IN PROGRESS IN REVIEW DONE

branch pull merge

Page 45: Rise of the Machines - Automate your Development

branch pull merge

master

JRA-554-bugfix

Page 46: Rise of the Machines - Automate your Development

branch pull merge

master

commits code directly to the master branch!

Page 47: Rise of the Machines - Automate your Development

branch pull merge

master

Page 48: Rise of the Machines - Automate your Development

branch pull merge

master

JRA-554-bugfix

Page 49: Rise of the Machines - Automate your Development

branch pull merge

master

JRA-554-bugfix

Page 50: Rise of the Machines - Automate your Development

bad surprisesh*t happens, but can be avoided

Page 51: Rise of the Machines - Automate your Development

bad surprisesh*t doesn’t happen that often

no

Page 52: Rise of the Machines - Automate your Development

branch pull merge

don’t branch from a red build

master

JRA-554-bugfix

Page 53: Rise of the Machines - Automate your Development

branch pull merge

master

JRA-554-bugfix

invite the best reviewers

Page 54: Rise of the Machines - Automate your Development
Page 55: Rise of the Machines - Automate your Development

Recent comitters or author

Page 56: Rise of the Machines - Automate your Development

auto suggest reviewer

Page 57: Rise of the Machines - Automate your Development

branch pull merge

minimum 2 approvals

master

JRA-554-bugfix

Page 58: Rise of the Machines - Automate your Development

branch pull merge

unapprove reviewers when code changes

master

JRA-554-bugfix

Page 59: Rise of the Machines - Automate your Development

The need to update older versions

Page 60: Rise of the Machines - Automate your Development

master

Version 1.1

Version 1.0

Support older versions

Page 61: Rise of the Machines - Automate your Development

master

Version 1.1

Version 1.0

JRA-234-hotfix

Support older versions

Page 62: Rise of the Machines - Automate your Development

master

Version 1.1

Version 1.0

JRA-234-bugfix

Support older versions

boring!

Page 63: Rise of the Machines - Automate your Development

Huhu I can do it!

Page 64: Rise of the Machines - Automate your Development

master

Version 1.1

Version 1.0

JRA-234-bugfix

auto merges

Page 65: Rise of the Machines - Automate your Development

Test botsSMARTER Test Automation

Page 66: Rise of the Machines - Automate your Development

&:hover { text-decoration: none; color: @invertedBodyTextColor background-color: #366ca6; cursor: pointer;

}

Page 67: Rise of the Machines - Automate your Development

&:hover { text-decoration: none; color: @invertedBodyTextColor background-color: #366ca6; cursor: pointer;

}

Static code analysis can catch this!Findbugs - Checkstyle - PMD

Page 68: Rise of the Machines - Automate your Development

Listen to what Freud tells you about

source codeyour

Page 69: Rise of the Machines - Automate your Development

Freud Bot

&:hover { text-decoration: none; color: @invertedBodyTextColor background-color: #366ca6;

cursor: pointer; }

You should use a variable instead for . I suggest that you use a variable of similar color: #366CA6

@globalHeaderPrimaryActionFallbackColor @globalHeaderTopColor @primaryLinkColor

Page 70: Rise of the Machines - Automate your Development

Freud Botfor Pull Requests

Page 71: Rise of the Machines - Automate your Development

Freud Bot

less review work makes suggestions

Page 72: Rise of the Machines - Automate your Development

We are trying hard to write awesome code

Page 73: Rise of the Machines - Automate your Development

packagecom.miguelcatalan.materialsearchview;

importandroid.app.Activity;

importandroid.widget.ListView;

importandroid.widget.RelativeLayout;

importandroid.widget.TextView;

importjava.lang.reflect.Field;

importjava.util.List;

/**

*@authorMiguelCatalanBañuls

*/

publicclassMaterialSearchViewextendsFrameLayoutimplementsFilter.FilterListener{

privateMenuItemmMenuItem;

privatebooleanmIsSearchOpen=false;

publicMaterialSearchView(Contextcontext){

this(context,null);

}

publicMaterialSearchView(Contextcontext,AttributeSetattrs){

this(context,attrs,0);

@OverridepublicvoidonTextChanged(CharSequences,intstart,intbefore,intcount){

mUserQuery=s;

startFilter(s);

MaterialSearchView.this.onTextChanged(s);

}

}

LOC: 32

MyAwesomeClass

Page 74: Rise of the Machines - Automate your Development

One month later

Page 75: Rise of the Machines - Automate your Development

packagecom.miguelcatalan.materialsearchview;

importandroid.app.Activity;

importandroid.content.Context;

importandroid.content.Intent;

importandroid.content.pm.PackageManager;

importandroid.content.pm.ResolveInfo;

importandroid.content.res.TypedArray;

importandroid.graphics.Rect;

importandroid.graphics.drawable.Drawable;

importandroid.os.Build;

importandroid.os.Parcel;

importandroid.os.Parcelable;

importandroid.speech.RecognizerIntent;

importandroid.text.Editable;

importandroid.text.TextUtils;

importandroid.text.TextWatcher;

importandroid.util.AttributeSet;

importandroid.util.Log;

importandroid.view.KeyEvent;

importandroid.view.LayoutInflater;

importandroid.view.MenuItem;

importandroid.view.View;

importandroid.view.inputmethod.InputMethodManager;

importandroid.widget.AdapterView;

importandroid.widget.EditText;

importandroid.widget.Filter;

importandroid.widget.Filterable;

importandroid.widget.FrameLayout;

importandroid.widget.ImageButton;

importandroid.widget.ListAdapter;

importandroid.widget.ListView;

importandroid.widget.RelativeLayout;

importandroid.widget.TextView;

importcom.miguelcatalan.materialsearchview.utils.AnimationUtil;

…one month later

LOC: counting….

MyAwesomeClass

Page 76: Rise of the Machines - Automate your Development

//RequestFocus

mSearchSrcTextView.setText(null);

mSearchSrcTextView.requestFocus();

if(animate){

AnimationUtil.fadeInView(mSearchLayout,AnimationUtil.ANIMATION_DURATION_MEDIUM,newAnimationUtil.AnimationListener(){

@Override

publicbooleanonAnimationStart(Viewview){

returnfalse;

}

@Override

publicbooleanonAnimationEnd(Viewview){

if(mSearchViewListener!=null){

mSearchViewListener.onSearchViewShown();

}

returnfalse;

}

@Override

publicbooleanonAnimationCancel(Viewview){

returnfalse;

}

});

}else{

mSearchLayout.setVisibility(VISIBLE);

if(mSearchViewListener!=null){

mSearchViewListener.onSearchViewShown();

}

}

mIsSearchOpen=true;

}

/**

*Closesearchview.

*/

publicvoidcloseSearch(){

…one month later

LOC: 986

MyAwesomeClass

Page 77: Rise of the Machines - Automate your Development

Code over time

86%

20

1045

27

test coverage

deprecated methods

old unit tests (JUnit 3)

compiler warnings

Page 78: Rise of the Machines - Automate your Development

Code over time

83% test coverage

23 deprecated methods

1136 old unit tests (JUnit 3)

36 compiler warnings

Page 79: Rise of the Machines - Automate your Development

Code over time

75% test coverage

32 deprecated methods

1289 old unit tests (JUnit 3)

45 compiler warnings

Page 80: Rise of the Machines - Automate your Development

Developers are trying to solve problems

Developers don’t write bad code on purpose

Page 81: Rise of the Machines - Automate your Development

Calling

Dr. Codemeasure constantly the engineering health

Page 82: Rise of the Machines - Automate your Development

measure constantly the engineering health

Calling

Dr. Code

Page 83: Rise of the Machines - Automate your Development

jira.stats.tests.junit.3.count

No more JUnit 3 tests!JUnit 3 JUnit 4

Page 84: Rise of the Machines - Automate your Development

jira.stats.bundled.jars.in.plugins

Inspect all the things

jira.stats.tests.junit.3.count

Page 85: Rise of the Machines - Automate your Development

Hall of Shame!You’ll enter the

JS not minified

API compatibility :(

New JUnit3 test

Caught by Dr Code?

Page 86: Rise of the Machines - Automate your Development

Hall of Shame!You’ll enter the

Wallboard - so everyone sees it!

Page 87: Rise of the Machines - Automate your Development

Hall of Fame!You’ll enter the

Fixed a matrix?

Page 88: Rise of the Machines - Automate your Development

publicabstractclassTask{

publicfinalvoidexecuteWith(Callbackcallback){

execute();

if(callback!=null){

callback.call();

}

}

publicabstractvoidexecute();

}

publicabstractclassTask{

publicfinalvoidexecuteWith(Callbackcallback){

execute();

if(callback!=null){

callback.call(20);

}

}

publicabstractvoidexecute();

}

Old version New version

Page 89: Rise of the Machines - Automate your Development

publicabstractclassTask{

publicfinalvoidexecuteWith(Callbackcallback){

execute();

if(callback!=null){

callback.call();

}

}

publicabstractvoidexecute();

}

publicabstractclassTask{

publicfinalvoidexecuteWith(Callbackcallback){

execute();

if(callback!=null){

callback.call(20);

}

}

publicabstractvoidexecute();

}

Old version New version

Page 90: Rise of the Machines - Automate your Development

Old version New version

Page 91: Rise of the Machines - Automate your Development

Old version New version

Hard to spot?

Page 92: Rise of the Machines - Automate your Development

Image Compare Bot

Compare images

(on build)

Alert on differences

(build warning)Easy reporting

(build report)

Page 93: Rise of the Machines - Automate your Development

Our functional tests ran for

h ursso we ran them parallel

Page 94: Rise of the Machines - Automate your Development

Test block 1

Test block 2

Test block 3

Test block 4

Test block 5

statically sized test blocks

waiting for the longest test block

Page 95: Rise of the Machines - Automate your Development

HallelujahFunctional Test Balancer

Page 96: Rise of the Machines - Automate your Development

T1

T 2

T 3

T4

T5

T6

T7

T8

T9

T10

T11

T 12

T13

T14

Hallelujah

Page 97: Rise of the Machines - Automate your Development

build status

Page 98: Rise of the Machines - Automate your Development

build status

Page 99: Rise of the Machines - Automate your Development

build status

Page 100: Rise of the Machines - Automate your Development

Flaky Test Detector

Page 101: Rise of the Machines - Automate your Development

Flaky Test Detector

failing test

rerun test

successful test

test in quarantaine

continue build

create issue

Page 102: Rise of the Machines - Automate your Development

1888 flaky tests detected

817 quarantined tests

fixed

Page 103: Rise of the Machines - Automate your Development

Flaky Test Detector

no log file searching

forces fixing flaky tests

no manual reruns

no more ‘this one again’ moments

Page 104: Rise of the Machines - Automate your Development

OPS botsAutomated Operations

Page 105: Rise of the Machines - Automate your Development
Page 106: Rise of the Machines - Automate your Development

Ops nowproblem

Page 107: Rise of the Machines - Automate your Development

ops

Slow feedback loop

devprob

Page 108: Rise of the Machines - Automate your Development

Faster feedback loop

devprob

Page 109: Rise of the Machines - Automate your Development

Faster feedback loopknows which team -> service responsibility

Page 110: Rise of the Machines - Automate your Development

Faster feedback loop

But that’s a lot of configuration!

Page 111: Rise of the Machines - Automate your Development

Faster feedback loop

add team in deployment descriptor

add connection to

pager duty

Page 112: Rise of the Machines - Automate your Development

Own your codeend-to-end

Page 113: Rise of the Machines - Automate your Development

Prepared for the release?

WAIT…

Release Notes?

Page 114: Rise of the Machines - Automate your Development

New Feature

Improvement

Bugfix

Do you know which features really ship?

Release Branch

Page 115: Rise of the Machines - Automate your Development

Merged JRA-345

Commit messages

+Issue

information

=Release notes

Release Notes Bot

Page 116: Rise of the Machines - Automate your Development
Page 117: Rise of the Machines - Automate your Development

Label in GitHub Issues

Label in GitHub Issues

Page 118: Rise of the Machines - Automate your Development
Page 119: Rise of the Machines - Automate your Development
Page 120: Rise of the Machines - Automate your Development

New features

Improvements

Fixed bugs

Page 121: Rise of the Machines - Automate your Development

Issue Description as

Release NotesHuman readable

issue descriptions

Think about customer value

No surprises

Page 122: Rise of the Machines - Automate your Development

Service botsAutomate your Service

Page 123: Rise of the Machines - Automate your Development

Support Developer

scanning log filesask for log file system knowledge

Page 124: Rise of the Machines - Automate your Development

pause work

Page 125: Rise of the Machines - Automate your Development

Support Developer

scanning log filesask for log file system knowledge

Page 126: Rise of the Machines - Automate your Development

Support Hercules

scanning log filesask for log file system knowledge

Page 127: Rise of the Machines - Automate your Development

Teaching the robot

Page 128: Rise of the Machines - Automate your Development

Hercules get’s smarter

suggest read

update

Page 129: Rise of the Machines - Automate your Development

{ Well f*%k meTHE ROBOT

was right! }

Page 130: Rise of the Machines - Automate your Development

Your boss has a really important task for your team

Page 131: Rise of the Machines - Automate your Development

Everyone is working from home today

Page 132: Rise of the Machines - Automate your Development
Page 133: Rise of the Machines - Automate your Development

by

Page 134: Rise of the Machines - Automate your Development
Page 135: Rise of the Machines - Automate your Development

With chat you can reach everyone immediately

Page 136: Rise of the Machines - Automate your Development

All these questions!

How do I download the Sprint report?

How do I set up a build for my

feature branch?

What Java versions do we

support?

Page 137: Rise of the Machines - Automate your Development

!askI’ll look it up for you

Self service for chat

Page 138: Rise of the Machines - Automate your Development

!ask the knowledge base first!

Page 139: Rise of the Machines - Automate your Development

REPORT botsManual Reporting sucks

Page 140: Rise of the Machines - Automate your Development

Stand UpAutomating

s ?

Page 141: Rise of the Machines - Automate your Development

too longsetup VC calls

timezones remind people

Stand UpProblems

Page 142: Rise of the Machines - Automate your Development
Page 143: Rise of the Machines - Automate your Development

Never miss a stand up

Music - Start at 09:29:00

Crontab!

Page 144: Rise of the Machines - Automate your Development

Video - Open at 09:30

No video set up time

Page 145: Rise of the Machines - Automate your Development

Stand up report bots

colocated

distributed

different timezones

Page 146: Rise of the Machines - Automate your Development

Status update

Page 147: Rise of the Machines - Automate your Development

Team update

Page 148: Rise of the Machines - Automate your Development

Stand up bot

Page 149: Rise of the Machines - Automate your Development

Exception

Build failure

New issue

Deployment

Chat Botseverywhere

Page 150: Rise of the Machines - Automate your Development

ΩΩΩΩ

Builds

Page 151: Rise of the Machines - Automate your Development

ΩΩΩΩ

Deployments

Page 152: Rise of the Machines - Automate your Development

ΩΩΩΩ

Exceptions

Page 153: Rise of the Machines - Automate your Development

Chat Botseverywhere

Fast feedback loops Team knowledge Start discussions

Page 154: Rise of the Machines - Automate your Development

The build failed

New deployment

Page 155: Rise of the Machines - Automate your Development

The build failed

New deployment

Page 156: Rise of the Machines - Automate your Development

The build failed

New deployment

Page 157: Rise of the Machines - Automate your Development

New important

issue

New deployment

Page 158: Rise of the Machines - Automate your Development

New important

issue

New deployment

Page 159: Rise of the Machines - Automate your Development

New important

issue

New deployment

Get the big picture

Page 160: Rise of the Machines - Automate your Development

Get the big picture

Page 161: Rise of the Machines - Automate your Development

Every team has one or more

http://

atlasb

oard.bitb

ucket.org

/

Page 162: Rise of the Machines - Automate your Development

Every team has one or more

http://

atlasb

oard.bitb

ucket.org

/

see what’s going on point directly

Page 163: Rise of the Machines - Automate your Development

All kind of boards

AdvocatesDeveloper

Support

Page 164: Rise of the Machines - Automate your Development

Bots everywhere

Coding bots Ops bots Service bots Doc botsReport botsTest bots

Page 165: Rise of the Machines - Automate your Development

Reinvent the wheel?

Lots of unmaintained projects

Writing automation code

Very specific problem

Page 166: Rise of the Machines - Automate your Development

No. 1 Problem

Page 167: Rise of the Machines - Automate your Development

10%for better engineering healthwork time

Technical debt

Page 168: Rise of the Machines - Automate your Development

10%for better engineering healthwork time

Technical debt

Page 169: Rise of the Machines - Automate your Development
Page 170: Rise of the Machines - Automate your Development

is serious fun!Automation

Go - Ruby - PHP - PythonLanguages

Puppet - Chef - Ansible - DockerTechnologies

Fast feedbackSuccess

Your ProblemsMotivation

Page 171: Rise of the Machines - Automate your Development

From scripts on a developer hard disc

Page 172: Rise of the Machines - Automate your Development

to professional automation

Page 173: Rise of the Machines - Automate your Development

Source ControlAdd code to

Page 174: Rise of the Machines - Automate your Development

Code ReviewsDo

for every change

Page 175: Rise of the Machines - Automate your Development

TestsWrite

Page 176: Rise of the Machines - Automate your Development

Deployment ScriptsHave

Page 177: Rise of the Machines - Automate your Development

Keep your automated systemsunder control

Page 178: Rise of the Machines - Automate your Development

Keep your automated systemsunder control

Lots of different places

Page 179: Rise of the Machines - Automate your Development

Instances for automation services

Page 180: Rise of the Machines - Automate your Development

cost centreow

ner

serv

ice

We use labelsfor better overview

Page 181: Rise of the Machines - Automate your Development

Micros <our own PaaS>

Docker

Java

Go

Python

Page 182: Rise of the Machines - Automate your Development

micros service:create <service-name> Service descriptor

Owner

PagerDuty

Cost Centre

MicrosSimple to create & register

Page 183: Rise of the Machines - Automate your Development

Were are we heading?

Page 184: Rise of the Machines - Automate your Development

Better customer insides

better conclusions

collecting more data

Were are we heading?

Page 185: Rise of the Machines - Automate your Development

Faster dev feedback loops

less time updating & searching

integrated tools

Were are we heading?

Page 186: Rise of the Machines - Automate your Development

Better Quality

deeper code analysis

smarter tests

Were are we heading?

Page 187: Rise of the Machines - Automate your Development

Building software

Parts can be automated

craftis a

Creating customer valueis an

art

Hard to automate

Page 188: Rise of the Machines - Automate your Development

Rise of the machines

…Skynet became self aware

Page 189: Rise of the Machines - Automate your Development
Page 190: Rise of the Machines - Automate your Development

@svenpetsvenpet.com/talks

I’ll be back…find slides here

Page 191: Rise of the Machines - Automate your Development

Photo

Credits

“VW Golf TDI Clean Diesel was 2010 8983" by Mariordo Mario Roberto Duran Ortiz - Own work. Licensed under CC BY-SA 3.0 via Commons - https://commons.wikimedia.org/wiki/

Backyard Series by syauqee mohamad "http://www.flickr.com/photos/7901820@N07/6945260735"

Tesla Model S by Chrishmt0423 from flickr

Burnt & Abandoned Computer "http://www.flickr.com/photos/99649389@N02/13262802714"