Complete the code to define a simple Jenkins pipeline stage named 'Build'.
stage('Build') { steps { [1] 'echo Building the project' } }
The sh step runs shell commands in Jenkins pipeline.
Complete the code to add a stage named 'Test' that runs a shell command.
stage('Test') { steps { [1] 'echo Running tests' } }
The sh step runs shell commands on Unix-like agents.
Fix the error in the pipeline code to correctly define a stage named 'Deploy'.
stage('Deploy') { [1] { sh 'echo Deploying application' } }
The steps block is required inside a stage to define the commands to run.
Fill both blanks to create a pipeline with two stages: 'Build' and 'Test', each running a shell command.
pipeline {
agent any
stages {
stage('Build') {
[1] {
sh 'echo Building'
}
}
stage('Test') {
[2] {
sh 'echo Testing'
}
}
}
}Each stage requires a steps block to define the commands to run.
Fill all three blanks to create a pipeline with stages 'Build', 'Test', and 'Deploy', each running a shell command.
pipeline {
agent any
stages {
stage('Build') {
[1] {
sh 'echo Build started'
}
}
stage('Test') {
[2] {
sh 'echo Test started'
}
}
stage('Deploy') {
[3] {
sh 'echo Deploy started'
}
}
}
}All stages require the steps block to define the commands to run.
