62
@meekrosoft Continuous Delivery of Embedded Software Mike Long, Partner, Praqma Norway @meekrosoft

Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Continuous Delivery of Embedded Software

Mike Long,Partner, Praqma Norway@meekrosoft

Page 2: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 3: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Agenda:- What is Continuous Delivery?- What are the challenges in Embedded?- What techniques can we take advantage

of?- How can we test embedded software?- Who has done this already?

Page 4: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosofthttps://www.flickr.com/photos/philia17/15601597778/

Page 5: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Professional software development1. Take a copy of the codebase for existing product2. Carefully document its current algorithms3. Add changes surrounded by ifdefs4. Test for months5. Commit the code as a new project that will “hopefully”

get merged to the in the future6. Compile on my laptop7. Ship!

Page 6: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Airbus engineers employed the latest and greatest formal methods, and provided model checking and formal proofs of all of their avionics code. Meanwhile, according to the story, Boeing performed extensive design review and testing, and made all their software engineers fly on the first test flights. The general upshot of the story was that most of us (it seemed) felt more comfortable flying on Boeing aircraft. (It would be interesting to see if that would still be the majority opinion in the software engineering community.)

https://www.cerias.purdue.edu/site/blog/post/short_random_thought_on_testing/#When:16:40:35Z

Eugene H. Spafford, Professor & Executive Director, Purdue University

Page 7: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

What is Continuous Delivery?

Page 8: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Agile Manifesto

● Four doctrines, twelve Principles

# 1

# 7

Page 9: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Rejected

Fail

Integration

Commit

“Build”

Fail

Toll-gate pass

Continuous Integration

Page 10: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Analysis &Metrics

Deploy

Functionaltest

Document

Validate

Done done

Pipeline

Fail

Fail

Fail

Fail

Fail

Rejected

Continuous Delivery

Page 11: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Analysis &Metrics

Deploy

Functionaltest

Document

Validate

Done done

Pipeline

Fail

Fail

Fail

Fail

Fail

RejectedRejected

Fail

Integration

Commit

“Build”

Fail

Toll-gate pass

Page 12: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Release trains

Page 13: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Release trains

Page 14: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Challenges

Page 15: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosofthttp://www.lego.com/en-us/minifigures/characters/computer-programmer-0c248844ec9d4245a5c17479a208e45b

Solo work

Page 16: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Fire and forget codebases?

Page 17: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 18: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Production-like environment???

Page 19: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 20: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Versioning

Page 21: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

The red thread of traceability

We want to know: what it is compatible with, what it depends on, where it was built, what its test results were, its source version, and the task that spawned the change

Page 22: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

http://semver.org

Page 23: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Examples

myapplication-1.0.0-alpha+001.sha.5114f85

Artifact Name

Page 24: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Examples

myapplication-1.0.0-alpha+001.sha.5114f85

Major.minor.patch

Page 25: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Examples

myapplication-1.0.0-alpha+001.sha.5114f85

Prerelease version

Page 26: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Examples

myapplication-1.0.0-alpha+001.sha.5114f85

Build number

Page 27: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Examples

myapplication-1.0.0-alpha+001.sha.5114f85

git short SHA

Page 28: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Examples

myapplication-1.0.0-SNAPSHOT+001.sha.5114f85

SNAPSHOT

Page 29: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 30: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 31: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Build

Page 32: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosofthttp://blog.codinghorror.com/the-f5-key-is-not-a-build-process/

If your "build process" is the F5 key, you have a problem…..Get your build process out of the IDE and into a build script.

Page 33: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

What’s missing?

Traceability: Can I find out exactly the environment for this build?

Reproducibility: Can I build something from last year with the same results?

Page 34: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 35: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 36: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 37: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

A Traceability ecosystem

Page 38: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Configuration as code

Linux slaveLinux

slaveLinux slaveLinux

slavesDockerfile

Vagrant file

Windowsslaves

Puppet file

WindowsslavesWindows

slaves

Jenkins Jobs

JobDSL

Page 39: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Build in a box

Jenkins Master

ArtifactoryDocker container

Linux slaveLinux

slaveLinux slaveLinux

slaveLinux slaveLinux

slave

Windowsslave

Vagrant VM

WindowsslaveWindows

slaveWindowsslaveWindows

slave

PuppetMaster

Page 40: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Testing

Page 41: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 42: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

System Tests ✓

Page 43: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

System Tests- Control power- Program devices- Control Actuators- Sense results

Page 44: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

System Tests

Component Tests

✓✓

Page 45: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

System Tests

Component Tests

✓✓

Page 46: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 47: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Test everywhere

Test on your host for:● Feedback speed, debuggingBut also test on target because:● Compilers/hardware are different● Endiness/overflow/underflow behave

differently● Ship them if you can!

Page 48: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 49: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Pro Tips

Page 50: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

// #ifdef MY_PROD_V1

Avoid using the preprocessor for variants● It makes builds slow● Lowers cohesion● Also hinders understandability

Page 51: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Only build your binaries once

Efficiency - time to feedbackSafety - ship what you test

Page 52: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Amplify feedback loops

TDD

Red

RefactorGreen

Learn Measure

Build

Product

Data

Ideas

Continuous IntegrationContinuous DeliveryBDDAutomated DeploymentCustomer Feedback

Page 53: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Dev Env is competitive advantage

Attrition vs. Late follower vs.

Unhappy customers vs.

RecruitmentFirst to marketRaving fandom

Page 54: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Summary

Page 55: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

https://ww

w.flickr.com

/photos/22423670@N

08/14260168597

Page 56: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 57: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

The researchers praised Tesla for the way the vehicle handled the

bogus commands and how the car maker responded to their findings.

Page 58: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

In late July, Fiat Chrysler issued a recall for more than 1.4 million vehicles after

hackers Charlie Miller and Chris Valasek showed how to use bugs in the onboard software of the Jeep Cherokee to shut it

down remotely.

Page 59: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Agenda:- What is Continuous Delivery? ✓- What are the challenges in Embedded? ✓- What techniques can we take advantage

of? ✓- How can we test embedded software? ✓- Who has done this already? ✓

Page 61: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft

Page 62: Embedded Software Continuous Delivery ofgotocon.com/dl/goto-cph-2015/slides/MikeLong... · @meekrosoft Professional software development 1. Take a copy of the codebase for existing

@meekrosoft