+ All Categories
Home > Software > JavaOne 2015: Scalable Continous Deployment with Maven

JavaOne 2015: Scalable Continous Deployment with Maven

Date post: 15-Apr-2017
Category:
Upload: abraham-marin-perez
View: 359 times
Download: 2 times
Share this document with a friend
83
Scalable Connuous Deployment with Maven fromfragiletoagile.com @AbrahamMarin
Transcript
Page 1: JavaOne 2015: Scalable Continous Deployment with Maven

Scalable Continuous Deployment with Maven

fromfragiletoagile.com@AbrahamMarin

Page 2: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

Page 3: JavaOne 2015: Scalable Continous Deployment with Maven

About Me

@AbrahamMarin

Page 4: JavaOne 2015: Scalable Continous Deployment with Maven

About Me

@AbrahamMarin

Page 5: JavaOne 2015: Scalable Continous Deployment with Maven

About Me

@AbrahamMarin

Page 6: JavaOne 2015: Scalable Continous Deployment with Maven

Table of Contents

• Continuous Deployment with Maven• Scaling Continuous Deployment• Analyse Data from the CI System• Automate Analysis and Visualisation

@AbrahamMarin

Page 7: JavaOne 2015: Scalable Continous Deployment with Maven

Table of Contents

• Continuous Deployment with Maven• Scaling Continuous Deployment• Analyse Data from the CI System• Automate Analysis and Visualisation

@AbrahamMarin

Page 8: JavaOne 2015: Scalable Continous Deployment with Maven

What is Continuous Deployment?

Continuous Integration: check everything is still working after every commit•• Continuous Deployment: every successful

commit turns into a release•

@AbrahamMarin

Page 9: JavaOne 2015: Scalable Continous Deployment with Maven

Why maven?

• Just because…

@AbrahamMarin

Page 10: JavaOne 2015: Scalable Continous Deployment with Maven

Other technologies

@AbrahamMarin

Page 11: JavaOne 2015: Scalable Continous Deployment with Maven

To Caesar what is Caesar’s

Based on John Ferguson Smart’s“Real-World Strategies for Continuous Delivery with maven and Jenkins”

http://youtu.be/McTZtyb9M38

@AbrahamMarin

Page 12: JavaOne 2015: Scalable Continous Deployment with Maven

John’s approach

Maven wasn’t built for Continuous Deployment

commitcommitcommit...

0.0.1-SNAPSHOT

Release!

0.0.1

@AbrahamMarin

Page 13: JavaOne 2015: Scalable Continous Deployment with Maven

John’s approach

Don’t use RELEASE pluginUse VERSIONS plugin

Set version to <version scheme>.<build number>Run mvn deployCommit pom file to repository

@AbrahamMarin

Page 14: JavaOne 2015: Scalable Continous Deployment with Maven

John’s approachSet version to <version scheme>.<build number>

mvn versions:set –DnewVersion=**your version**

@AbrahamMarin

Page 15: JavaOne 2015: Scalable Continous Deployment with Maven

John’s approachRun mvn deploy

mvn clean deploy

@AbrahamMarin

Page 16: JavaOne 2015: Scalable Continous Deployment with Maven

John’s approachCommit pom file to repository

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-scm-plugin</artifactId><version>1.9.1</version><executions><execution><id>commit</id><phase>deploy</phase><goals>

<goal>checkin</goal></goals>

</execution></executions></plugin>

@AbrahamMarin

Page 17: JavaOne 2015: Scalable Continous Deployment with Maven

John’s approach

@AbrahamMarin

Page 18: JavaOne 2015: Scalable Continous Deployment with Maven

John’s approach

0.0.1.1commit

BUILD!

0.0.1.2commit

BUILD!

0.0.1.3commit

BUILD!

@AbrahamMarin

Page 19: JavaOne 2015: Scalable Continous Deployment with Maven

Table of Contents

• Continuous Deployment with Maven• Scaling Continuous Deployment• Analyse Data from the CI System• Automate Analysis and Visualisation

@AbrahamMarin

Page 20: JavaOne 2015: Scalable Continous Deployment with Maven

How do you scale this?

@AbrahamMarin

Page 21: JavaOne 2015: Scalable Continous Deployment with Maven

SUPER APP

# Files: 75# Tests: 800Build Time: 4 minOutput: superapp.war

@AbrahamMarin

Page 22: JavaOne 2015: Scalable Continous Deployment with Maven

SUPER APP

# Files: 113# Tests: 1200Build Time: 6 minOutput: superapp.war

@AbrahamMarin

Page 23: JavaOne 2015: Scalable Continous Deployment with Maven

SUPER APP

# Files: 169# Tests: 1800Build Time: 9 minOutput: superapp.war

@AbrahamMarin

Page 24: JavaOne 2015: Scalable Continous Deployment with Maven

When Builds Get Too Big

@AbrahamMarin

"MAN Atlante fronte 1040572" by Lalupa - Own work. Licensed under GFDL via Commons - https://commons.wikimedia.org/wiki/File:MAN_Atlante_fronte_1040572.JPG#/media/File:MAN_Atlante_fronte_1040572.JPG

Page 25: JavaOne 2015: Scalable Continous Deployment with Maven

SUPER APP

# Files: 169# Tests: 1800Build Time: 9 minOutput: superapp.war

APP BACKEND

SUPER APP

# Files: 115# Tests: 1200Build Time: 6 minOutput: superapp.war

# Files: 72# Tests: 800Build Time: 4 minOutput: appbackend.jar

@AbrahamMarin

Page 26: JavaOne 2015: Scalable Continous Deployment with Maven

<dependency><groupId>com.superappfactory</groupId><artifactId>appbackend</artifactId><version>??????</version></dependency>

<dependency><groupId>com.superappfactory</groupId><artifactId>appbackend</artifactId><version>LATEST</version></dependency>

Setting up dependencies

APP BACKEND

SUPER APP

appbackend.jar superapp.war

@AbrahamMarin

Page 27: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

Page 28: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

Page 29: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

Page 30: JavaOne 2015: Scalable Continous Deployment with Maven

Setting up dependencies

APP BACKEND

SUPER APP

appbackend.jar superapp.war

@AbrahamMarin

Page 31: JavaOne 2015: Scalable Continous Deployment with Maven

Rebuilding old versions

@AbrahamMarin

Page 32: JavaOne 2015: Scalable Continous Deployment with Maven

Rebuilding old versions

Using “LATEST” makes it impossible to build old versions correctly

@AbrahamMarin

Page 33: JavaOne 2015: Scalable Continous Deployment with Maven

<dependency><groupId>com.superappfactory</groupId><artifactId>appbackend</artifactId><version>???????</version></dependency>

<dependency><groupId>com.superappfactory</groupId><artifactId>appbackend</artifactId><version>1.5.3.1</version></dependency>

Rebuilding old versions

APP BACKEND

SUPER APP

appbackend.jar superapp.war

@AbrahamMarin

Page 34: JavaOne 2015: Scalable Continous Deployment with Maven

Update versions of dependenciesmvn versions:use-latest-releases

@AbrahamMarin

Page 35: JavaOne 2015: Scalable Continous Deployment with Maven

APP BACKEND

SUPER APP

APP BACKEND

SUPER APP

DATA MODEL

SUPER APP

DATA MODEL

GUI

APP BACKEND

Page 36: JavaOne 2015: Scalable Continous Deployment with Maven

Like it?

@AbrahamMarin

Page 37: JavaOne 2015: Scalable Continous Deployment with Maven

Like it?

@AbrahamMarin

Page 38: JavaOne 2015: Scalable Continous Deployment with Maven

Like it?

@AbrahamMarin

Page 39: JavaOne 2015: Scalable Continous Deployment with Maven

Like it?

@AbrahamMarin

Page 40: JavaOne 2015: Scalable Continous Deployment with Maven

Like it?

@AbrahamMarin

Page 41: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

http://thechive.com/2014/02/26/youre-doing-it-wrong-31-photos-2/

Page 42: JavaOne 2015: Scalable Continous Deployment with Maven

I Can Help

@AbrahamMarin

Page 43: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Infinite Trigger

commitbuild

deploy

commit

@AbrahamMarin

Page 44: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

Page 45: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

Page 46: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Unnecessary rebuilds

APP BACKEND

SUPER APP

commit

@AbrahamMarin

Page 47: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

Page 48: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Unnecessary rebuilds

@AbrahamMarin

Page 49: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Unnecessary rebuilds

Get last committer

buildAgent?

Proceed normally

Don’t run build

NO YES

touch skip_build

@AbrahamMarin

Page 50: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Unnecessary rebuilds<profiles><!-- Plugins that need to be disabled when doing a no-run --><profile><id>do.nothing</id><activation><file>

<exists>skip_build</exists></file></activation>

<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.1</version><configuration>

<skipMain>true</skipMain><skip>true</skip>

</configuration></plugin>

@AbrahamMarin

Page 51: JavaOne 2015: Scalable Continous Deployment with Maven

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-install-plugin</artifactId><version>2.5.2</version><configuration>

<skip>true</skip></configuration></plugin>

<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-deploy-plugin</artifactId><version>2.8.2</version><configuration>

<skip>true</skip></configuration></plugin>

Problem: Unnecessary rebuilds

@AbrahamMarin

Page 52: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Unnecessary rebuilds

APP BACKEND

SUPER APP

commit

@AbrahamMarin

Page 53: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Unnecessary rebuilds

@AbrahamMarin

Page 54: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Necessary rebuilds

APP BACKEND

SUPER APP

commit

@AbrahamMarin

Page 55: JavaOne 2015: Scalable Continous Deployment with Maven

Get last committer

buildAgent?

Proceed normally

Don’t run build

NO YES

Problem: Necessary rebuilds

@AbrahamMarin

Page 56: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

Page 57: JavaOne 2015: Scalable Continous Deployment with Maven

Get last committer

buildAgent?

Proceed normally

NO YES

Check dependencies

Up to date?

NO Don’t run build

YES

touch skip_build

@AbrahamMarin

Page 58: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Necessary rebuilds

@AbrahamMarin

Page 59: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Doomed Build

build

deploy

commit

commit

commitpom.xml

@AbrahamMarin

Page 60: JavaOne 2015: Scalable Continous Deployment with Maven

Get last committer

buildAgent?

Proceed normally

NO YES

Check dependencies

Up to date?

NO Don’t run build

YES

touch skip_build

@AbrahamMarin

Page 61: JavaOne 2015: Scalable Continous Deployment with Maven

Get last committer

buildAgent?

Check pom.xml

NO YES

Check dependencies

Up to date?

NO

Don’t run build

YES

touch skip_build

Up to date?

NO

Proceed normally

YES

@AbrahamMarin

Page 62: JavaOne 2015: Scalable Continous Deployment with Maven

Problem: Doomed Build

@AbrahamMarin

Page 63: JavaOne 2015: Scalable Continous Deployment with Maven

@AbrahamMarin

Page 64: JavaOne 2015: Scalable Continous Deployment with Maven

Table of Contents

• Continuous Deployment with Maven• Scaling Continuous Deployment• Analyse Data from the CI System• Automate Analysis and Visualisation

@AbrahamMarin

Page 65: JavaOne 2015: Scalable Continous Deployment with Maven

A real case scenario

@AbrahamMarin

Page 66: JavaOne 2015: Scalable Continous Deployment with Maven

WAR file

WAR file

WAR file

Parent POM

Logging@AbrahamMarin

Page 67: JavaOne 2015: Scalable Continous Deployment with Maven

WAR file

WAR file

WAR file

Parent POM

Logging

28%

@AbrahamMarin

Page 68: JavaOne 2015: Scalable Continous Deployment with Maven

WAR file

WAR file

WAR file

Parent POM

Logging

28%

28%

28%

@AbrahamMarin

Page 69: JavaOne 2015: Scalable Continous Deployment with Maven

WAR file

WAR file

WAR file

Parent POM

Logging

28%

28%

28%

20%

@AbrahamMarin

Page 70: JavaOne 2015: Scalable Continous Deployment with Maven

WAR file

WAR file

WAR file

Parent POM

Logging

48%

28%

28%

20%

@AbrahamMarin

Page 71: JavaOne 2015: Scalable Continous Deployment with Maven

WAR file

WAR file

WAR file

Parent POM

Logging@AbrahamMarin

Page 72: JavaOne 2015: Scalable Continous Deployment with Maven

WAR file

WAR file

WAR file

@AbrahamMarin

Page 73: JavaOne 2015: Scalable Continous Deployment with Maven

Build-Driven Architecture

@AbrahamMarin

Page 74: JavaOne 2015: Scalable Continous Deployment with Maven

Table of Contents

• Continuous Deployment with Maven• Scaling Continuous Deployment• Analyse Data from the CI System• Automate Analysis and Visualisation

@AbrahamMarin

Page 75: JavaOne 2015: Scalable Continous Deployment with Maven

WAR file

WAR file

WAR file

@AbrahamMarin

Page 76: JavaOne 2015: Scalable Continous Deployment with Maven

Manual processingtakes time...

@AbrahamMarin

Page 77: JavaOne 2015: Scalable Continous Deployment with Maven

Automating Build Analysis

• Most CI systems provide an API• Calculations aren’t complex• Multiple graphical tools available

@AbrahamMarin

Page 78: JavaOne 2015: Scalable Continous Deployment with Maven

Build Hotspots

github.com/quiram/build-hotspots

@AbrahamMarin

Page 79: JavaOne 2015: Scalable Continous Deployment with Maven

Automating Build Analysis

• Add colour and size• Add support for other CI systems• Show subset of builds• Update data automatically (for build displays)• Anything else you may find useful!

@AbrahamMarin

Page 80: JavaOne 2015: Scalable Continous Deployment with Maven

Summary

• Setting up Continuous Deployment is possible• Scaling is challenging, but also possible• Build data can help you shape the architecture

of your application• Still plenty to improve, please join me

@AbrahamMarin

Page 81: JavaOne 2015: Scalable Continous Deployment with Maven

Questions?

@AbrahamMarin

Page 82: JavaOne 2015: Scalable Continous Deployment with Maven

fromfragiletoagile.com@AbrahamMarin

Thank You!

Page 83: JavaOne 2015: Scalable Continous Deployment with Maven

Recommended