0
0
Jenkinsdevops~20 mins

Library directory structure in Jenkins - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Jenkins Library Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Jenkins Shared Library Directory Structure

In Jenkins, a shared library has a specific directory structure. Which directory inside the library is used to store reusable Groovy scripts that can be called from Jenkins pipelines?

Avars
Bsrc
Cresources
Ddocs
Attempts:
2 left
💡 Hint

Think about where simple scripts or functions are placed for easy access in pipelines.

💻 Command Output
intermediate
1:30remaining
Listing Files in a Jenkins Shared Library

You have a Jenkins shared library repository with the following structure:

src/org/example/Utils.groovy
vars/build.groovy
resources/config.yaml

What will be the output of the command ls vars when run in the root of the library?

Aconfig.yaml
BUtils.groovy
CNo such file or directory
Dbuild.groovy
Attempts:
2 left
💡 Hint

Check which files are inside the vars folder.

🔀 Workflow
advanced
2:00remaining
Correct Order of Jenkins Shared Library Loading

Arrange the steps in the correct order for how Jenkins loads a shared library during pipeline execution.

A2,1,3,4
B1,2,3,4
C1,3,2,4
D1,2,4,3
Attempts:
2 left
💡 Hint

Think about configuration first, then fetching code, then loading, then usage.

Troubleshoot
advanced
2:00remaining
Troubleshooting Missing Shared Library Scripts

A Jenkins pipeline fails with an error saying a function from the shared library is not found. The shared library has the correct directory structure and is configured properly. What is the most likely cause?

AThe pipeline script syntax is invalid.
BThe 'vars' directory is missing from the library repository.
CThe function is defined in 'src' but not imported or called correctly in the pipeline.
DThe Jenkins master node is offline.
Attempts:
2 left
💡 Hint

Consider how code in 'src' is accessed differently than code in 'vars'.

Best Practice
expert
2:30remaining
Best Practice for Organizing Jenkins Shared Library Resources

Which is the best practice for storing configuration files like YAML or JSON in a Jenkins shared library to be used by pipeline scripts?

APlace configuration files inside the 'resources' directory and load them using the library resource loader.
BEmbed configuration files directly inside Groovy scripts in the 'vars' directory.
CStore configuration files in the root directory of the shared library repository.
DKeep configuration files outside the shared library and load them from an external URL.
Attempts:
2 left
💡 Hint

Think about separation of code and static resources in Jenkins libraries.