puzzle itc talk @docker ch meetup ci cd_with_openshift_0.2
TRANSCRIPT
Continuous Deliverywith OpenShift
Docker Meetup 31.5.2016
Thomas PhiliponaCTO
Agenda
1. OpenShift v3
2. CI / CD
3. Key Concepts
4. OpenShift CI /CD Pipeline with Jenkins
OpenShift v3
1
OpenShift v3
“next generation PaaS” OpenShift v3 by Red Hat
V3 new implementation based on « de facto » standard technologies
Based on reliable open source concepts
Docker Kubernetes
OpenShift v3
Container Platform as a Service (PaaS)
Multinode platform, Docker container runtime
Docker build platform
Docker registry
One platform runs it all!
Fancy CLI und GUI (self-service)
Container security enabled
Workflows● Docker build
● Prebuilt image
● Custom builder
● Source To Image
Workflow: Source To Image (S2I)
Git ?
s2i builder imageeg. openshift/ruby-22-centos7
code
code
My App
1.push code to git2. trigger webhook3.clone repo4.evaluate builder5.assemble image6.push to registry and deploy
12
3
4
5
MyApplicationMyApplication MyApp
6
Ruby, Java, PHP, NodeJs, ...
CI / CD
2
Continuous Integration
● SCM
● compile and test
● software integration
● reporting
● deployment to test environment
● extension of CI
● one artifact on all environments
● fully automated deployment with a single click
● prod release with a single click
● each release is deployed to production
● rolling deployments necessary
● blue - green deployments
Continuous Delivery Continuous Deployment
If It Hurts, Do It More Frequently, and Bring the Pain Forward
Source: Jez Humble, David Farley, Continuous Delivery, Pearson Education, Inc. 2011
CI / CD Workflow Overview
Git
code
Compile, Unit-tests
Integration Tests, Package
Deploy to Dev
Acceptance Tests
Deploy to UAT env
Manual Tests
Deploy to Prod
Key Concepts
3
Maven / ArtefactrepositoryMaven versioning doesn't work well with continuous delivery
Each commit is a potential release candidate SNAPSHOT versions do not exist
Maven release plugin is integrated into the Maven lifecycle. All or nothing
mvn release:prepare mvn release:perform→
Many releases artifactrepository clean up→
Rolling Updates
OpenShift supports rolling updates.
The application notifies the platform when it’s ready for requests.
The routing layer then forwards requests to the new containers.
Automated Database Migration
DB Migrationscripts are part of the deployed application and executed during startup.
$ php bin/console doctrine:schema:update
$ rake db:migrate
Automated Database Migration
Database knows the current schema version
During application startup / deployment lifecycle hook, the DB migration is executed
Rolling update
DB must be backward compatible
Concepts: Automated Database Migration
V41 V42 V43
dropColumn
dropColumn
dropTable
dropTable
MyApplicationMyApplication App
DB
Concepts: Automated Database Migration
App.v41 App.v42
... oldColumn newColumn ...
guild42 guild42
DB Trigger
OpenShift CI /CD Pipeline with Jenkins
4
Java Maven Example (1)
Git
code
Jenkins
code
Artefact Repo
artefact
checkout build release deploy
Jenkins
code
Jenkins
artefactcfg
+ Unit test+ Integration test+ Code analyse
Workflow: deploy
1.Jenkins buildmvn clean installtrigger build on OSE
2.custom builddownload artefactbuild docker image
3.deploy container
Jenkins
artifact
1 2
MyApplicationMyApplication MyApp
Custom builder image
3
My App
cfg
Java Maven Example (2)
acceptance tests
Jenkins
test
Jenkins
artefactcfg
deploy to UAT manual test
Jenkins
artefactcfg
deploy to Prod
Jenkins Pipeline Plugin
Build jobs written as Groovy scripts.
Build job script is next to source code in git repository
Jenkins provides the environment
● Git / Artifactory / OpenShift Accounts
https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Plugin
Example Build Script// Stage Checkout
stage 'Checkout'
git url: 'https://gitlab.puzzle.ch/tphilipona/appuio-javaee-example.git'
// Stage Build
stage 'Build'
sh "${mvnHome}/bin/mvn clean install"
Stage View
Conclusion
5
Key Factors: Automation and Fast Feedback
Customer,PO Dev Production
DeploymentIdea, Feature, Bug
Fast, qualified Feedback
Resources
https://docs.openshift.com
Q & A
01.6.2016 in BE15.6.2016 in ZH
Free APPUiO OpenShift Techlab
Thank You!