Slide 1

Slide 1 text

Continuous Integration Jenkins, Git and Grails Mike Hugo Entagen, LLC

Slide 2

Slide 2 text

ACCELERATING INSIGHT ENTAGEN

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

In The Beginning (of Triplemap)

Slide 6

Slide 6 text

There Was Source Control

Slide 7

Slide 7 text

And it was good

Slide 8

Slide 8 text

Idea Code Build Deploy Test Feedback Start Here

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

( )

Slide 13

Slide 13 text

Initial Process •Code •Commit/Push •Automated Build •Deploy to Test •Deploy to Prod

Slide 14

Slide 14 text

Initial Process •Code •Commit/Push •Automated Build •Deploy to Test •Deploy to Prod

Slide 15

Slide 15 text

Initial Process •Code •Commit/Push •Automated Build •Deploy to Test •Deploy to Prod

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

continuous integration server

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor println ''' awesome code ''' push

Slide 20

Slide 20 text

field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor println ''' awesome code ''' push poll for change every X minutes

Slide 21

Slide 21 text

field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor field value name “mike hugo” company “Entagen” bio “lorem ipsum dolor println ''' awesome code ''' # change found git clone ... grails clean grails test-app grails war # save artifacts push

Slide 22

Slide 22 text

quick start

Slide 23

Slide 23 text

http://jenkins-ci.org/ download the latest war java -jar jenkins.war

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

install plugins

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

configure plugins

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

create a job

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Idea Code Build Deploy Test Feedback

Slide 38

Slide 38 text

Idea Code Build Deploy Test Feedback == Feature

Slide 39

Slide 39 text

Author: Vincent Driessen Original blog post: http://nvie.com/archives/323 License: Creative Commons

Slide 40

Slide 40 text

Feature Branches Master Release

Slide 41

Slide 41 text

Better Process •Feature Branch •Code •Commit/Push •Pull Request •Merge into Master •Automated Build •Deploy to Prod

Slide 42

Slide 42 text

Feature Branches

Slide 43

Slide 43 text

Master Branch Always Deployable To Production

Slide 44

Slide 44 text

Peer Review

Slide 45

Slide 45 text

Client Feedback

Slide 46

Slide 46 text

6 Months 365 Pull Requests

Slide 47

Slide 47 text

23% 77% Bug/Enhancement Identified Direct Merge

Slide 48

Slide 48 text

(Yep, that’s the master branch) whoops.

Slide 49

Slide 49 text

Even Better Process •Feature Branch •Code •Commit/Push •Automated Build (per branch!!) •Pull Request •Merge into Master •Automated Build •Deploy to Prod

Slide 50

Slide 50 text

Even Better Process •Feature Branch •Code •Commit/Push •Automated Build (per branch!!) •Pull Request •Merge into Master •Automated Build •Deploy to Prod Now that would be awesome

Slide 51

Slide 51 text

.........

Slide 52

Slide 52 text

Build Per Branch Project Master Branch Build

Slide 53

Slide 53 text

Master Branch Build Build Per Branch Project Feature Branches Master foo

Slide 54

Slide 54 text

Master Branch Build Build Per Branch Project Feature Branches Master foo copy configuration

Slide 55

Slide 55 text

Master Branch Build Build Per Branch Project Feature Branches Master foo foo Branch Build create

Slide 56

Slide 56 text

Master Branch Build Build Per Branch Project Feature Branches Master foo foo Branch Build merge

Slide 57

Slide 57 text

Clean Up

Slide 58

Slide 58 text

#!/usr/bin/env bash git checkout master git fetch --all -p git pull echo about to delete: git branch -r --merged master | sed 's/ *origin\///' | egrep -v '(master$| ^release/)' echo actually deleting: git branch -r --merged master | sed 's/ *origin\///' | egrep -v '(master$| ^release/)' | xargs -I% git push origin :%

Slide 59

Slide 59 text

Master Branch Build Build Per Branch Project Feature Branches Master foo foo Branch Build merge Purge Merged delete

Slide 60

Slide 60 text

Master Branch Build Build Per Branch Project Feature Branches Master foo Branch Build delete

Slide 61

Slide 61 text

Master Branch Build Build Per Branch Project Feature Branches Master

Slide 62

Slide 62 text

Demo

Slide 63

Slide 63 text

Build.gradle sk syncWithRepo(dependsOn: 'classes', type: Java main = 'com.entagen.jenkins.Main' classpath = sourceSets.main.runtimeClasspath // pass through specified system properties to ['help', 'jenkinsUrl', 'jenkinsUser', ...].eac if (System.getProperty(it)) systemProperty it, System.getProperty(it }

Slide 64

Slide 64 text

-DjenkinsUrl

Slide 65

Slide 65 text

-DjenkinsUser

Slide 66

Slide 66 text

-DjenkinsPassword

Slide 67

Slide 67 text

-DgitUrl

Slide 68

Slide 68 text

-DtemplateJobPrefix --

Slide 69

Slide 69 text

-DtemplateBranchName --

Slide 70

Slide 70 text

-DbranchNameRegex

Slide 71

Slide 71 text

-DnestedView

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

-DdryRun

Slide 75

Slide 75 text

-DjenkinsUrl=http://localhost:8080/ [email protected]:mjhugo/myapp.git -DtemplateJobPrefix=MyApp -DtemplateBranchName=master

Slide 76

Slide 76 text

Watch Out For:

Slide 77

Slide 77 text

~/.grails

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

Test Pollution

Slide 80

Slide 80 text

Master Branch Build foo Branch Build bar Branch Build Grails 1.3.7 Grails 2.0.3 Grails 2.1.0.RC2 Build Tool Versions

Slide 81

Slide 81 text

Master Branch Build foo Branch Build bar Branch Build Grails 1.3.7 Grails 2.0.3 Grails 2.1.0.RC2 Build Tool Versions

Slide 82

Slide 82 text

No Support For Authenticated Jenkins

Slide 83

Slide 83 text

No Support For Authenticated Jenkins (Patches Welcomed!) Fixed!

Slide 84

Slide 84 text

More Horsepower

Slide 85

Slide 85 text

Cloning Large Repos

Slide 86

Slide 86 text

No content

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

Our Process • Feature Branch • Code • Commit/Push • Automated Build (per branch) •Automated Deploy (per branch) • Pull Request • Merge into Master • Automated Build • Deploy to Prod

Slide 89

Slide 89 text

Our Process • Feature Branch • Code • Commit/Push • Automated Build (per branch) •Automated Deploy (per branch) • Pull Request • Merge into Master • Automated Build • Deploy to Prod Coming Soon!

Slide 90

Slide 90 text

Lightweight • Feature Branch • Code • Commit/Push • Automated Build (per branch) • Automated Deploy (per branch) • Pull Request • Merge into Master • Automated Build • Deploy to Prod

Slide 91

Slide 91 text

Fail Fast

Slide 92

Slide 92 text

Build Better

Slide 93

Slide 93 text

No content

Slide 94

Slide 94 text

Thank You happy branching [email protected] @piragua http://www.triplemap.com http://www.entagen.com TripleMap http://entagen.github.com/jenkins-build-per-branch/