where did the workspace go in jenkins pipelines

Main menu:


Recent Posts


RSS Feed RSS - Posts

July 2016
« Jun   Aug »

Past Posts

Java/Java EE



where did the workspace go in jenkins pipelines

July 10th, 2016 by Jeanne Boyarsky

I was encountering an odd problem and needed to see what files were in a Jenkins workspace. For a freestyle job, this is easy; you just click on “workspace.”


Where did it go?

When using a pipeline, you can have multiple nodes in your pipeline so it isn’t that simple. As described in JENKINS-33839, this means you need to click around to get to it. While I did find it, this isn’t something I do often enough to remember so writing it up for my future self and anyone else who happens to read this. (Right after I wrote this, I saw JENKINS-34321 which does explain the steps well. Mine has pictures so might as well leave it.)

  1. First, go to the build run you are interested in and click “pipeline steps”.
  2. The click “allocate node: start”. If you have multiple nodes, you’ll need to do this more than once.
  3. Then you click the workspace link.


Implication #1 – wipe out workspace is gone

Since the workspace is no longer tied to the job, there’s also no “wipe out workspace” option. If you need to delete the workspace, you need to delete the entire run of the job. (Maybe someone had something in the build that they shouldn’t and you want it gone.) Ok. No big deal. You have to delete a bit more than before, but it isn’t as if it is something you need for posterity.

Implication #2 – multiple “workspaces”

Since you get to the workspace from within the build, I thought this meant there were multiple. And I was afraid for the disk space. Luckily, that is not the case. Within the same node, each build does re-use the same workspace. So if you go to an old build and look at the “workspace”, it is the workspace from the latest run. Which isn’t intuitive, but I’m glad it works that way.


Comment from graham
Posted: February 9, 2017 at 8:23 am


on disk the workspace is now in ~jenkins/workspace, rather than buried under jobs. but there’s more than one per job now, which means you have to work out which one belonged to that build

Comment from gsnerf
Posted: February 17, 2017 at 7:11 am

That info is not completely correct, you can use step([$class: ‘WsCleanup’]) in your pipeline to clean the workspace automatically

Comment from Jeanne Boyarsky
Posted: February 19, 2017 at 11:09 am

@gsnerf: True. I don’t want to clean the workspace automatically though. I want to do it on demand manually like I used to be able to. That way the workspace is there after for review, but I can clean it out as needed

Comment from hyos
Posted: August 7, 2017 at 7:45 am

@Jeanne Boyarsky but you absolutely can, go into the last build, hit replay, replace pipeline with cleanWs(), run once.

Comment from hyos
Posted: August 7, 2017 at 7:46 am

or deleteDir() should do the same

Write a comment