0
0
Jenkinsdevops~10 mins

Why shared libraries reduce duplication in Jenkins - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load a shared library in Jenkins pipeline.

Jenkins
def lib = [1] 'my-shared-library'
Drag options to blanks, or click blank then click option'
Alibrary
BimportLibrary
CloadLibrary
DuseLibrary
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'loadLibrary' which is not a Jenkins pipeline step.
Trying to import shared libraries like normal code imports.
2fill in blank
medium

Complete the code to call a function named 'buildApp' from the shared library.

Jenkins
lib.[1]()
Drag options to blanks, or click blank then click option'
AbuildApp
BexecuteBuild
CstartBuild
DrunBuild
Attempts:
3 left
💡 Hint
Common Mistakes
Using a wrong function name that does not exist in the library.
Trying to call the function without the library object.
3fill in blank
hard

Fix the error in the code to correctly load the shared library with a specific version.

Jenkins
def lib = library(name: 'my-shared-library', [1]: '1.2.3')
Drag options to blanks, or click blank then click option'
Acommit
Btag
Cbranch
Dversion
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'version' which is not a valid key.
Using 'branch' when specifying a tag version.
4fill in blank
hard

Fill both blanks to define a shared library in Jenkinsfile with default version and retriever.

Jenkins
@Library('[1]@[2]') _
Drag options to blanks, or click blank then click option'
Amy-shared-library
Bmaster
Cmain
Ddevelop
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong branch names like 'master' if the repo uses 'main'.
Mixing up library name and branch name.
5fill in blank
hard

Fill all three blanks to create a shared library call with a custom retriever and version.

Jenkins
library(name: '[1]', retriever: [2], [3]: 'release-1.0')
Drag options to blanks, or click blank then click option'
Acustom-shared-lib
BmodernSCM(scm)
Ctag
Dbranch
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'branch' instead of 'tag' for version.
Not using modernSCM for retriever.