Recall & Review
beginner
What is the purpose of the
parameters block in a Jenkins pipeline?The
parameters block lets you define inputs that users can provide when starting a Jenkins job. These inputs can control how the job runs.Click to reveal answer
beginner
Name two common parameter types you can declare inside the
parameters block.Two common parameter types are
string for text input and booleanParam for true/false choices.Click to reveal answer
beginner
How do you declare a string parameter named
BRANCH with a default value of main?Use
string(name: 'BRANCH', defaultValue: 'main', description: 'Git branch to build') inside the parameters block.Click to reveal answer
beginner
What happens if you run a Jenkins pipeline with a
parameters block but do not provide any input values?Jenkins uses the default values defined in the
parameters block for the job run.Click to reveal answer
beginner
Show a simple example of a
parameters block with a string and a boolean parameter.parameters {
string(name: 'ENV', defaultValue: 'dev', description: 'Environment')
booleanParam(name: 'DEBUG', defaultValue: false, description: 'Enable debug mode')
}
Click to reveal answer
What is the correct syntax to declare a boolean parameter named
RUN_TESTS with default true?✗ Incorrect
The correct syntax uses
booleanParam with named arguments for name, defaultValue, and description.Where do you place the
parameters block in a Jenkins declarative pipeline?✗ Incorrect
The
parameters block goes inside the pipeline block but outside any stages.What type of parameter would you use to let users pick from a list of options?
✗ Incorrect
The
choice parameter lets users select one option from a dropdown list.If you want to ask users for a multi-line text input, which parameter type should you use?
✗ Incorrect
The
text parameter allows multi-line text input.What happens if you omit the
parameters block in a Jenkins pipeline?✗ Incorrect
Without a
parameters block, the pipeline runs immediately without asking for user inputs.Explain how to declare and use parameters in a Jenkins declarative pipeline.
Think about where the parameters block goes and how users provide inputs.
You got /4 concepts.
Describe the difference between
string and choice parameters in Jenkins.Consider how users select or enter values.
You got /3 concepts.