Complete the code to define a simple Jenkins pipeline.
pipeline {
agent any
stages {
stage('Build') {
steps {
[1] 'echo Building...'
}
}
}
}The sh step runs shell commands in Jenkins pipelines.
Complete the code to specify the pipeline agent.
pipeline {
agent [1]
stages {
stage('Test') {
steps {
sh 'echo Testing...'
}
}
}
}The agent any means the pipeline can run on any available agent.
Fix the error in the pipeline syntax to run a shell command.
pipeline {
agent any
stages {
stage('Deploy') {
steps {
[1] 'echo Deploying...'
}
}
}
}The correct Jenkins pipeline step to run shell commands is sh.
Fill both blanks to create a stage with a shell step that echoes a message.
pipeline {
agent any
stages {
stage([1]) {
steps {
[2] 'echo Hello World'
}
}
}
}The stage name must be a string like 'Greeting', and the shell step is sh.
Fill all three blanks to define a pipeline with an agent, a stage name, and a shell step.
pipeline {
agent [1]
stages {
stage([2]) {
steps {
[3] 'echo Pipeline as Code'
}
}
}
}The agent is any, the stage name is a string 'ExampleStage', and the shell step is sh.
