How can I view Jenkins workspace on a Pipeline job (it was called workflow job previously)? In a standard Job I could just go to the Job main page and view it by clicking on "Workspace".
6 Answers
- Go to the Jenkins build
- On the left hand side click the Pipeline steps
- Then on the right click on the link that says "Allocate node : Start - (x min in block)"
- On the the left side click the workspace. Done!
The image below might help :
Check out this link it shows how to get the workspace when you are using jenkins pipeline: https://www.selikoff.net/2016/07/10/workspace-jenkins-pipelines/
-
In which version is this available? In Jenkins ver. 2.89.2 I do not see any of those options. – Seweryn Habdank-Wojewódzki Jul 18 '19 at 14:24
-
2The link exists, but gives me `HTTP ERROR 403: Trying to access a file outside of the directory, target` – cowlinator Oct 16 '19 at 22:17
Pending JENKINS-26138 it is possible albeit inconvenient. Click Pipeline Steps (in older versions, Running Steps) and select the block start for the node
(or, rarely, ws
) step which created the workspace you are interested in. (Unlike with a freestyle project, there might be zero or several such steps in a given build.) On that step page there will be a Workspace link.

- 9,117
- 9
- 42
- 50

- 24,539
- 10
- 90
- 112
-
11[Detailed version of this same answer](https://www.selikoff.net/2016/07/10/workspace-jenkins-pipelines/), with pictures. – John McGehee Nov 09 '16 at 21:06
-
What if the link goes to a 404 page? The build is still running, so I know the workspace is still there. – Hakanai Nov 09 '17 at 04:25
-
Ah, I see .... the one in the node step always is 404, but the one in the workspace step works. So it does very much matter which one you look at, but maybe they should just show a working link in both, or take the link off the page if it is going to a 404 page. – Hakanai Nov 09 '17 at 04:44
just add a link using the manager.addShortText and manager.createSummary to the workspace in your pipeline job.
It simple.
if your Job in in a folder the path just changes the Foldername little
node("someslave")
{
stage("Create workspace link")
{
def Foldername = JOB_NAME;
def theString = "<a href='https://jenkins.com/job/" + Foldername + "/" + BUILD_NUMBER + "/execution/node/3/ws/'>Workspace</a>";
manager.addShortText(theString, "blue", "white", "0px", "white");
manager.createSummary("green.gif").appendText("<h1>" + theString + "</h1>", false, false, false, "blue");
}
}

- 47
- 1
-
1To get the above snippet running, the [Groovy Postbuild Plugin](https://wiki.jenkins.io/display/JENKINS/Groovy+Postbuild+Plugin) must be installed and the createSummary method must be approved at yourJenkins/scriptApproval/. – baumato Jul 16 '18 at 12:33
-
1`node/3/ws/` ist not always valid. It can be other nodes, especially with more complex builds, and it can even differ between different runs of the same build. – Leon S. Aug 24 '18 at 11:22
-
2
-
6is there any programmatic way of getting that magic number /3/ in the path? – dokaspar Mar 06 '20 at 12:27
-
@leondepeon can you specify where the /3/ is coming from? I.e. do you know an answer to dokaspar's question? – PixelMaster Sep 04 '20 at 15:43
-
1@somaiah-kumbera @dokaspar @PixelMaster For everyone asking about the `/3/` part, this is internal logic of the pipeline/API plugin and appears to represent a `node() { ... }` block in Groovy. The number has no easily discernible pattern, and it is not listed in any of the APIs. I looked through Jenkin's sources, but couldn't find a way to get this number or the url from groovy through any of the node/computer/job objects. You could try to read the Html DOM on the page listing the workspaces, which is displayed on `
/ – Leon S. Sep 07 '20 at 10:45/ws/`.
1) first go to pipeline steps and you will able to see build steps and triggered builds.
2) you can see build id or number whatever you say #89. click on that and you will get
below view.
3) now click on work space link.

- 1,265
- 14
- 14
Configure custom workspace as follows:
- Go to Job_Name -> Configure -> Advanced Project Options
- Enable the checkbox named "Use custom workspace"
- Fill 'Directory' field relevant to your workspace(absolute path if not exported)
eg: $JENKINS_HOME/Myspace, /home/administrator/Mywork

- 441
- 5
- 10
-
2This does not answer OP's question - how to browse through workspace via Jenkins GUI – Vadim Kotov Sep 12 '17 at 10:51