[JIRA] (JENKINS-41076) Improvements for 'when' section

2 views
Skip to first unread message

yoyo@wp.eu (JIRA)

unread,
Jan 13, 2017, 12:27:01 PM1/13/17
to jenkinsc...@googlegroups.com
Piotr Joński created an issue
 
Jenkins / Improvement JENKINS-41076
Improvements for 'when' section
Issue Type: Improvement Improvement
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin
Created: 2017/Jan/13 5:26 PM
Labels: pipeline plugin
Priority: Minor Minor
Reporter: Piotr Joński

It would be nice to improve when section in stage pipeline when user input and timeout.

Currently we have to write code like this:

when {
  boolean publish
  try {
    timeout(time: 1, unit: 'MINUTES') {
      input 'Deploy pages?'
      publish = true
    }
  } catch (final ignore) {
    publish = false
  }
publish
}

Which is:

  • very long
  • bad practise (catch and ignore)
  • unclear

My proposition is to make additional clause, which could look like this:

when {
  input message: 'Deploy pages?', time: 1, unit: 'MINUTES', failWhenTimeout: false
}

Default parameters could be:

  • message: Proceed or Abort?
  • time: 5
  • unit: MINUTES
  • failWhenTimeout: false
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

yoyo@wp.eu (JIRA)

unread,
Jan 18, 2017, 3:39:01 PM1/18/17
to jenkinsc...@googlegroups.com
Piotr Joński commented on Improvement JENKINS-41076
 
Re: Improvements for 'when' section

with newest (0.8.0) version syntax is even more complicated.
Moveover, build is always marked as UNSTABLE even when currentBuild.result = "SUCCESS" is used

when {
                expression {
                    boolean publish = false
                    if (env.DEPLOYPAGES == "true") {
                        return true
                    }
                    try {
                        timeout(time: 1, unit: 'MINUTES') {
                            input 'Deploy pages?'
                            publish = true
                        }
                    } catch (final ignore) {
                        publish = false
                        //currentBuild.result = "SUCCESS" does not work
                    }
                    //currentBuild.result = "SUCCESS" does not work
                    return publish
                }
            }

Any ideas?

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:25:50 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Duplicate
 

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