jenkinsfile failed step triggers another jenkins job.

21 views
Skip to first unread message

nup

unread,
Aug 16, 2018, 7:25:22 PM8/16/18
to Jenkins Users
Hi, 

I have a build step in jenkinsfile as smoke test. I would like to see if that smoke test fails then trigger another jenkins job. Basically, I have a rollback jenkins job that is not part of the pipeline, but in pipeline If my smoke test fails then it triggers my rollback jenkins job. 

Any help would be greatly appreciated. 

Thank you.

nup

unread,
Aug 20, 2018, 4:04:10 PM8/20/18
to Jenkins Users
Adding some more details below. Basically, If the smoke test fails then next step is triggers rollback job.  I think this looks good, but just need to test it. Any updates on to make this step better would be appreciated. 

    stage('Smoke Test') {
      steps {
        script {
             git 'ssh://git.com/smoketest'
             sauce( 'connection_info ') {
              sauceconnect(useGeneratedTunnelIdentifier: true, verboseLogging: true) {
              sh 'env | sort'
              sh'''
             export SELENIUM_PLATFORM=Safari
            mvn clean test -Psmoke
          if (currentBuild.result == 'FAILED')
          build 'rollback-job'
        }

      }
    }
Reply all
Reply to author
Forward
0 new messages