Complete the code to load a shared library in Jenkins pipeline.
def lib = [1] 'my-shared-library'
In Jenkins pipelines, the library step loads a shared library.
Complete the code to call a function named 'buildApp' from the shared library.
lib.[1]()To call a function from the shared library, use its exact name, here buildApp.
Fix the error in the pipeline code to correctly load the shared library with a specific version.
def lib = library('[1]@v1.2.3')
The correct syntax is library('my-shared-library@version') where the library name and version are separated by '@'.
Fill both blanks to define a test pipeline that loads the shared library and calls 'testApp' function.
pipeline {
agent any
stages {
stage('Test') {
steps {
script {
def lib = [1] 'my-shared-library'
lib.[2]()
}
}
}
}
}Use library to load the shared library and call the testApp function to run tests.
Fill all three blanks to create a Jenkinsfile that loads a shared library, calls 'deployApp', and uses a specific version 'v2.0'.
pipeline {
agent any
stages {
stage('Deploy') {
steps {
script {
def lib = [1] '[2]@[3]'
lib.deployApp()
}
}
}
}
}Use library to load the shared library with the name and version separated by '@'.