+ All Categories
Home > Technology > Stockholm Jenkins Area Meetup, March 2017

Stockholm Jenkins Area Meetup, March 2017

Date post: 15-Apr-2017
Category:
Upload: andrey-devyatkin
View: 44 times
Download: 0 times
Share this document with a friend
23
Stockholm Jenkins Area Meetup Few small tips about Jenkins pipeline that could save you few hours and some WTF
Transcript
Page 1: Stockholm Jenkins Area Meetup, March 2017

Stockholm Jenkins Area Meetup

Few small tips about Jenkins pipeline that could save you few hours and some WTF

Page 2: Stockholm Jenkins Area Meetup, March 2017

Andrey DevyatkinLong time Continuous Delivery

practitioner

Impossibility remediation specialist at

Praqma

Open Source enthusiast

@andrey9kin [email protected]

Page 3: Stockholm Jenkins Area Meetup, March 2017

Early days - freestyle job and UI

Page 4: Stockholm Jenkins Area Meetup, March 2017

Some improvements for visualisation

https://wiki.jenkins-ci.org/display/JENKINS/Delivery+Pipeline+Plugin

Page 6: Stockholm Jenkins Area Meetup, March 2017

JobDSL

Page 7: Stockholm Jenkins Area Meetup, March 2017

What is Jenkins job?

Page 8: Stockholm Jenkins Area Meetup, March 2017

What is Jenkins job?

Page 9: Stockholm Jenkins Area Meetup, March 2017

Wait! My plugin is not supported

Page 11: Stockholm Jenkins Area Meetup, March 2017

And here comes workflow... pipeline

Page 12: Stockholm Jenkins Area Meetup, March 2017
Page 14: Stockholm Jenkins Area Meetup, March 2017

Pipeline basicsJenkinsfile (Declarative Pipeline)

pipeline {

agent any

stages {

stage('Build') {

steps {

echo 'This is a minimal pipeline.'

}

}

}

}

Page 15: Stockholm Jenkins Area Meetup, March 2017

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'

Page 16: Stockholm Jenkins Area Meetup, March 2017

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...

Page 17: Stockholm Jenkins Area Meetup, March 2017

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...

Page 21: Stockholm Jenkins Area Meetup, March 2017

Thanks!

Page 22: Stockholm Jenkins Area Meetup, March 2017

http://www.code-conf.com

Page 23: Stockholm Jenkins Area Meetup, March 2017

www.praqma.com


Recommended