Recall & Review
beginner
What is a reusable pipeline step in Jenkins?
A reusable pipeline step is a defined block of code or function that can be called multiple times in different parts of a Jenkins pipeline to avoid repetition and simplify maintenance.
Click to reveal answer
intermediate
How do you define a reusable step using a Jenkins Shared Library?
You create a Groovy script inside the 'vars' directory of the Shared Library with a call() method. This method contains the step logic and can be called from any pipeline.
Click to reveal answer
beginner
What is the benefit of using reusable pipeline steps?
They reduce code duplication, make pipelines easier to read and maintain, and allow updates in one place to affect all pipelines using that step.
Click to reveal answer
intermediate
Which Jenkinsfile syntax is used to call a reusable step from a Shared Library?
You call the step by its name as a function, for example: myReusableStep(param1: 'value').
Click to reveal answer
intermediate
What folder structure is required for Jenkins Shared Libraries to support reusable steps?
The Shared Library must have a 'vars' folder where each reusable step is a Groovy file named after the step, containing a call() method.
Click to reveal answer
What is the main purpose of reusable pipeline steps in Jenkins?
✗ Incorrect
Reusable steps help avoid code duplication and make pipelines easier to maintain.
Where do you place reusable step scripts in a Jenkins Shared Library?
✗ Incorrect
The 'vars' directory holds Groovy scripts defining reusable steps.
How do you call a reusable step named 'buildApp' in a Jenkinsfile?
✗ Incorrect
You call reusable steps like functions by their name with parentheses.
What method must a reusable step Groovy script contain?
✗ Incorrect
The call() method defines the step's logic and allows it to be invoked.
Which of these is NOT a benefit of reusable pipeline steps?
✗ Incorrect
Reusable steps reduce complexity, not increase it.
Explain how to create and use a reusable pipeline step in Jenkins using Shared Libraries.
Think about where the code lives and how you call it.
You got /4 concepts.
Describe the advantages of using reusable pipeline steps in Jenkins pipelines.
Consider how reusability helps in managing multiple pipelines.
You got /4 concepts.