Ultimate DevOps:
OpenShift & CloudBees Jenkins Platform
Andy Pemberton
@apemberton
About Andy
Author	of	DZone Refcard	on	Jenkins	Pipeline
Hands-on	Delivery	experience	 on	CloudBees	Jenkins	and	Pipelines
Lead	CloudBees	Solution	Architecture	and	Consulting	Teams
@apemberton
OpenShift:
PaaS by Red Hat, Built on Docker and Kubernetes
projects
templates
applications
services
routes
pods
imagestreams
deployment
$ oc login --token=$foobar --server=https://api.foo.openshift.com
$ oc new-project mobile-development
$ oc project mobile-development
$ oc new-app https://github.com/cloudbees/openshift-example.git
$ oc scale mobile-deposit-ui-1 --replicas=4
Examples
$ oc help
Examples
OpenShift Web Console
Jenkins
Easy to Start
java -jar jenkins.war
Easy to Start
java -jar jenkins.war
Easy to Start
java -jar jenkins.war
Jenkins Popularity
0
1,000,000
2,000,000
3,000,000
4,000,000
5,000,000
6,000,000
7,000,000
0
20,000
40,000
60,000
80,000
100,000
120,000
11/1/2008 11/1/2009 11/1/2010 11/1/2011 11/1/2012 11/1/2013 11/1/2014
Active	Jenkins	Installations	Worldwide
Total	Jenkins	Jobs	Worldwide
http://www.infoq.com/research/ci-server http://stats.jenkins-ci.org/jenkins-stats
CloudBees Jenkins Enterprise
… part of CloudBees Jenkins Platform
Jenkins	for	the	EnterpriseCommunity	Innovation
Jenkins + OpenShift: better together
+
Jenkins + OpenShift: better together
MASTER
AGENT
AGENT
AGENT
AGENT
AGENT
AGENT
Use	case	#1:	OpenShift	as	an	Elastic	Runtime	for	Jenkins
Jenkins + OpenShift: better together
MASTER
Use	case	#2:	OpenShift	as	deployment	target	from	Jenkins
Jenkins + OpenShift: better together
MASTER
AGENT AGENT AGENT
Jenkins Pipeline
Pipeline: a new Job Type
Pipeline: a new Job Type
Concise
Long-running
Durable
Flexible
Extensible
22
stage 'build'
node {
checkout scm
tool 'mvn-3.3'
sh 'mvn clean install'
stash name: 'source', excludes: 'target/'
}
stage 'test'
node {
unstash 'source'
sh 'mvn verify'
}
Pipeline-as-Code
PIPELINE
Jenkins Pipeline + OpenShift
Live Demo.
What could go wrong?
https://github.com/cloudbees/openshift-example
wrap([$class: 'OpenShiftBuildWrapper',
url: 'https://api.foobar.openshift.com',
credentialsId: 'development-credentials',
installation: 'oc-latest']){
...
}
Your	OpenShift	
server	API	(Origin,	
Enterprise,	etc.)
wrap([$class: 'OpenShiftBuildWrapper',
url: 'https://api.foobar.openshift.com',
credentialsId: 'development-credentials',
installation: 'oc-latest']){
...
}
Credentials	for	
your	OpenShift	
account	(probably	
a	serviceaccount)
wrap([$class: 'OpenShiftBuildWrapper',
url: 'https://api.foobar.openshift.com',
credentialsId: 'development-credentials',
installation: 'oc-latest']){
...
}
CLI	version	for	
your	OpenShift	
Server,	defined	by	
a	Jenkins	Tool
wrap([$class: 'OpenShiftBuildWrapper', ... ]){
oc('project mobile-development -q')
def bc = oc('get bc -o json')
if(!bc.items) {
oc("new-app --name=mobile-deposit-ui --code='.’
--image-stream=jboss-webserver30-tomcat8-openshift")
wait('app=mobile-deposit-ui', 5, 'MINUTES')
oc('expose service mobile-deposit-ui')
} else {
oc("start-build mobile-deposit-ui --from-dir=. --wait")
}
}
Additional Resources
Additional Resources
https://blog.openshift.com/openshift-cloudbees-jenkins-enterprise-devops
https://www.cloudbees.com/partners/platform/red-hat
@apemberton
www.cloudbees.com/get-started
CloudBees Jenkins Platform Editions
Platinum	Support Gold	Support
Enterprise	Edition
Cloud/Container	 Support
Private	SaaS	Edition
ü Self-Service
ü Docker-based
ü Elastic	&	Resilient
ü Private	Cloud
ü Analytics
ü Shared	Resources
Ultimate DevOps - Jenkins Enterprise & Red Hat OpenShift

Ultimate DevOps - Jenkins Enterprise & Red Hat OpenShift