trying to apply jenkins shared library to use in pipelines and want to add some choice parameters to don't update all pipelines with new values for example, created a class with static method:
#!/usr/bin/env groovy
class Envs implements Serializable {
static giveMeParameters (script) {
return [
script.string(defaultValue: '', description: 'A default parameter', name: 'textParm')
]
}
}
and trying to use it in pipeline: pipeline {
parameters {
string(name: 'ENV', defaultValue: 'staging', description: 'Please enter desire env name for app', trim: true)
Envs.giveMeParameters (this)
}
but getting error:
WorkflowScript: 81: Invalid parameter type "giveMeParameters". Valid parameter types: [booleanParam, buildSelector, choice, credentials, file, gitParameter, text, password, run, string] @ line 81, column 9.
giveMeParameters (this)