Upload
andrey-devyatkin
View
44
Download
0
Embed Size (px)
Citation preview
Stockholm Jenkins Area Meetup
Few small tips about Jenkins pipeline that could save you few hours and some WTF
Andrey DevyatkinLong time Continuous Delivery
practitioner
Impossibility remediation specialist at
Praqma
Open Source enthusiast
@andrey9kin [email protected]
Early days - freestyle job and UI
Some improvements for visualisation
https://wiki.jenkins-ci.org/display/JENKINS/Delivery+Pipeline+Plugin
Going wild… with Groovy
JobDSL
What is Jenkins job?
What is Jenkins job?
Wait! My plugin is not supported
And here comes workflow... pipeline
Nested steps?
Pipeline basicsJenkinsfile (Declarative Pipeline)
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'This is a minimal pipeline.'
}
}
}
}
Multi SCM checkout
node {
git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
sh "echo Build"
}
node {
git url: 'https://github.com/jglick/some-other-simple-maven-project-with-tests.git'
sh "echo Build"
}
git poll: true, url: 'https://github.com/jglick/some-other-simple-maven-project-with-tests.git'
Environment
node {
git url: 'https://github.com/jglick/simple-maven-project-with-tests.git'
def mvnHome = tool 'M3'
env.PATH = "${mvnHome}/bin:${env.PATH}"
sh 'mvn -B verify'
}
Cool! However...
Stash/Unstash// Run on a node with the "first-node" label.
node('first-node') {
// Stash that directory and file.
// Note that the includes could be "output/", "output/*" as below, or even
// "output/**/*" - it all works out basically the same.
stash name: "first-stash", includes: "output/*"
}
// Run on a node with the "second-node" label.
node('second-node') {
// Run the unstash from within that directory!
dir("first-stash") {
unstash "first-stash"
}
}
Cool! However...
Pipeline shared libraries
Cool! However...
Thanks!
www.praqma.com