[JIRA] (JENKINS-54523) Ability to stop an UNSTABLE declarative pipeline

1 view
Skip to first unread message

block.jon@gmail.com (JIRA)

unread,
Nov 7, 2018, 3:39:02 PM11/7/18
to jenkinsc...@googlegroups.com
Jon B created an issue
 
Jenkins / Improvement JENKINS-54523
Ability to stop an UNSTABLE declarative pipeline
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: pipeline
Created: 2018-11-07 20:38
Priority: Minor Minor
Reporter: Jon B

I have a pipeline with with many steps.

If my unit tests fail, I want to mark the pipeline as UNSTABLE and then to stop the pipeline.

I am using Declarative style.

I cannot figure out how to stop the pipeline from continuing. If I use error(), the pipeline does stop but it also gets marked as failed.

Am I missing something? Can a pipeline be BOTH marked as UNSTABLE and also stop progress?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

block.jon@gmail.com (JIRA)

unread,
Nov 9, 2018, 3:56:01 PM11/9/18
to jenkinsc...@googlegroups.com
Jon B commented on Improvement JENKINS-54523
 
Re: Ability to stop an UNSTABLE declarative pipeline

Here's the only method I could find to make this work.. which is not a very good way to accomplish this:

pipeline {
  options {
    skipDefaultCheckout true
  }
  agent {
    label 'universal'
  }
  stages {
    stage('Stage 1') {
      steps {
        script {
          currentBuild.result = 'ABORTED'
        }
      }
    }
    stage('Stage 2') {
      when {
        expression { currentBuild.result == 'SUCCESS' }
      }
      steps {
        script {
          println "REALLY DONT WANT THIS TO BE EXECUTED!"
        }
      }
    }
  }
  post {
    aborted {
      println "aborted!"
    }
  }
} 

 

andrew.bayer@gmail.com (JIRA)

unread,
Nov 13, 2018, 3:41:02 PM11/13/18
to jenkinsc...@googlegroups.com
Andrew Bayer updated an issue
 
Change By: Andrew Bayer
Component/s: pipeline-model-definition-plugin
Component/s: pipeline

andrew.bayer@gmail.com (JIRA)

unread,
Nov 13, 2018, 3:41:02 PM11/13/18
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Nov 13, 2018, 3:42:01 PM11/13/18
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Improvement JENKINS-54523
 
Re: Ability to stop an UNSTABLE declarative pipeline

I think the skipStagesAfterUnstable option (documented with other options at https://jenkins.io/doc/book/pipeline/syntax/#options) is probably what you're looking for.

andrew.bayer@gmail.com (JIRA)

unread,
Nov 13, 2018, 3:42:01 PM11/13/18
to jenkinsc...@googlegroups.com
Andrew Bayer updated an issue
Change By: Andrew Bayer
Comment:
I think the {{skipStagesAfterUnstable}} {{option}} (documented with other options at https://jenkins.io/doc/book/pipeline/syntax/#options) is probably what you're looking for.

andrew.bayer@gmail.com (JIRA)

unread,
Nov 13, 2018, 3:42:02 PM11/13/18
to jenkinsc...@googlegroups.com

I think the skipStagesAfterUnstable option (documented with other options at https://jenkins.io/doc/book/pipeline/syntax/#options) is probably what you're looking for.

Add Comment Add Comment
 

andrew.bayer@gmail.com (JIRA)

unread,
Nov 14, 2018, 2:38:02 PM11/14/18
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Not A Defect
 
Change By: Andrew Bayer
Status: Open Resolved
Resolution: Not A Defect

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:25:51 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Not A Defect
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages