Recall & Review
beginner
What is library versioning in Jenkins pipelines?
Library versioning in Jenkins pipelines means specifying which version of a shared library your pipeline should use. This helps keep your builds stable and predictable.
Click to reveal answer
beginner
How do you specify a library version in a Jenkinsfile?
You specify a library version in a Jenkinsfile using the @Library annotation with the version name, like: <br>
@Library('my-shared-lib@1.2.3') _Click to reveal answer
intermediate
Why is it important to use specific library versions instead of 'latest' in Jenkins?
Using specific versions avoids unexpected changes in your pipeline behavior. 'Latest' can change anytime, causing builds to break or behave differently.
Click to reveal answer
intermediate
What happens if you don't specify a version for a shared library in Jenkins?
If no version is specified, Jenkins uses the default branch of the library, often 'master' or 'main'. This can lead to unpredictable pipeline results if the library changes.
Click to reveal answer
advanced
How can you manage multiple versions of a shared library in Jenkins?
You can tag or branch your shared library repository for each version. Then, in Jenkinsfile, use the tag or branch name in the @Library annotation to pick the version you want.
Click to reveal answer
How do you specify a version of a shared library in a Jenkinsfile?
✗ Incorrect
The correct syntax is @Library('lib-name@version') _ to specify the library and its version.
What is the risk of using the 'latest' version of a shared library in Jenkins?
✗ Incorrect
Using 'latest' can cause builds to break because the library code might change without notice.
If no version is specified for a shared library, Jenkins uses:
✗ Incorrect
Jenkins defaults to the library's default branch, usually 'master' or 'main'.
How can you create different versions of a shared library?
✗ Incorrect
Tagging or branching in version control creates distinct versions to use in Jenkins.
What does the underscore (_) mean after the @Library annotation?
✗ Incorrect
The underscore tells Jenkins to load the library into the pipeline script context.
Explain how to use library versioning in a Jenkins pipeline and why it is important.
Think about how you tell Jenkins which library code to use.
You got /4 concepts.
Describe the consequences of not specifying a library version in Jenkins pipelines.
Consider what happens when you don't lock the library code.
You got /4 concepts.