[JIRA] (JENKINS-49997) Pipeline Declarative post unsuccessful block

5 views
Skip to first unread message

stephen.alan.connolly@gmail.com (JIRA)

unread,
Mar 7, 2018, 11:55:03 AM3/7/18
to jenkinsc...@googlegroups.com
Stephen Connolly created an issue
 
Jenkins / Bug JENKINS-49997
Pipeline Declarative post unsuccessful block
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2018-03-07 16:54
Priority: Minor Minor
Reporter: Stephen Connolly

In my declarative pipeline I need to repeat the same step in the unstable, failure, and aborted post conditions, e.g.

post {
  always {
    // do some stuff to collect junit reports
  }
  success {
    // push the tags
  }
  unstable {
    sh "mvn nexus-staging:drop"
  }
  failure {
    sh "mvn nexus-staging:drop"
  }
  aborted {
    sh "mvn nexus-staging:drop"
  }
}

This is really crappy having to repeat the exact same tidy-up in three places.

What I'd really like is something like:

post {
  always {
    // do some stuff to collect junit reports
  }
  success {
    // push the tags
  }
  unsuccessful {
    sh "mvn nexus-staging:drop"
  }
}

Where the unsuccessful steps would run at the end. The sequence of execution would thus be:

  • always (first because it might affect the build result)
  • success (the result cannot get better, so none of the following blocks can turn the result to a success)
  • unstable (because we might have some steps that escalate the unstable to a failure, or get aborted because they take too long)
  • failure (once the result is failure, it cannot get better)
  • aborted (the failure block could be aborted)
  • unsuccessful (a catch-all for any of the previous error modes)

With perhaps a finally condition at the end that always runs

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

andrew.bayer@gmail.com (JIRA)

unread,
Nov 14, 2018, 2:45:02 PM11/14/18
to jenkinsc...@googlegroups.com
Andrew Bayer updated an issue
 
Jenkins / Improvement JENKINS-49997
Change By: Andrew Bayer
Issue Type: Bug Improvement
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

r.fuereder@xortex.com (JIRA)

unread,
Nov 16, 2018, 3:11:02 AM11/16/18
to jenkinsc...@googlegroups.com
Reinhold Füreder commented on Improvement JENKINS-49997
 
Re: Pipeline Declarative post unsuccessful block

In the meantime there are also:

  • "cleanup", which is presumably the suggested "finally" ("Always run after all other conditions, regardless of build status")
  • "regression, but this will not be run anymore if it keeps to be unsuccessful ("Run if the current builds status is worse than the previous builds status")

However, I was also looking for an "unsuccessful" to be able to notify for broken build (a) independent of "unstable"/"failure"/"aborted" and (b) also keep notifying if it is still broken (so not just on first broken build, which would be supported by "regression")

A little bit related sounds JENKINS-53889?

An alternative approach that I guess might also be not easy to support could be a let's call it "multi-<something>":

post {
  always {
    // do some stuff to collect junit reports
  }
  success {
    // push the tags
  }
  unstable|failure|aborted {
    sh "mvn nexus-staging:drop"
  }
}

 

=> So agreeing with Stephen Connolly, maybe the "unsuccessful" might be the easiest to implement and use!?

andrew.bayer@gmail.com (JIRA)

unread,
Nov 27, 2018, 7:40:03 AM11/27/18
to jenkinsc...@googlegroups.com

Yeah, a condition that fires whenever the status is not SUCCESS or null seems reasonable.

andrew.bayer@gmail.com (JIRA)

unread,
Nov 27, 2018, 7:41:02 AM11/27/18
to jenkinsc...@googlegroups.com
Andrew Bayer assigned an issue to Jose Blas Camacho Taboada
 
Change By: Andrew Bayer
Assignee: Johan Selenius Jose Blas Camacho Taboada

andrew.bayer@gmail.com (JIRA)

unread,
Nov 27, 2018, 7:41:02 AM11/27/18
to jenkinsc...@googlegroups.com
Andrew Bayer assigned an issue to Johan Selenius
Change By: Andrew Bayer
Assignee: Andrew Bayer Johan Selenius

jtaboada@cloudbees.com (JIRA)

unread,
Nov 28, 2018, 4:18:02 AM11/28/18
to jenkinsc...@googlegroups.com
Jose Blas Camacho Taboada started work on Improvement JENKINS-49997
 
Change By: Jose Blas Camacho Taboada
Status: Open In Progress

jtaboada@cloudbees.com (JIRA)

unread,
Nov 28, 2018, 4:18:02 AM11/28/18
to jenkinsc...@googlegroups.com

andrew.bayer@gmail.com (JIRA)

unread,
Nov 28, 2018, 12:20:02 PM11/28/18
to jenkinsc...@googlegroups.com
Andrew Bayer updated Improvement JENKINS-49997
 

This'll be in 1.3.4.

Change By: Andrew Bayer
Status: In Review Resolved
Resolution: Fixed

r.fuereder@xortex.com (JIRA)

unread,
Nov 29, 2018, 1:04:02 AM11/29/18
to jenkinsc...@googlegroups.com

jrhett@netconsonance.com (JIRA)

unread,
Aug 7, 2019, 12:01:04 PM8/7/19
to jenkinsc...@googlegroups.com
Jo Rhett commented on Improvement JENKINS-49997

It would be really awesome if the documentation at https://jenkins.io/doc/book/pipeline/syntax/#post-conditions mentioned which states unsuccessful includes, so that we don't have to search to find this issue

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:27 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

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