	alexsotob		
J E N K I N S 	 P I P E L I N E , 	 J E N K I N S 	 2 . 0
A N D 	 B E Y O N D
A L E X 	 S O T O
R E D 	 H A T 	 E N G I N E E R
O P E N 	 S O U R C E 	 A D V O C A T E
@ A L E X S O T O B
	alexsotob		lordofthejars
Q U E S T I O N S
	alexsotob		lordofthejars
S O F T W A R E 	I S
E A T I N G 	 T H E 	W O R L D
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
Faster
	alexsotob		lordofthejars
Faster
Sooner
	alexsotob		lordofthejars
Faster
Sooner
Better
	alexsotob		lordofthejars
W H A T 	 I S 	C O N T I N U O U S 	 D E L I V E R Y?
	alexsotob		lordofthejars
D E L I V E R 	 B U S I N E S S 	 V A L U E	M O R E 	 F R E Q U E N T L Y
	alexsotob		lordofthejars
	alexsotob		lordofthejars
with	Jenkins
O R C H E S T R A T I N G 	S T A G E S
	alexsotob		lordofthejars
	alexsotob		lordofthejars
J E N K I N S 	 1 . X X X
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
N O 	 M O R E 	J O B S 	P L E A S E
	alexsotob		lordofthejars
	alexsotob		lordofthejars
J E N K I N S 	 P I P E L I N E - A S - C O D E
	alexsotob		lordofthejars
F E A T U R E S 	 O F 	 P I P E L I N E 	 E C O S Y S T E M
Configuration
in
Source
Repositories
F E A T U R E S 	 O F 	 P I P E L I N E 	 E C O S Y S T E M
Configuration
in
Source
Repositories
Less
click-and-type,
more
code
F E A T U R E S 	 O F 	 P I P E L I N E 	 E C O S Y S T E M
Configuration
in
Source
Repositories
Less
click-and-type,
more
code
From
simple
to
complex
F E A T U R E S 	 O F 	 P I P E L I N E 	 E C O S Y S T E M
Configuration
in
Source
Repositories
Less
click-and-type,
more
code
From
simple
to
complex
Survives
Jenkins
restarts
&
connection
losses
F E A T U R E S 	 O F 	 P I P E L I N E 	 E C O S Y S T E M
Configuration
in
Source
Repositories
Less
click-and-type,
more
code
From
simple
to
complex
Survives
Jenkins
restarts
&
connection
losses
Reusable
Definitions
F E A T U R E S 	 O F 	 P I P E L I N E 	 E C O S Y S T E M
Configuration
in
Source
Repositories
Less
click-and-type,
more
code
From
simple
to
complex
Survives
Jenkins
restarts
&
connection
losses
Reusable
Definitions
Build
history/trend
segregated
per
branches
F E A T U R E S 	 O F 	 P I P E L I N E 	 E C O S Y S T E M
Configuration
in
Source
Repositories
Less
click-and-type,
more
code
From
simple
to
complex
Survives
Jenkins
restarts
&
connection
losses
Reusable
Definitions
Build
history/trend
segregated
per
branches
UI
stage	('compile')	{stage	('compile')	{
		node	{		node	{
								checkout	scm								checkout	scm
								sh	"./gradlew	clean	compileJava"								sh	"./gradlew	clean	compileJava"
								stash	excludes:	'build/',	includes:	'**',	name:	'source'								stash	excludes:	'build/',	includes:	'**',	name:	'source'
		}		}
}}
J E N K I N S F I L E 	 ( 1 / 2 )
	alexsotob		lordofthejars
stage	('compile')	{stage	('compile')	{
		node	{		node	{
								checkout	scm								checkout	scm
								sh	"./gradlew	clean	compileJava"								sh	"./gradlew	clean	compileJava"
								stash	excludes:	'build/',	includes:	'**',	name:	'source'								stash	excludes:	'build/',	includes:	'**',	name:	'source'
		}		}
}}
stage	('commitTest')	{stage	('commitTest')	{
		parallel	'unit'	:	{		parallel	'unit'	:	{
				node	{				node	{
								unstash	'source'								unstash	'source'
								sh	"./gradlew	:test"								sh	"./gradlew	:test"
								stash	includes:	'build/jacoco/*.exec',	name:	'unitCodeCoverage'								stash	includes:	'build/jacoco/*.exec',	name:	'unitCodeCoverage'
								step([$class:	'JUnitResultArchiver',	testResults:	'**/build/test-results/*.xml'])								step([$class:	'JUnitResultArchiver',	testResults:	'**/build/test-results/*.xml'])
				}				}
		},	'integration':	{		},	'integration':	{
				node	{				node	{
								unstash	'source'								unstash	'source'
								sh	"./gradlew	-PhappyPath	:integration-test:test"								sh	"./gradlew	-PhappyPath	:integration-test:test"
								junit	'**/build/test-results/*.xml'								junit	'**/build/test-results/*.xml'
				}				}
		}		}
}}
J E N K I N S F I L E 	 ( 1 / 2 )
	alexsotob		lordofthejars
def	def	assembleassemble((String	switches	String	switches	==		nullnull))		{{
				run					run	'assemble''assemble',,	switches	switches
}}
J E N K I N S / G R A D L E . G R O O V Y
J E N K I N S F I L E 	 ( 2 / 2 )
	alexsotob		lordofthejars
def	def	assembleassemble((String	switches	String	switches	==		nullnull))		{{
				run					run	'assemble''assemble',,	switches	switches
}}
voidvoid		runrun((String	tasksString	tasks,,	String	switches		String	switches	==		nullnull))		{{
				String	gradleCommand					String	gradleCommand	==		"""";;
				gradleCommand					gradleCommand	++==		'./gradlew	''./gradlew	'
				gradleCommand					gradleCommand	++==	tasks	tasks
								ifif((switches	switches	!=!=		nullnull))		{{
								gradleCommand									gradleCommand	++==		'	''	'
								gradleCommand									gradleCommand	++==	switches	switches
								}}
				sh	gradleCommand				sh	gradleCommand..toStringtoString(())
}}
J E N K I N S / G R A D L E . G R O O V Y
J E N K I N S F I L E 	 ( 2 / 2 )
	alexsotob		lordofthejars
def	def	assembleassemble((String	switches	String	switches	==		nullnull))		{{
				run					run	'assemble''assemble',,	switches	switches
}}
voidvoid		runrun((String	tasksString	tasks,,	String	switches		String	switches	==		nullnull))		{{
				String	gradleCommand					String	gradleCommand	==		"""";;
				gradleCommand					gradleCommand	++==		'./gradlew	''./gradlew	'
				gradleCommand					gradleCommand	++==	tasks	tasks
								ifif((switches	switches	!=!=		nullnull))		{{
								gradleCommand									gradleCommand	++==		'	''	'
								gradleCommand									gradleCommand	++==	switches	switches
								}}
				sh	gradleCommand				sh	gradleCommand..toStringtoString(())
}}
returnreturn		thisthis;;
J E N K I N S / G R A D L E . G R O O V Y
J E N K I N S F I L E 	 ( 2 / 2 )
	alexsotob		lordofthejars
def	def	assembleassemble((String	switches	String	switches	==		nullnull))		{{
				run					run	'assemble''assemble',,	switches	switches
}}
voidvoid		runrun((String	tasksString	tasks,,	String	switches		String	switches	==		nullnull))		{{
				String	gradleCommand					String	gradleCommand	==		"""";;
				gradleCommand					gradleCommand	++==		'./gradlew	''./gradlew	'
				gradleCommand					gradleCommand	++==	tasks	tasks
								ifif((switches	switches	!=!=		nullnull))		{{
								gradleCommand									gradleCommand	++==		'	''	'
								gradleCommand									gradleCommand	++==	switches	switches
								}}
				sh	gradleCommand				sh	gradleCommand..toStringtoString(())
}}
returnreturn		thisthis;;
def	gradle	def	gradle	==	load		load	'jenkins/gradle.groovy''jenkins/gradle.groovy'
J E N K I N S / G R A D L E . G R O O V Y
J E N K I N S F I L E 	 ( 2 / 2 )
	alexsotob		lordofthejars
def	def	assembleassemble((String	switches	String	switches	==		nullnull))		{{
				run					run	'assemble''assemble',,	switches	switches
}}
voidvoid		runrun((String	tasksString	tasks,,	String	switches		String	switches	==		nullnull))		{{
				String	gradleCommand					String	gradleCommand	==		"""";;
				gradleCommand					gradleCommand	++==		'./gradlew	''./gradlew	'
				gradleCommand					gradleCommand	++==	tasks	tasks
								ifif((switches	switches	!=!=		nullnull))		{{
								gradleCommand									gradleCommand	++==		'	''	'
								gradleCommand									gradleCommand	++==	switches	switches
								}}
				sh	gradleCommand				sh	gradleCommand..toStringtoString(())
}}
returnreturn		thisthis;;
def	gradle	def	gradle	==	load		load	'jenkins/gradle.groovy''jenkins/gradle.groovy'
nodenode(('linux''linux'))		{{
				unstash					unstash	'source''source'
								withEnvwithEnv(([["SOURCE_BUILD_NUMBER=${env.BUILD_NUMBER}""SOURCE_BUILD_NUMBER=${env.BUILD_NUMBER}"]]))		{{
								gradle								gradle..assembleassemble(())
								}}
}}
J E N K I N S / G R A D L E . G R O O V Y
J E N K I N S F I L E 	 ( 2 / 2 )
	alexsotob		lordofthejars
D O C K E R 	P I P E L I N E 	 I N T E G R A T I O N
dockerdocker..withRegistrywithRegistry(('https://lordofthejars-docker-continuous_delivery.bintray.io''https://lordofthejars-docker-continuous_delivery.bintray.io',,		'd4fc3fa9-39f7-47ea-a57c-795642f90989''d4fc3fa9-39f7-47ea-a57c-795642f90989'))		{{
				git					git	'git@github.com:lordofthejars/busybox.git''git@github.com:lordofthejars/busybox.git'
				def	newApp					def	newApp	==	docker	docker..build	build	"lordofthejars-docker-continuous_delivery.bintray.io/lordofthejars/javatest:${env.BUILD_TAG}""lordofthejars-docker-continuous_delivery.bintray.io/lordofthejars/javatest:${env.BUILD_TAG}"
				newApp				newApp..pushpush(())
}}
J E N K I N S F I L E
	alexsotob		lordofthejars
dockerdocker..withRegistrywithRegistry(('https://lordofthejars-docker-continuous_delivery.bintray.io''https://lordofthejars-docker-continuous_delivery.bintray.io',,		'd4fc3fa9-39f7-47ea-a57c-795642f90989''d4fc3fa9-39f7-47ea-a57c-795642f90989'))		{{
				git					git	'git@github.com:lordofthejars/busybox.git''git@github.com:lordofthejars/busybox.git'
				def	newApp					def	newApp	==	docker	docker..build	build	"lordofthejars-docker-continuous_delivery.bintray.io/lordofthejars/javatest:${env.BUILD_TAG}""lordofthejars-docker-continuous_delivery.bintray.io/lordofthejars/javatest:${env.BUILD_TAG}"
				newApp				newApp..pushpush(())
}}
dockerdocker..imageimage(('lordofthejars/javatest''lordofthejars/javatest'))..withRun	withRun	{{c	c	-->>
		sh			sh	'./executeTests.sh''./executeTests.sh'
}}
J E N K I N S F I L E
	alexsotob		lordofthejars
dockerdocker..withRegistrywithRegistry(('https://lordofthejars-docker-continuous_delivery.bintray.io''https://lordofthejars-docker-continuous_delivery.bintray.io',,		'd4fc3fa9-39f7-47ea-a57c-795642f90989''d4fc3fa9-39f7-47ea-a57c-795642f90989'))		{{
				git					git	'git@github.com:lordofthejars/busybox.git''git@github.com:lordofthejars/busybox.git'
				def	newApp					def	newApp	==	docker	docker..build	build	"lordofthejars-docker-continuous_delivery.bintray.io/lordofthejars/javatest:${env.BUILD_TAG}""lordofthejars-docker-continuous_delivery.bintray.io/lordofthejars/javatest:${env.BUILD_TAG}"
				newApp				newApp..pushpush(())
}}
dockerdocker..imageimage(('lordofthejars/javatest''lordofthejars/javatest'))..withRun	withRun	{{c	c	-->>
		sh			sh	'./executeTests.sh''./executeTests.sh'
}}
dockerdocker..imageimage(('8-jdk-alpine''8-jdk-alpine'))..insideinside(('-v	~/.gradle:/root/.gradle	-u	1000:50''-v	~/.gradle:/root/.gradle	-u	1000:50'))		{{
				//	workspace	is	mounted	inside	image	automatically//	workspace	is	mounted	inside	image	automatically
		sh			sh	'./gradlew	compileJava''./gradlew	compileJava'
}}
J E N K I N S F I L E
	alexsotob		lordofthejars
	alexsotob		lordofthejars
M U L T I B R A N C H 	P I P E L I N E
	alexsotob		lordofthejars
M U L T I B R A N C H 	 P I P E L I N E 	 J O B
	alexsotob		lordofthejars
D A S H B O A R D 	 W I T H 	 D E T E C T E D 	 B R A N C H E S
	alexsotob		lordofthejars
U I 	 I M P R O V E M E N T S
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
W H A T 	 I S 	C O M I N G
	alexsotob		lordofthejars
New	UX	for	Jenkins
B L U E 	 O C E A N
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
	alexsotob		lordofthejars
M I S S I N G 	P I E C E S
	alexsotob		lordofthejars
F U T U R E 	 C H A N G E S
Scalability
	alexsotob		lordofthejars
F U T U R E 	 C H A N G E S
Scalability
Configuration
API
	alexsotob		lordofthejars
F U T U R E 	 C H A N G E S
Scalability
Configuration
API
Storage
Backend
Changes
	alexsotob		lordofthejars
D E M O 	 T I M E
	alexsotob		lordofthejars
L E T ' S 	 W I N D 	 D O W N
	alexsotob		lordofthejars
C O N C L U S I O N S
Pipeline
as
Code
for
Microservices
	alexsotob		lordofthejars
C O N C L U S I O N S
Pipeline
as
Code
for
Microservices
Easy
migration
from
Jenkins
1.X
to
2.X
	alexsotob		lordofthejars
C O N C L U S I O N S
Pipeline
as
Code
for
Microservices
Easy
migration
from
Jenkins
1.X
to
2.X
More
changes
in
near
future
	alexsotob		lordofthejars
C O N C L U S I O N S
Pipeline
as
Code
for
Microservices
Easy
migration
from
Jenkins
1.X
to
2.X
More
changes
in
near
future
Jenkins
as
Platform
	alexsotob		lordofthejars
I T 
 I S 
N O T 
 N E C E S S A R Y
T O 
 C H A N G E . 

S U R V I V A L 
I S 
 N O T 
 M A N D A T O R Y.
W.	Edwards	Deming
	alexsotob		lordofthejars

http://www.slideshare.net/asotobu/jenkins-20

asotobu@gmail.com
	alexsotob		lordofthejars

Jenkins 20