How to Find Jenkins Workspace Directory in Linux

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to talk about how to find the jenkins workspace directory in linux [Music] when you're first starting out with jenkins more than likely you're just creating jobs however you might have thought to yourself okay when i run this job where's it actually running this location where the job runs is known as a workspace in this video we're going to look at the different places a workspace can exist when a job is run here's today's starting point i have a jenkins lts controller version 2.303.3 when this controller was installed it was installed using install suggested plugins i also have one executor configured on this controller and attached to this controller i have a linux based agent that has a single executor configured so let's take a look first at the top here we can see that there is a warning and we're going to take a look at this warning and what it tells us is that building on the controller node can be a security issue you should set the number of executors on the controller to zero and that's always true you should always set your controller executed account to zero but for this example in this video i want to give us one executor so we can see where a workspace is created just in case you do have an executor configured on your controller now let's take a look at the two places that we're going to be visiting as we go through this video today first off we need to understand the concept of the jenkins home the jenkins home directory is where all of the jobs are defined where all of the configuration files are for jenkins to run it is basically the data store for everything for jenkins and how do we know where to find that we can click on manage jenkins click on configure system and under home directory we're going to see in our specific case it's var lib jenkins much like the controller has a home directory the agent also has something that's called a remote root directory and if we go over and take a look at our agent we'll click on agent 1 and click on configure our remote root directory on our agent which you could consider that as being the home directory for where workspaces are going to live is defined in this case under home vagrant agent so now that we've taken a look at where the location is for our home directory on our controller and where the remote root directory is on our agent let's go take a look at a couple of jobs that i already have created i have a job that's created for on controller and a job created for on agent and both of these are at the root of our controller and then if i look here i have a folder one that has a child folder too that then has an on agent and on controller jobs there as well so let's go back up to the root and let's run our on controller and let's take a quick look at this job this job's very simple all we're saying is pipeline agent label controller and we're going to do sh echo on the controller so if we click on oncontroller and click on build now what we're going to see here is for build number two we can see that it ran on jeekins in var lib jenkins workspace on controller so this is one way we can find out where our workspace exists when a job runs a workspace is going to be in context of when a job runs now the known locations for those workspaces are already known we can see here that workspace lives under var lib jenkins on the controller another way that we can look at this is if you'll notice on the left nav we have a workspaces folder icon here if we click into this we can see that the workspace for this number to run was var lib jenkins workspace on controller now let's go back up to the root of our controller again and click on on agent now if we take a look at this job what we have is pipeline agent on label agent 1 and sh echo on the agent 1. again nothing real exciting here if you will but let's go ahead and click on build now and then we'll look at the output for number two and we can see here that we have a home vagrant agent remember that is our remote root directory that's configured on the controller saying where everything starts at on the agent then we have a workspace and then we have on agent and this on agent matches the name of our job just like we saw before we have a workspaces folder and we can see a full list here home vagrant agent workspace on agent now remember we had these two jobs defined at the root of our controller but what happens when we have jobs that are defined in folders well let's go take a look at that if we click on on controller and do a build now and the job is the exact same job that we had at the root what we have here is we are running on jenkins var lib jenkins workspace and then we can see that the path down to on controller follows the naming of our folders so the workspace for job number two for on controller that lives in folder two that lives in folder one is workspace folder one folder two on controller similarly if we go over and take a look at on agent and click on build now when we take a look at the output of two we see roughly the same thing but it's our remote root directory workspace and then folder one folder two on agent and if we click on workspaces on the left nav we can see here again home vagrant agent that is our remote root directory workspace then folder 1 folder 2 on agent on agent 1 for build number two if you have any questions or comments you can reach out to us on twitter at cloudbees if this video was helpful to you give us a thumbs up and if you haven't subscribed to cloudbees tv yet why not take a moment click on that subscribe button and then ring that bell and you'll be notified anytime there's new content available on cloudbees tv thanks for watching and we will see you in the next video you
Info
Channel: CloudBeesTV
Views: 445
Rating: undefined out of 5
Keywords: darin pope, jenkins, jenkins tutorial, jenkins workspace, what is workspace in jenkins, what is jenkins workspace, jenkins workspace variable, jenkins workspace directory, workspace jenkins, workspace in jenkins, jenkins workspace location, jenkins job workspace, jenkins default workspace, jenkins workspace dir, jenkins slave workspace, jenkins basics, jenkins beginner tutorial
Id: 0SR08akM5C4
Channel Id: undefined
Length: 6min 36sec (396 seconds)
Published: Thu Nov 18 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.