Talk about Continuous Delivery and Jenkins 2 that enables us to define our pipelines with our code. Showing example pipelines, snippets and the new Blue Ocean GUI.
2. Mike van Vendeloo
Software Craftsman at JPoint
TU Delft - Computer Science
Scrum master
Assignments at customers like KLM, Rabobank, Government,
de Persgroep.
Focus on improvement of software development process and
quality
Hobb: Korfball, domotica
@mikevanvendeloo
3. Agenda
• Definitions CI/CD/Pipeline
• Jenkins 2: Pipeline as code
• Pipeline snippets
• Reuse with pipeline libraries
• Declarative pipelines
• Blue Ocean
• Demo
5. Definitions - Continuous Integration
“Continuous Integration is a software development practice
where members of a team integrate their work frequently,
usually each person integrates at least daily - leading to
multiple integrations per day. Each integration is verified by
an automated build (including test) to detect integration errors
as quickly as possible.“
Martin Fowler
6. Continuous Delivery: Automate everything
“If it hurts, do it more
frequently, and bring the pain
forward.”
― Jez Humble,
Continuous Delivery
7. Definitions - Continuous Delivery
“Continuous Delivery is the ability to get changes of all
types—including new features, configuration changes, bug
fixes and experiments—into production, or into the hands of
users, safely and quickly in a sustainable way.”
25. Library implementation
package vanvendeloo.jenkins
def checkout(String repositoryName) {
git “git@bitbucket.org:vanvendeloo/${repositoryName}”
}
def updateVersion() {
sh “mvn build-helper:parse-version versions:set -
DnewVersion=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${
parsedVersion.nextIncrementalVersion} versions:commit”
}
// Return the contents of this script as object so it can be re-used in Jenkinsfiles.
return this
26. Use the library: @Library
@Library(‘pipeline-library’)
node {
pipelineSteps = new PipelineSteps()
stage(‘Preparation’) {
pipelineSteps.checkout(‘my-service’)
pipelineSteps.updateVersion()
}
}
27. Catch: Groovy Sandbox
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: ↵
Scripts not permitted to use method java.lang.String replaceAll java.lang.String
java.lang.String
1. Go to Manage Jenkins > In-process
Script Approval
2. Review the pending signatures and
click Approve to add them to the
whitelist
3. Re-run your job; it should no longer
fail (for this particular method call)
36. Conclusions
Pipeline evaluates with your code
Reuse in libraries keeps your Jenkinsfile clean and simple
BlueOcean definately an improvement, but need to get used to it
Pipeline editor very cool feature!
Continuous Delivery is sometimes confused with Continuous Deployment. Continuous Deployment means that every change goes through the pipeline and automatically gets put into production, resulting in many production deployments every day. Continuous Delivery just means that you are able to do frequent deployments but may choose not to do it, usually due to businesses preferring a slower rate of deployment. In order to do Continuous Deployment you must be doing Continuous Delivery.