Upgrade to Pro — share decks privately, control downloads, hide ads and more …

X tips [X==9] for building a Bulletproof Deployment Pipeline with  Jenkins

oshai
July 13, 2017

X tips [X==9] for building a Bulletproof Deployment Pipeline with  Jenkins

JUC 2017 presentation

oshai

July 13, 2017
Tweet

More Decks by oshai

Other Decks in Technology

Transcript

  1. X tips [X==9] for building a Bulletproof Deployment Pipeline with

    Jenkins JULY 13 / TLV, Israel Ohad Shai Software Engineer && Team Leader @ Outbrain
  2. About Me • Developing Software since 2005 • Mainly in

    Java and JVM languages • Works on backend systems • Using Jenkins since 2011 • Co-author of codeine open-source tool for Continuous Deployment on large scale
  3. Deployment Pipeline • The driver tool for Continuous-Delivery • Features:

    • Complex build flows • Job as a Code (aka JenkinsFile) • Suspend/Resume and survive restarts of Jenkins
  4. Tip #5 Use commit hook with message regex gitCommitMessage =

    sh(returnStdout: true, script: 'git log -1 --pretty=%B').trim() deployToProd = (gitCommitMessage =~ /#d2p/ || params.DEPLOY_TAG == "#d2p") //we also allow '#d2p' when triggering manually
  5. Tip #6 pipeline { agent { docker 'maven:3-alpine' } stages

    { stage('Example Build') { steps { sh 'mvn -B clean verify' } } } } node { stage('Example') { try { sh 'exit 1' } catch (exc) { echo 'Something failed, I should sound the klaxons!' throw exc } } } Declarative Pipeline Scripted Pipeline
  6. Tip #7 Ask for user authorization on sensitive operations timeout(time:5,

    unit:'HOURS') { input message: ‘Deploy to production?', ok: 'Deploy!' } http://jenkins508.rssing.com/chan-25443405/all_p18.html
  7. Tip #9 Make the pipeline fast stage("Testing: phase a") {

    parallel 'JUnit': { stage("junit") { sh '...' } }, 'Deploy to simulator': { stage("Deploy to simulator") { sh '...' } } }