Complete the code to define a global shared library in Jenkins pipeline.
library '[1]'
The library step loads the global shared library by its configured name, here 'my-shared-lib'.
Complete the code to call a function 'buildApp' from the shared library.
library('my-shared-lib') buildResult = [1]()
The function buildApp() is called from the shared library after loading it.
Fix the error in the global library configuration snippet to specify the SCM repository URL.
libraries {
myLib {
scm {
git {
url = '[1]'
}
}
}
}The SCM URL must be a valid Git HTTPS URL ending with .git for Jenkins to clone the repository correctly.
Fill both blanks to configure the global shared library with default version and allow override.
libraries {
myLib {
defaultVersion = '[1]'
allowVersionOverride = [2]
}
}The defaultVersion is usually set to the main branch name, and allowVersionOverride set to true allows pipelines to specify other versions.
Fill all three blanks to define a global shared library with name, SCM URL, and default version.
libraries {
[1] {
scm {
git {
url = '[2]'
}
}
defaultVersion = '[3]'
}
}The library name is 'utilsLib', the SCM URL points to the GitHub repo, and the default version is set to 'main' branch.