I am attempting to pass parameters that are defined in a Jenkins configuration to a declarative pipeline. When I do this with the built in string, everything works fine:
string(name: 'rv', defaultValue: 'none', description: 'the release version')
Since these value should not be edited by the user in the Build with Parameters screen, I switched to using the hidden parameter plugin:
hidden(name: 'rv', defaultValue: 'none', description: 'the release version')
But this gives me an error when the pipeline script is run:
WorkflowScript: 30: Invalid parameter type "hidden". Valid parameter types: [booleanParam, buildSelector, choice, credentials, file, gitParameter, text, password, run, string]
Is there a method by which I can use the hidden parameter in a declarative Jenkins pipeline?
I was having the same issue and by coincidence I found the solution.
Supposing, that you have the already mentioned 'Hidden Param Plugin', add the following line to your Jenkinsfile in the parameters
section and it should work:
[$class : 'WHideParameterDefinition',
name : 'HIDDEN_PARAM',
description: 'Hidden param for...']
Hope this helps you as well.