Complete the code to define a Jenkins pipeline with a build stage.
pipeline {
agent any
stages {
stage('Build') {
steps {
[1] 'echo Building the project'
}
}
}
}The sh step runs shell commands in Jenkins pipelines. Here, it runs the echo command in the build stage.
Complete the code to add a test stage that runs tests using a shell command.
pipeline {
agent any
stages {
stage('Test') {
steps {
[1] 'echo Running tests'
}
}
}
}The sh step is used to run shell commands like test scripts in Jenkins pipelines.
Fix the error in the deploy stage by completing the code to run a shell command.
pipeline {
agent any
stages {
stage('Deploy') {
steps {
[1] 'echo Deploying application'
}
}
}
}The sh step is required to run shell commands in Jenkins pipelines, including deployment commands.
Fill both blanks to create a pipeline with build and test stages that run shell commands.
pipeline {
agent any
stages {
stage('Build') {
steps {
[1] 'echo Building'
}
}
stage('Test') {
steps {
[2] 'echo Testing'
}
}
}
}Both build and test stages use the sh step to run shell commands.
Fill all three blanks to create a full pipeline with build, test, and deploy stages running shell commands.
pipeline {
agent any
stages {
stage('Build') {
steps {
[1] 'echo Build started'
}
}
stage('Test') {
steps {
[2] 'echo Test started'
}
}
stage('Deploy') {
steps {
[3] 'echo Deploy started'
}
}
}
}All stages use the sh step to run shell commands in Jenkins pipelines.