Complete the code to define a dynamic choice parameter in Jenkins pipeline.
properties([parameters([choice(name: 'ENV', choices: [1], description: 'Select environment')])])
The choice parameter expects a string with newline-separated options.
Complete the code to set a dynamic string parameter with a default value.
properties([parameters([string(name: 'VERSION', defaultValue: [1], description: 'Enter version')])])
The defaultValue must be a string, so it needs to be quoted with double quotes.
Fix the error in the code to dynamically generate choices from a Groovy list.
def envs = ['dev', 'qa', 'prod'] properties([parameters([choice(name: 'ENV', choices: [1], description: 'Choose environment')])])
The choices parameter requires a newline-separated string, so joining the list with '\n' is correct.
Fill both blanks to create a dynamic boolean parameter with a default value.
properties([parameters([booleanParam(name: [1], defaultValue: [2], description: 'Enable feature')])])
The name must be a string, so it needs quotes. The defaultValue is a boolean true.
Fill all three blanks to define a dynamic choice parameter with options generated from a list and a description.
def branches = ['main', 'develop', 'feature'] properties([parameters([choice(name: [1], choices: [2], description: [3])])])
toString() for choices instead of joining with newlines.The name and description must be strings, so they need quotes. The choices must be a newline-separated string from the list.