Amit
Amit

Reputation: 397

Jenkins: Getting build parameter description in groovy

I want to get the description of build parameters of a Jenkins build using groovy.
I want to include this description in an email using by Email-ext plugin groovy templates.

Is there some way I can achieve this?

Parameter descriptions pic

Upvotes: 0

Views: 1378

Answers (1)

Gerold Broser
Gerold Broser

Reputation: 14782

See Parameterized System Groovy script:

...

// get parameters
def parameters = build?.actions.find{ it instanceof ParametersAction }?.parameters
parameters.each {
   println "parameter ${it.name}:"
   println it.dump()
   println "-" * 80
}

...

Note: Since Actionable.getActions() is deprecated allActions should be used instead of actions.

Add:

   println "${it.description}"

and there you are.

Upvotes: 3

Related Questions