Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set quietperiod on Jenkins Pipeline

I have a pipeline with some boolean parameters. I'd like to add the quietPeriod as described in the docs but I'm struggling to get the syntax right. I tried:

properties([
  parameters :[
    booleanParam(name: 'foo', defaultValue: false, description: 'bar')
  ],
  quietPeriod: 10
])

But that yields a java.lang.UnsupportedOperationException: must specify $class with an implementation of interface java.util.List.

Does anyone know how to add this parameter correctly?

like image 462
Alex Avatar asked Oct 29 '25 14:10

Alex


1 Answers

From this Jenkins ticket in JIRA it seems like the feature is only available by default when the Declarative Pipeline syntax is used.

As a workaround I found that doing

currentBuild.rawBuild.getParent().setQuietPeriod(210)

works like a charm. You can put it right after setting the properties, like this:

properties([
  parameters :[
    booleanParam(name: 'foo', defaultValue: false, description: 'bar')
  ]
])

currentBuild.rawBuild.getParent().setQuietPeriod(210)
like image 70
hfc Avatar answered Oct 31 '25 05:10

hfc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!