Все было довольно просто, ExtendedChoiceParameterDefinition имеет параметр "String javascript", который может принимать любую строку js, которая может не только возвращать строку JSON для Json-редактора, но также может изменять саму входную страницу.
Пример конвейера:
stage('UserInput'){
steps {
script {
//...groovy script is omitted, it need only return json in valid form
def jsString = '''
var bodyElement = document.createElement('div');
bodyElement.innerHTML = '<h1 id="title">Some Title</h1><span style="display:inline-block; width=100px;">Some arbitrary text</span>';
document.getElementsByTagName('body')[0].appendChild(bodyElement);'''
def jsonParams = new ExtendedChoiceParameterDefinition(
'Cookbooks', //String name,
'PT_JSON', //String type,
null, //String value,
null, //String projectName,
null, //String propertyFile,
jsonGroovyScript, //String groovyScript (that returns JSON for generating Json-Input forms),
null, //String groovyScriptFile,
"jsonText=$jsonText", //String bindings,
'', //String groovyClasspath,
null, //String propertyKey,
null, //String defaultValue,
null, //String defaultPropertyFile,
null, //String defaultGroovyScript,
null, //String defaultGroovyScriptFile,
null, //String defaultBindings,
null, //String defaultGroovyClasspath,
null, //String defaultPropertyKey,
null, //String descriptionPropertyValue,
null, //String descriptionPropertyFile,
null, //String descriptionGroovyScript,
null, //String descriptionGroovyScriptFile,
null, //String descriptionBindings,
null, //String descriptionGroovyClasspath,
null, //String descriptionPropertyKey,
null, //String javascriptFile,
jsString, //String javascript (js code that modify input page itself),
false, //boolean saveJSONParameterToFile,
false, //boolean quoteValue,
10, //int visibleItemCount,
'', //String description,
',' //String multiSelectDelimiter
))
parameterList << jsonParams
def form = input(
id: 'form', message: 'input parameters', parameters: parameterList
) // generating input page step and store it in "form" var
env.FORM = form
}
}
}