In Jenkins pipeline, when a build is run on a particular node, a workspace is allocated on that agent. We do not set the workspace path, so it's automatically determined. I understand that the workspace must contain the executor number to isolate builds when the same job is running concurrently on the same agent.
But... How exactly is the workspace path constructed?
Our build is assigned to a particular node (with 4 executors) and is configured to not allow concurrent builds. Usually it was assigned:
EXECUTOR_NUMBER=1
WORKSPACE=xxx\yyy\jobname
At some point, the build started to run on executor 2, but still using the same workspace as before.
Later on, the build was again running on executor 1, but now using
WORKSPACE=xxx\yyy\jobname@2
which broke the build because it can't handle the '@' sign in the path. From that point on, the build continued to use that workspace, even after setting number of executors on the build machine to 1, manually removing the agent's workspace dir etc.
So my questions are:
- How exactly is the workspace path being determined? Why does it get @2 suffix suddenly?
- Does Jenkins re-use previous workspace, regardless of executor number?
- If so, where is this information stored? I could not find anything in the job configs related to last used workspace path...
Thanks for any insights!
We're using Jenkins LTS 2.107.2 and up-to-date Pipeline plugins (I don't know which version is of special interest).