Top Banner
©2013 CloudBees, Inc. All Rights Reserved 1 ©2013 CloudBees, Inc. All Rights Reserved Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. [email protected] / @kohsukekawa Jesse Glick / CloudBees, Inc. [email protected] / @tyvole
54

©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. [email protected] / @kohsukekawa.

Dec 15, 2015

Download

Documents

Cooper Cheaney
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 1©2013 CloudBees, Inc. All Rights Reserved

Next Step in Automation:Elastic Build EnvironmentKohsuke Kawaguchi / CloudBees, [email protected] / @kohsukekawa

Jesse Glick / CloudBees, [email protected] / @tyvole

Page 2: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 2

Have You Met Jenkins? http://jenkins-ci.org/

Page 3: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 3

32%

Page 4: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 4

18%

Page 5: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 5

Page 6: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 6

My Jenkins around 2006

Page 7: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 7

Page 8: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 8

Page 9: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 9

Workload

http://www.flickr.com/photos/gbyrnes/912576883/

Page 10: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 10

If only we had more computers…

• Just building & testing them all…• Running tests more frequently• Testing individual commits

Page 11: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 11

What you don’t wanthttp://www.flickr.com/photos/drocpsu/8546730021/

Page 12: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 12

Just enough computersjust in time

Elasticity

Page 13: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 13

My Jenkins around 2007

Page 14: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 14

Page 15: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 15

Page 16: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 16

Page 17: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 17http://www.flickr.com/photos/drocpsu/8546730021/

Page 18: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 18

18

But not this, either

Page 19: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 19

Just enough computersof the right kind

just in time

Elasticity!

Page 20: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 20http://www.flickr.com/photos/82219206@N00/7003641975/

Page 21: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 21

Correct answer

• Test assumes a fixture running on port 8080– Doesn’t check if it’s already being used

• If another test runs at the same time…?

Page 22: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 22http://www.flickr.com/photos/82219206@N00/7003641975/

Page 23: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 23

Correct answer

• Because of “pkill -f -9 tomcat” cleanup

Page 24: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 24

Isolation

http://www.flickr.com/photos/jumilla/8667648797/

Page 25: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 25

Isolation

• At odds with large multi-core systems

• x86 virtual machines• User isolation• Kernel containers

Page 26: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 26

!

Page 27: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 27http://www.flickr.com/photos/82219206@N00/7003641975/

Page 28: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 28

Correct answer

• Same Maven ID, two different jars

• Different projects designate different ones

• Local cache gets cleaned up periodically

• Whichever first runs after cache cleanup “wins”

Page 29: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 29http://www.flickr.com/photos/82219206@N00/7003641975/

Page 30: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 30

Correct answer

• Test script leaves background daemon process behind

• Over time it’ll slowly choke slaves

Page 31: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 31

Page 32: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 32

Throw away & create new

Elasticity!

Page 33: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 33

Page 34: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 34

Ladder to Cloud

Single

MultipleElastic

Page 35: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 35

Solid OSS Elasticity Plugins

• EC2 plugin• Jclouds plugin– OpenStack, CloudStack

• Launch and tear down slaves on demand

Page 36: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 36

VMWare auto-scaling plugin

• Snapshot• Power on-off management• Hypervisor-aware scheduling• Folder based pooling• VMWare tools integration• One-time use support

Page 37: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 37

Host that runs Docker

Docker plugin

Page 38: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 38

Mansion

Slave Slave

Slave Slave

CloudBees DEV@cloud

Page 39: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 39

Maven

Git

Ant

Mercurial

Gradle

Subversion

Linux Kernel

Hardware

Linux Container = zero cost virtualization

Page 40: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 40

For OS X

Maven

Git

XCode

Git

XCode

Subversion

OS X OS X OS X

QEMU QEMU QEMU

Linux Kernel

Apple Hardware

Page 41: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 41

Kernel Same-page Merging

OS X OS X OS X

Page 42: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 42

Page 43: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 43

Mansion

Slave

Slave

Slave

Workspace 1

Workspace 2

Workspace 3

Workspace 4

Page 44: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 44

Slave

Slave

Workspace

Workspace’’

Workspace’

Page 45: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 45

Slave

Slave

~/.m2/repository

~/.m2/repository

~/.m2/repository

Page 46: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 46

Parallel Testing

Test Group #1 Test Group #2 Test Group #3

Page 47: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 47

Parallel Testing

foo #10 Test Group #1

foo #11 Test Group #2

foo #12 Test Goup #3

Page 48: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 48

Validated Merge

upstreamrepo

gate repo

Page 49: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 49

Workflow

Page 50: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 50

Workflow System

• Alternative to “freestyle” projects• Scripted control flow• Resumable execution across restarts• All-in-one build/test/deploy pipelines• Under active development

Page 51: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 51

Workflow with Elastic Slaves

• One-line provisioning from cloud• Language-level parallelism• Run commands, archive files, test

results• Now integrates with parallel test plugin

Page 52: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 52

Demo

Page 53: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 53

Conclusion: Elasticity Benefits

• Just-in-time capacity• Diversity without overhead• Isolation• Productivity gain– parallel testing– validated merge– workflow

Page 54: ©2013 CloudBees, Inc. All Rights Reserved 1 Next Step in Automation: Elastic Build Environment Kohsuke Kawaguchi / CloudBees, Inc. kk@kohsuke.org / @kohsukekawa.

©2013 CloudBees, Inc. All Rights Reserved 54