Multi-line parameter description in declarative pipeline

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Multi-line parameter description in declarative pipeline

Al Silver
Hi,
  How can I have a detailed description field that is properly displayed when building with parameters.  The example below is obviously not good coding practice

parameters {
       
// Optional //

       
string(name: 'isis_thresh', defaultValue: '',
                description
: 'Threshold for ISIS Nbr last_state_change in format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d). Neighbor uptimes that are less than this value will be flagged as an error.')


   
}

I'd like to do something like this but then the output when building the job contains the tabs and looks bad... I'd like each of the lines in the output to display against the left hand margin.

parameters {

       
string(name: 'isis_thresh', defaultValue: '',
                description
: '''Threshold for ISIS Nbr last_state_change in
                                format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d).
                                Neighbor uptimes that are less than this value will
                                be flagged as an error.'''
)

   
}

Thx
Al

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Multi-line parameter description in declarative pipeline

slide
The triple quote strings are taken as is, so just remove the tabs/spaces at the start of the lines.

On Fri, Jun 12, 2020, 08:29 Al Silver <[hidden email]> wrote:
Hi,
  How can I have a detailed description field that is properly displayed when building with parameters.  The example below is obviously not good coding practice

parameters {
       
// Optional //

       
string(name: 'isis_thresh', defaultValue: '',
                description
: 'Threshold for ISIS Nbr last_state_change in format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d). Neighbor uptimes that are less than this value will be flagged as an error.')


   
}

I'd like to do something like this but then the output when building the job contains the tabs and looks bad... I'd like each of the lines in the output to display against the left hand margin.

parameters {

       
string(name: 'isis_thresh', defaultValue: '',
                description
: '''Threshold for ISIS Nbr last_state_change in
                                format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d).
                                Neighbor uptimes that are less than this value will
                                be flagged as an error.'''
)

   
}

Thx
Al

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfOp5Ub7%3D1jCTEZ7170gWdmj6%3DF3zjQyQcPL07rpQvYYQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Multi-line parameter description in declarative pipeline

Al Silver
If I remove the spaces/tab at the beginning of the line, I'm left with "ugly" code that's not maintaining indentations...  Thx


On Friday, June 12, 2020 at 10:20:13 PM UTC-4, slide wrote:
The triple quote strings are taken as is, so just remove the tabs/spaces at the start of the lines.

On Fri, Jun 12, 2020, 08:29 Al Silver <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="7EXd5TRlAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">asilv...@...> wrote:
Hi,
  How can I have a detailed description field that is properly displayed when building with parameters.  The example below is obviously not good coding practice

parameters {
       
// Optional //

       
string(name: 'isis_thresh', defaultValue: '',
                description
: 'Threshold for ISIS Nbr last_state_change in format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d). Neighbor uptimes that are less than this value will be flagged as an error.')


   
}

I'd like to do something like this but then the output when building the job contains the tabs and looks bad... I'd like each of the lines in the output to display against the left hand margin.

parameters {

       
string(name: 'isis_thresh', defaultValue: '',
                description
: '''Threshold for ISIS Nbr last_state_change in
                                format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d).
                                Neighbor uptimes that are less than this value will
                                be flagged as an error.'''
)

   
}

Thx
Al

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="7EXd5TRlAwAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/81bedba2-b5e9-45a7-8ed2-fda38a1e53b6o%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Multi-line parameter description in declarative pipeline

Björn Pedersen


Am Montag, 15. Juni 2020 14:45:42 UTC+2 schrieb Al Silver:
If I remove the spaces/tab at the beginning of the line, I'm left with "ugly" code that's not maintaining indentations...  T


Not remove from the source, but from the assigment value:

"""....
   -...
  -
""..stripIndent()

 

On Friday, June 12, 2020 at 10:20:13 PM UTC-4, slide wrote:
The triple quote strings are taken as is, so just remove the tabs/spaces at the start of the lines.

On Fri, Jun 12, 2020, 08:29 Al Silver <[hidden email]> wrote:
Hi,
  How can I have a detailed description field that is properly displayed when building with parameters.  The example below is obviously not good coding practice

parameters {
       
// Optional //

       
string(name: 'isis_thresh', defaultValue: '',
                description
: 'Threshold for ISIS Nbr last_state_change in format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d). Neighbor uptimes that are less than this value will be flagged as an error.')


   
}

I'd like to do something like this but then the output when building the job contains the tabs and looks bad... I'd like each of the lines in the output to display against the left hand margin.

parameters {

       
string(name: 'isis_thresh', defaultValue: '',
                description
: '''Threshold for ISIS Nbr last_state_change in
                                format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d).
                                Neighbor uptimes that are less than this value will
                                be flagged as an error.'''
)

   
}

Thx
Al

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/073d2ecd-b05c-4952-bad9-346916dd7ffbo%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Multi-line parameter description in declarative pipeline

Al Silver
Below code does not work and just throws an error when I try to run it.  I've seen examples of stripIndent but I have not been able to find a working example used inside the parameters block with declarative pipeline...

    parameters {

        string(name: 'limit', defaultValue: '',
                description: '''Limit the nodes to test against instead of testing against all nodes defined in the topology file.
                                Comma seperated list of device names. (e.g, dc21,ph22,sf21)
                                Names must be 4 character shortcut used in /etc/hosts file.'''.stripIndent())

    }

Here is the error when running the job.  Note, there are several other parameters defined the parameters block but I removed them to not clutter the explanation...All works well if removing the stripIndent() method.

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 43: Expected a symbol @ line 43, column 30.
                   description: '''Limit the nodes to test against instead of testing against all nodes defined in the topology file.
                                ^

WorkflowScript: 43: "error" should have 1 arguments but has 0 arguments instead. @ line 43, column 30.
                   description: '''Limit the nodes to test against instead of testing against all nodes defined in the topology file.
                                ^

WorkflowScript: 43: "error" should have 1 arguments but has 0 arguments instead. @ line 43, column 30.
                   description: '''Limit the nodes to test against instead of testing against all nodes defined in the topology file.
                                ^

3 errors

	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
	at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:142)
	at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:127)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:561)
	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:522)
	at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:337)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:428)
Finished: FAILURE





On Monday, June 15, 2020 at 10:17:21 AM UTC-4, Björn Pedersen wrote:


Am Montag, 15. Juni 2020 14:45:42 UTC+2 schrieb Al Silver:
If I remove the spaces/tab at the beginning of the line, I'm left with "ugly" code that's not maintaining indentations...  T


Not remove from the source, but from the assigment value:

"""....
   -...
  -
""..stripIndent()

 

On Friday, June 12, 2020 at 10:20:13 PM UTC-4, slide wrote:
The triple quote strings are taken as is, so just remove the tabs/spaces at the start of the lines.

On Fri, Jun 12, 2020, 08:29 Al Silver <[hidden email]> wrote:
Hi,
  How can I have a detailed description field that is properly displayed when building with parameters.  The example below is obviously not good coding practice

parameters {
       
// Optional //

       
string(name: 'isis_thresh', defaultValue: '',
                description
: 'Threshold for ISIS Nbr last_state_change in format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d). Neighbor uptimes that are less than this value will be flagged as an error.')


   
}

I'd like to do something like this but then the output when building the job contains the tabs and looks bad... I'd like each of the lines in the output to display against the left hand margin.

parameters {

       
string(name: 'isis_thresh', defaultValue: '',
                description
: '''Threshold for ISIS Nbr last_state_change in
                                format of 4h25s (e.g., 40s, 5m40s, 3h5m40s, 2d, 4w2d).
                                Neighbor uptimes that are less than this value will
                                be flagged as an error.'''
)

   
}

Thx
Al

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/cf6402d1-6a01-4ed3-a244-445366836ecfo%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f224cb10-8f30-4acf-bed2-8410ee6831b1o%40googlegroups.com.