Complete the code to define a Jenkins pipeline stage named 'Build'.
stage('[1]') { steps { echo 'Building the project' } }
The stage name should be 'Build' to represent the build step in the pipeline.
Complete the code to use the 'agent any' directive in a Jenkins pipeline.
pipeline {
[1] any
stages {
stage('Example') {
steps {
echo 'Hello World'
}
}
}
}The 'agent' directive tells Jenkins where to run the pipeline or stage. 'agent any' means run anywhere.
Fix the error in the Jenkins scripted pipeline to correctly echo a message.
node {
[1] 'Hello from Jenkins!'
}In Jenkins scripted pipelines, 'echo' is used to print messages to the console.
Fill both blanks to create a declarative pipeline with a 'Build' stage that runs on any agent.
pipeline {
[1] any
stages {
stage('[2]') {
steps {
echo 'Building...'
}
}
}
}'agent any' tells Jenkins to run the pipeline on any available agent. The stage name should be 'Build' to represent the build step.
Fill all three blanks to create a pipeline that runs on any agent, has a 'Test' stage, and echoes a test message.
pipeline {
[1] any
stages {
stage('[2]') {
steps {
[3] 'Running tests...'
}
}
}
}The pipeline uses 'agent any' to run anywhere, the stage is named 'Test', and 'echo' prints the message.