Complete the code to define a reusable pipeline step named 'buildApp'.
def [1]() { echo 'Building the application' }
The reusable step is defined as a function named 'buildApp'. This name is used to call the step later.
Complete the code to call the reusable step 'buildApp' inside the pipeline.
pipeline {
agent any
stages {
stage('Build') {
steps {
[1]()
}
}
}
}The reusable step 'buildApp' is called by using its function name followed by parentheses.
Fix the error in the reusable step definition by completing the missing keyword.
[1] buildApp() { echo 'Building the application' }
In Jenkins scripted pipeline, reusable steps are defined using the 'def' keyword before the function name.
Fill both blanks to define and call a reusable step named 'testApp' that prints 'Testing application'.
def [1]() { echo '[2]' } pipeline { agent any stages { stage('Test') { steps { testApp() } } } }
The function name 'testApp' matches the call in the pipeline. The echo message describes the step's action.
Fill all three blanks to create a reusable step 'deployApp' that takes an environment parameter and prints a deployment message.
def [1](env) { echo "Deploying to [2] environment" } pipeline { agent any stages { stage('Deploy') { steps { [3]('production') } } } }
The function is named 'deployApp' and takes 'env' as a parameter. The call uses 'deployApp' with the argument 'production'.