Recall & Review
beginner
What is the purpose of the
agent directive in a Jenkins pipeline?The
agent directive tells Jenkins where to run the pipeline or a specific stage. It can specify a node, a label, or run on any available agent.Click to reveal answer
beginner
How do you specify that a Jenkins pipeline should run on any available agent?
Use
agent any in the pipeline script to tell Jenkins to run the pipeline on any available agent.Click to reveal answer
intermediate
What does
agent none mean in a Jenkins pipeline?agent none means the pipeline itself does not run on any agent by default. You must specify agents for individual stages if needed.Click to reveal answer
beginner
How can you specify a specific label for the agent in Jenkins pipeline?
Use
agent { label 'label-name' } to run the pipeline or stage on an agent with that label.Click to reveal answer
intermediate
Can the
agent directive be used inside individual stages in Jenkins pipelines?Yes, you can specify
agent inside stages to run that stage on a different agent than the rest of the pipeline.Click to reveal answer
What does
agent any do in a Jenkins pipeline?✗ Incorrect
agent any tells Jenkins to run the pipeline on any available agent.Which
agent directive means no default agent is assigned to the pipeline?✗ Incorrect
agent none means the pipeline does not run on any agent by default.How do you specify an agent with a label in Jenkins pipeline?
✗ Incorrect
Use
agent { label 'my-label' } to run on an agent with that label.Can you use different agents for different stages in a Jenkins pipeline?
✗ Incorrect
You can specify
agent inside stages to run them on different agents.What happens if you omit the
agent directive in a declarative Jenkins pipeline?✗ Incorrect
In declarative pipelines,
agent is required unless you use agent none.Explain the role of the
agent directive in Jenkins pipelines and how it affects where your code runs.Think about how Jenkins knows where to run your pipeline or stages.
You got /4 concepts.
Describe how you can run different stages of a Jenkins pipeline on different agents using the
agent directive.Consider a pipeline that needs different environments for build and test.
You got /3 concepts.