Issue
Pipeline Snippet Generator returns the name of the object in angle brackets instead of the valid Pipeline code
Resolution
For some plugins when you use the "Snippet Generator" for Pipelines you could obtain the name of the object instead of the parameter with all the values that you have previously filled.
Let see an example:
If you choose "input" and choose the "Extended Choice Parameter" option:
and fill all the fields:
When you click on "Generate Pipeline Script" you obtain something like that:
When you should obtain the script needed to generate the fields that you have previously generated.
This is because the plugin is not correctly integrated with the Snippet Pipeline Script.
In these cases, you should create manually a new object of that type.
In order to obtain that you should follow these steps:
-
Go to the Javadoc of the plugin or to the GitHub class and look for a constructor method for the object that you need:
-
Add an import of that class in your pipeline:
import com.cwctravel.hudson.plugins.extended_choice_parameter.ExtendedChoiceParameterDefinition
-
From the constructor method create a variable in pipeline that get the result of the constructor:
def multiSelect= new ExtendedChoiceParameterDefinition("name", "PT_MULTI_SELECT", "blue,green,yellow,blue", "project name", "", "", "", "", "", "", "", "", "", "", "", "", "", "blue,green,yellow,blue", "", "", "", "", "", "", "", "", false, false, 3, "multiselect", ",")
-
And substitute the object with [variable]:
def userInput = input id: 'customID', message: 'Let\'s promote?', ok: 'Release!', parameters: [multiSelect]