What does the agent mean in jenkins?

I can feel you :-D. Here are the answers:

  1. The agent section specifies where the entire Pipeline, or a specific stage, will execute in the Jenkins environment depending on where the agent section is placed. The section must be defined at the top-level inside the pipeline block, but stage-level usage is optional. - Content copied from the agent section

  2. NO, this has nothing to do with the pipeline runtime folder path.

  3. You can for example Create an agent/node by the following tutorial: How to Setup Jenkins Agent/Slave Using Password and ssh Keys. - But there are many other ways to create an agent e.g. using a Docker-Container (...).

  4. You can Set a label under the Configuration of the Node. You can use a label in your pipeline like:

     pipeline {
     agent { label 'labelName' }
     (...)
     }
    

While @adbo covered questions asked, Jenkins glossary describes agent really well:

typically a machine, or container, which connects to a Jenkins controller and executes tasks when directed by the controller.

You can choose to run entire pipeline on any available agent (agent any at the top of the pipeline) or run a specific stage on the agent of choice e.g. run build stage in a specific environ by overriding agent in that stage:

agent { docker { image 'my image' } }

Tags:

Jenkins