Build Trust in Your Build-to-Deployment Flow!

Preview:

DESCRIPTION

Frequently deploying to production puts bigger pressure than before on DevOps to make sure the good, qualified application is provisioned with no mistakes. This session will explore some common pitfalls with traditional Continuous-Integration that increase risk, introduce manual input and human error, and generally make DevOps cringe before hitting the “deploy” button. We will then demonstrate automation techniques that overcome these issues using popular tools, like Maven, Gradle, your CI server, custom scripts and a Binary Repository. Whether you are building software for the cloud or in-house, this presentation will show you how to have completely automated production builds that release applications which are fully traceable, managed and ready to be provisioned with no fear!

Citation preview

Build Trust in Your Build-to-Deployment Flow

Baruch Sadogursky, JFrog

Baruch Sadogursky Developer Advocate @JFrog

>Job definition (part of): Hang out with the DevOps guys

@jbaruch

2

About me

JavaOne Russia 2012

The cloud silver bullet The right tool for the job Binaries all the way The magic of release

Agenda

JavaOne Russia 2012 3

EVERYTHING *aaSThe New Silver Bullet

What’s So Good About *aaS?

*aaS features Continuous Delivery

JavaOne Russia 2012 5

User advantages>Latest version/features>No upgrades/maintenance

Developer advantages>Agile>Rapid feedback>Users are the best beta-testers>No long-term support

Everybody wins?

6

Continuous Delivery FTW

JavaOne Russia 2012

7

Used to quarterly release cycles “Secure” pace Minimizing the entropy caused by

developers with ADD

Almost, except the IT

JavaOne Russia 2012

8

Herding Cats

Developers>Increasing entropy

+IT (operations)

>Maintaining stability

=DevOps

>Stable change

JavaOne Russia 2012

Continuous Delivery Challenge

Very frequent releases More than one version in production Complicated access levels Root cause analysis

>Tracing from binaries to source Version tracking Not everyone is ready for CD

9JavaOne Russia 2012

Continuous Delivery Challenge

Very frequent releases More than one version in production Complicated access levels Root cause analysis

>Tracing from binaries to source Version tracking Not everyone is ready for CD

10JavaOne Russia 2012

It’s… Agile!

11JavaOne Russia 2012

Agile principles applied for DevOps We have good tooling for Agile

development>Version control>Unit testing and code coverage>CI servers>Hot swap tools

What’s up with tooling for agile DevOps?

Agile Tooling for DevOps Checklist

Versioning Access control Traceability Promotions Tags and

annotations Search

12JavaOne Russia 2012

How Do I Know?

JFrog SaaS offering>Artifactory Online

› Gradle, Grails, SpringSource, Typesafe, Jenkins, etc.

We build, release and eat our own dog food>Continuously

13JavaOne Russia 2012

HERE COMES BINARY REPOSITORYThe Right Tool for the Job

Here Comes Binary Repository

15JavaOne Russia 2012

E.g. Artifactory Proxy Smart storage

>Much more than a passive space Critical for CI/CD and ALM

16

Tooling Chain

JavaOne Russia 2012

17

Artifactory in DevOps Ecosystem

JavaOne Russia 2012

DEMO TIME!Meet Your Binary Repository

Binaries All the Way

From some point product in your lifecycle, all you care about is binaries

Lots of things to do after the software is built

JavaOne Russia 2012 19

20

The Release Pipeline

Source: Agile ALM, Michael Hüttermann, Manning Publications Co.

JavaOne Russia 2012

Passing the software to QA

Different access rights Different physical location Ability to annotate

JavaOne Russia 2012 21

Staging and Preproduction

Replication of Production environment>Lock versions of dependencies and

artifacts Allow access to set of users

JavaOne Russia 2012 22

Going to Production

Convert staging binaries to production

Allow public access Change settings Tag

JavaOne Russia 2012 23

Traceability

Binaries should be traceable at every stage>Sources >Dependencies>Environment details>Tags

Where’s the information?>Version control system>Build server

JavaOne Russia 2012 24

Traceability with Artifactory Plugin

Adding Metadata about the build>Gathers build information>Uploads artifacts in a bulk>Uploads build information>Maintains bi-directional links

JavaOne Russia 2012 25

DEMO TIME!Tracing Artifacts

WHAT MY FRIENDS THINK I DODevOps

What Others Think I Do

JavaOne Russia 2012 28

What I Think I Do

JavaOne Russia 2012 29

What I Really Do

JavaOne Russia 2012 30

What I Really Do

JavaOne Russia 2012 31

32

What I should Do

JavaOne Russia 2012

33

Target: Automation

It’s impossible to release frequently with manual procedures>While maintaining quality

Use your binaries storage to release

JavaOne Russia 2012

THE MAGIC OF RELEASEPut your repository to work

Release Candidates

Your next build is a release-candidate

Once successfully built and tested, click the button>Automatic versions switch

› From integration to release

>Right place to put your binaries› Move from Staging to Public

>Automatic VCS tagging

JavaOne Russia 2012 35

Releasing with Release Candidates

Process:1. Produce and build snapshots until

satisfied2. Once satisfied, build a release

candidate3. Stage RC, check and verify4. Once verified, release

JavaOne Russia 2012 36

Releasing With Artifactory Plugin

JavaOne Russia 2012 37

Changes versions in build script Allows choosing a target deploy

repository Creates a VCS tag/branch

DEMO TIME!Release With Release Candidates

OOTB Release Management

Pros>Out of the box>Supports the

“by the book” release cycle

>Supports majority of the tools

Cons>Limited

extensibility>May not fit

your requirements

JavaOne Russia 2012

Releasing with Release Candidates

Process:1. Produce and build snapshots until

satisfied2. Once satisfied, build a release

candidate3. Stage RC, check and verify4. Once checked, release

JavaOne Russia 2012 40

Releasing with Release Candidates

Process:1. Produce and build snapshots until

satisfied2. Once satisfied, build release

candidate3. Stage RC, check and verify4. Once checked, release

JavaOne Russia 2012 41

Redundant build

Releasing with Release Candidates

Lots of things can go wrong during one more build

If we won’t build it, we won’t screw it Revised Process:

1. Produce and build snapshots until satisfied

2. When satisfied, check and verify3. Once checked, release

JavaOne Russia 2012 42

43

Target: Automation

It’s impossible to release frequently with manual procedures>While maintaining quality

Use your binaries storage to release

JavaOne Russia 2012

Automation Flexibility

YMMV (great deal)

Write your own release logic

Pre and post build deploy hooks

JavaOne Russia 2012 44

We Know: We Don’t Know Better

Flexible Release

Code your release strategy>Versioning scheme>VCS (tagging, branching, commit

comments)>Promotion hook (copy/move, comments,

status) Available by REST

JavaOne Russia 2012 45

Controlling Versioning Scheme

Classic versioning scheme:>Release version

› 2.0.3

>Integration version› 2.0.4-SNAPSHOT

YMMV>Write your own strategy for versioning

JavaOne Russia 2012 46

Example: Promotion of Snapshots

Sometimes the build takes long time…

But that’s the silly reason

47JavaOne Russia 2012

Example: Promotion of Snapshots

Choose existing build to become a release

Using REST API without build server Invoke promotion plugin

>Convert to next version>Tag, branch, etc.>Promote (copy/move)

JavaOne Russia 2012 48

CODE TIME!Plugin What?

Artifactory is open for user plugins Simple Groovy DSL Your code runs inside the server Uses Public API (PAPI)

>Search for artifacts>Search for builds>Copy/move artifacts>Manipulate files

› E.g. change versions in descriptors

Pluggable Architecture with DSLs

JavaOne Russia 2012

51

As a response for various events>Download/Create/Delete>Login>Release

Scheduled On demand

JavaOne Russia 2012

Plugin Invocation Options

52

Plugin Code

Manipulating Version Control Systems

JavaOne Russia 2012

53

Plugin Code

Manipulating BuildInfo object

JavaOne Russia 2012

54

Plugin Code

Creating and replacing artifactsJavaOne Russia 2012

55

http://repo-demo:8080/artifactory/api/plugins/build/promote/snapshotToRelease/gradle-multi-example/1?params=snapExp=d14|targetRepository=gradle-release-local

JavaOne Russia 2012

Calling REST API With CURL

56

http://repo-demo:8080/artifactory/api/plugins/build/promote/snapshotToRelease/gradle-multi-example/1?params=snapExp=d14|targetRepository=gradle-release-local

JavaOne Russia 2012

Calling REST API With CURL

57

http://repo-demo:8080/artifactory/api/plugins/build/promote/snapshotToRelease/gradle-multi-example/1?params=snapExp=d14|targetRepository=gradle-release-local

JavaOne Russia 2012

Calling REST API With CURL

Artifactory server

58

http://repo-demo:8080/artifactory/api/plugins/build/promote/snapshotToRelease/gradle-multi-example/1?params=snapExp=d14|targetRepository=gradle-release-local

JavaOne Russia 2012

Calling REST API With CURL

Artifactory server

Plugins API

59

http://repo-demo:8080/artifactory/api/plugins/build/promote/snapshotToRelease/gradle-multi-example/1?params=snapExp=d14|targetRepository=gradle-release-local

JavaOne Russia 2012

Calling REST API With CURL

Artifactory server

Plugins API

Plugin name

60

http://repo-demo:8080/artifactory/api/plugins/build/promote/snapshotToRelease/gradle-multi-example/1?params=snapExp=d14|targetRepository=gradle-release-local

JavaOne Russia 2012

Calling REST API With CURL

Artifactory server

Plugins API

Plugin name

Build name and number

61

http://repo-demo:8080/artifactory/api/plugins/build/promote/snapshotToRelease/gradle-multi-example/1?params=snapExp=d14|targetRepository=gradle-release-local

JavaOne Russia 2012

Calling REST API With CURL

Artifactory server

Plugins API

Plugin name

Build name and number

versioning scheme

62

http://repo-demo:8080/artifactory/api/plugins/build/promote/snapshotToRelease/gradle-multi-example/1?params=snapExp=d14|targetRepository=gradle-release-local

JavaOne Russia 2012

Calling REST API With CURL

Artifactory server

Plugins API

Plugin name

Build name and number

versioning scheme

Target repository for release

Recap: Promotion of Snapshots

Choose existing build to become a release

Using the REST API without building Invoking the promotion plugin

>Convert to next version>Tag, branch, etc.>Promote (copy/move)

JavaOne Russia 2012 63

DEMO TIME!Release by Snapshot Promotion

4 Commandments of DevOps

Automate everything

Version everything

Trace everything

Report/Log/Feedback everything

JavaOne Russia 2012 65

Designed by Jessica Allen on Dribbble.com

4 Commandments of DevOps

Automate everything

Version everything

Trace everything

Report/Log/Feedback everything

JavaOne Russia 2012 66

Designed by Jessica Allen on Dribbble.com

Recommended