Recall & Review
beginner
What is the purpose of the 'vars' directory in a Jenkins shared library?
The 'vars' directory contains Groovy scripts that define global variables or functions accessible in Jenkins pipelines. These scripts act like reusable steps or helpers.
Click to reveal answer
beginner
Where do you place reusable Groovy classes in a Jenkins shared library?
Reusable Groovy classes go inside the 'src' directory, organized by package structure. This keeps code modular and easy to maintain.
Click to reveal answer
intermediate
What is the role of the 'resources' directory in a Jenkins shared library?
The 'resources' directory holds non-Groovy files like configuration files, templates, or scripts that your library code can load and use.
Click to reveal answer
intermediate
How does Jenkins find and use the shared library code from the directory structure?
Jenkins loads the shared library from the root directory, then looks into 'vars' for global scripts, 'src' for classes, and 'resources' for supporting files. This structure helps Jenkins organize and access code efficiently.
Click to reveal answer
beginner
Why is it important to follow the standard directory structure in Jenkins shared libraries?
Following the standard structure ensures Jenkins can automatically find and load your code. It also makes your library easier to understand and maintain by others.
Click to reveal answer
Which directory in a Jenkins shared library contains global variables and functions?
✗ Incorrect
The 'vars' directory holds Groovy scripts that define global variables and functions accessible in pipelines.
Where should you place Groovy classes in a Jenkins shared library?
✗ Incorrect
Groovy classes go inside the 'src' directory, organized by package.
What type of files does the 'resources' directory hold?
✗ Incorrect
The 'resources' directory contains files like templates, configuration files, or scripts used by the library.
Why is it important to follow the Jenkins shared library directory structure?
✗ Incorrect
Following the standard structure allows Jenkins to find and load your shared library code automatically.
If you want to add a new helper function accessible in all pipelines, where do you put it?
✗ Incorrect
Helper functions accessible globally are placed as Groovy scripts inside the 'vars' directory.
Describe the main directories in a Jenkins shared library and their purposes.
Think about where Jenkins looks for different types of code and files.
You got /3 concepts.
Explain why maintaining the standard directory structure in Jenkins shared libraries is important.
Consider how Jenkins and your team benefit from a consistent layout.
You got /3 concepts.