Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Jenkins workspace on the master or the worker?

Tags:

jenkins

Who does the actual cloning of the project, is it the master or the agent node? If it is the master, then how does the agent node actually execute the job. If it is the agent node, how can we view the workspace in the browser?

When people ask "where is the workspace" the answer is usually a path, but I am more interested in where that path is, on the master or the agent node? Or maybe it is both?

Edit1

Aligned terminology to this: https://jenkins.io/doc/book/glossary/ in order to avoid confusion.

In a Jenkins set up all the machines are considered nodes. The master node connects to one or more agent nodes. Executors can run both on the master or agent nodes.

In my scenario, no executors run on the master. They are run only on the agent nodes.

like image 249
Igorski Avatar asked Jan 24 '20 13:01

Igorski


1 Answers

The answer is: it depends !

First of all, although it is not a good practice IMO, some installation let the master be an actual worker and run jobs. In this case, the workspace will be on the master.

If you configured the master not to accept jobs, there are still occasion when a workspace can be created on the master. A good example is when your job is a "pipeline script from SCM". In this case, the master will create a workspace for the job, clone the target repo, read the pipeline, and start needed jobs on whatever slave is targeted, creating a workspace to run the actions themselves. If the pipeline targets multiple slaves, there will be a workspace on each of them.

In simple situation (e.g. maven or freestyle job), the workspace will only be on the targeted slave.

like image 163
Zeitounator Avatar answered Oct 22 '22 07:10

Zeitounator