0
0
Jenkinsdevops~10 mins

Loading libraries in Jenkinsfile - Interactive Code Practice

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 named 'utils' in a Jenkinsfile.

Jenkins
library('[1]')
Drag options to blanks, or click blank then click option'
AsharedLib
BloadLibrary
Cutils
DimportLib
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name instead of the library name.
Forgetting to put the library name in quotes.
2fill in blank
medium

Complete the code to load a library with the identifier 'myLib' and specify the version '1.2.3'.

Jenkins
library(identifier: '[1]@1.2.3')
Drag options to blanks, or click blank then click option'
Autils
BlibVersion
CsharedLib
DmyLib
Attempts:
3 left
💡 Hint
Common Mistakes
Using the version as a separate parameter.
Omitting the '@' symbol before the version.
3fill in blank
hard

Fix the error in the code to correctly load a library named 'tools' with default version.

Jenkins
library('[1]')
Drag options to blanks, or click blank then click option'
Atools
Btools@latest
Dtools@default
Attempts:
3 left
💡 Hint
Common Mistakes
Including '@' without a version causes syntax errors.
Adding invalid version strings like '@default'.
4fill in blank
hard

Fill both blanks to load a library named 'commonLib' with version '2.0' and assign it to a variable 'lib'.

Jenkins
def lib = library('[1]@[2]')
Drag options to blanks, or click blank then click option'
AcommonLib
B1.0
C2.0
Dutils
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping version numbers.
Using wrong library names.
5fill in blank
hard

Fill all three blanks to load a library named 'buildTools' with version '3.1.4', assign it to 'tools', and call its 'compile' method.

Jenkins
def tools = library('[1]@[2]')
tools.[3]()
Drag options to blanks, or click blank then click option'
AbuildTools
B3.1.4
Ccompile
DbuildLib
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong method names.
Omitting the parentheses when calling the method.