Tue Mar 06 2018
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
#!/usr/bin/env groovy

@Library('jenkins-shared-library')
import com.rosettastone.JenkinsShared

pipeline {
  agent { label 'marketing' } 
  
  options { 
    skipDefaultCheckout()
    disableConcurrentBuilds() 
  } 
  
  stages {     
    stage('clear_current_directory'){
       steps {
        deleteDir();
        setupApp();
       }  
    }  
    stage('checkout') {
      steps {        
        script{             
        //  echo dsl().env.BRANCH_NAME
          gitCheckoutBranchIntoDir('ssh://git@stash.trstone.com/rsmar/cicd_experiments.git', 'workspace/cicd_experiments',  "${env.BRANCH_NAME}"  )                
        }
      }       
    }
    
  } //END stages {}
  post {
    success {
      emailext (
          subject: "SUCCESS: ${currentBuild.fullDisplayName}",
          body: "Build completed ${env.BUILD_URL}",
          recipientProviders: [[$class: 'DevelopersRecipientProvider']]
        )

        /* Hipchat integration here */

          hipchatSend (
            color: 'GREEN',
            notify: true,
            message: "${currentBuild.fullDisplayName} -- Build passed(${env.BUILD_URL})",
            room: 'Webstrategy'
        )
    }
    failure {
      emailext (
                subject: "FAILURE: ${currentBuild.fullDisplayName}",
                body: "Build failed ${env.BUILD_URL}",
                recipientProviders: [[$class: 'DevelopersRecipientProvider']]
              )

              /* Hipchat integration here */
        hipchatSend (
            color: 'RED',
            notify: true,
            message: "${currentBuild.fullDisplayName} -- Build failed(${env.BUILD_URL})",
            room: 'Webstrategy'
        )
    }
  } //END post {}
} //END pipeline {}