QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part...

58
Observability in the Software Supply Chain Seeing into your build system QCon SF 2019

Transcript of QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part...

Page 1: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Observability in theSoftware Supply Chain

Seeing into your build system

QCon SF 2019

Page 2: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Intro

Ben Hartshorne

@maplebed

[email protected]

Page 3: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

What’s this talk about

● Part story● Part pulling back the curtain● Part encouragement

Page 4: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1 - Story Time

Page 5: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 6: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

● Our builds were slow● Well, they felt slow● Were they actually?● We had no idea

Page 7: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

… but we believe in

Observability!!!

Page 8: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 9: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 10: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 11: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 12: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 13: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 14: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Instrumentation○ Changed our model○ Guided work

Part 1: Story Time

Page 15: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 16: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 17: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 18: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

https://imgs.xkcd.com/comics/compiling.png

Page 19: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 1: Story Time

Page 20: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Instrumentation○ Changed our model○ Guided work○ Proved results○ Uncovered unknown variance

Part 1: Story Time

Page 21: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Using production-focused tools○ Developers unfamiliar with build

use the same tools they knowto understand a different service

Part 1: Story Time

Page 22: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2 - How does it work?

Page 23: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Go back to the beginning of the story○ Between “observability”

and “so we instrumented it”○ We need to define the problem

Part 2: How did we do it?

Page 24: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Vocab: Build System○ Really Build and Test○ On a trigger (usually a commit),

do some stuff○ Can Succeed or Fail○ Runs many shell commands

Part 2: How did we do it?

Page 25: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Core duties of a build system○ Set up an isolated environment○ Run a bunch of commands○ Stop when one fails○ Record the result

Part 2: How did we do it?

Page 26: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Core instrumentation for builds○ How long did it take○ What commands were run■ How long did each take

○ Did it succeed■ Did each command succeed

Part 2: How did we do it?

Page 27: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Core instrumentation for builds○ How long did it take○ What commands were run■ How long did each take

○ Did it succeed

Part 2: How did we do it?

Page 28: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Sample build config

Part 2: How did we do it?

Page 29: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Let’s write a small wrapper that○ Takes a name and a command○ Measures how long it takes to run○ Records its exit status■ and passes it along

○ Outputs the resulting data

Part 2: How did we do it?

Page 30: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2: How did we do it?

Page 31: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2: How did we do it?

Page 32: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2: How did we do it?

Page 33: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Our new build config

Part 2: How did we do it?

Page 34: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● What gets this beyond prototype?○ Switch languages bash -> go○ Link commands together○ Improve our data model○ Collect additional context

Part 2: How did we do it?

Page 35: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Link our commands together○ Tie all the spans in to a trace○ Use the Build ID from the

build system

Part 2: How did we do it?

Page 36: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2: How did we do it?

Page 37: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Improve our data model○ Group commands into steps■ Time the whole group

○ build is the whole thing○ step is a group of commands○ cmd is one specific command

Part 2: How did we do it?

Page 38: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2: How did we do it?

Page 39: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2: How did we do it?

Page 40: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2: How did we do it?

Page 41: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2: How did we do it?

Page 42: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Collect additional context○ Branch name, PR#, CI system, etc.○ Custom fields from the developer■ Artifact size■ Build depth■ Links to other data sources■ Test results, etc.

Part 2: How did we do it?

Page 43: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Collect additional custom context○ Put name=value pairs in a file○ Put the name of that file in the env○ Buildevents includes those fields

Part 2: How did we do it?

Page 44: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 2: How did we do it?

Page 45: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● One more trick○ Interrogate the build system API○ CircleCI has live API endpoints○ Reveals the real start time○ Other juicy data

Part 2: How did we do it?

Page 46: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Speaking of open source …

github / honeycombio / buildevents

Part 2: How did we do it?

Travis-CI Google Cloud BuildGitLab JenkinsX CircleCI

Page 47: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Build systems run shell commands● By wrapping shell commands

we hook in instrumentation● Use the env or fs for IPC● Pull extra context from the env● Pull extra context from APIs● Send that data to visualization

Part 2: How did we do it?

Page 48: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 3 - What’s next?

Page 49: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Build systems are part of the SSC○ and traces easily represent builds

● What other parts would benefit from new visualizations and tracking?○ Commit to deploy lifecycle○ ???

Part 3: What’s next?

Page 50: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Commit to deploy lifecycle○ Many commits to one PR○ Many review cycles before merge○ Many builds along the way○ Many environments in deploy○ Many PRs in one deploy?○ Reversions?

Part 3: What’s next?

Page 51: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Commit to deploy lifecycle challenge○ Represent individual run well■ Show commit-forward■ Show deploy-backward■ Represent cycles, delays

Part 3: What’s next?

Page 52: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Commit to deploy lifecycle challenge○ Represent runs in aggregate■ Overall lead time■ Trends in PR review delay■ Time from merge to deploy

Part 3: What’s next?

Page 53: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Commit to deploy lifecycle challenge○ Ease of integration into toolchain■ Source code repositories■ Build systems■ Deploy systems■ etc.

Part 3: What’s next?

Page 54: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Part 3: What’s next?

Homework!!!!!

Page 55: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● Instrumentation and visualizationlead to smarter work

● Build systems are aneasy first step

Summary

Page 56: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● The tools we use for prodcan be used in the SSC

● The SSC is ripe fornew insights and visualizations

Summary

Page 57: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

● The ideas of observabilityapply outside of production

and bring value to the SSC

Summary

Page 58: QCon SF 2019 Software Supply Chain Observability in the · Part pulling back the curtain Part encouragement. Part 1 - Story Time. Part 1: Story Time ... Go back to the beginning of

Ben Hartshornemaplebedhoneycomb.io

Thank you