Complete the code to define a stage with a single step that echoes a message.
pipeline {
agent any
stages {
stage('Example') {
steps {
[1] 'Hello, Jenkins!'
}
}
}
}The echo step prints a message to the Jenkins console output.
Complete the code to run a shell command inside a stage step.
pipeline {
agent any
stages {
stage('Build') {
steps {
[1] 'make build'
}
}
}
}The sh step runs shell commands on Unix-like agents.
Fix the error in the stage by completing the step to run a Windows batch command.
pipeline {
agent any
stages {
stage('Test') {
steps {
[1] 'dir'
}
}
}
}The bat step runs Windows batch commands like dir.
Fill both blanks to create a stage with two steps: echo a message and run a shell command.
pipeline {
agent any
stages {
stage('Deploy') {
steps {
[1] 'Starting deployment'
[2] 'deploy.sh'
}
}
}
}The first step prints a message with echo. The second runs a shell script with sh.
Fill all three blanks to create a stage with steps: echo a message, run a shell command, and pause for input.
pipeline {
agent any
stages {
stage('Approval') {
steps {
[1] 'Ready for approval'
[2] 'echo Waiting for user'
[3] message: 'Proceed?', ok: 'Yes'
}
}
}
}The steps print a message with echo, run a shell echo with sh, and pause for user approval with input.