Recall & Review
beginner
What is a shared library in Jenkins?
A shared library in Jenkins is a collection of reusable code that can be used across multiple Jenkins pipelines to avoid rewriting the same code.
Click to reveal answer
beginner
How do shared libraries help reduce code duplication?
They centralize common code in one place, so pipelines can call the shared code instead of copying it, reducing repetition and errors.
Click to reveal answer
intermediate
What is one benefit of reducing duplication with shared libraries?
It makes maintenance easier because fixing or updating code in the shared library updates all pipelines using it automatically.
Click to reveal answer
beginner
Give an example of code that might be put in a Jenkins shared library.
Common tasks like sending notifications, checking out code, or running tests can be put in shared libraries to reuse in many pipelines.
Click to reveal answer
intermediate
Why is using shared libraries better than copying code between pipelines?
Copying code causes duplication, which leads to more errors and harder updates. Shared libraries keep code DRY (Don't Repeat Yourself).
Click to reveal answer
What is the main purpose of Jenkins shared libraries?
✗ Incorrect
Shared libraries are designed to hold reusable code that multiple pipelines can use to avoid duplication.
How does a shared library reduce errors in Jenkins pipelines?
✗ Incorrect
Centralizing code means fixing it once updates all pipelines, reducing errors from inconsistent copies.
Which of these is a good candidate for a shared library function?
✗ Incorrect
Common tasks like notifications are reusable and fit well in shared libraries.
What problem does code duplication cause in Jenkins pipelines?
✗ Incorrect
Duplicated code means more places to fix bugs and harder updates.
What does DRY stand for in software development?
✗ Incorrect
DRY means writing code once and reusing it to avoid duplication.
Explain how Jenkins shared libraries help reduce code duplication and why this is beneficial.
Think about how fixing one place can update many pipelines.
You got /4 concepts.
Describe a real-life example where using a shared library in Jenkins would save time and effort.
Imagine you have many pipelines that do the same steps.
You got /5 concepts.