where did the workspace go in jenkins pipelines

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.”

workspace-freestyle

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”.
    pipeline-1
  2. The click “allocate node: start”. If you have multiple nodes, you’ll need to do this more than once.
    pipeline-2
  3. Then you click the workspace link.
    pipeline-3

 

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.