Currently, I use a agent to run the pipeline of the project.Jenkins reuses the built workspace by default, but I wanted to use customWorkspace to use a new workspace for each build, so that I don’t have to delete and back up the previous build. How does this affect Jenkins’ performance?
Can you explain what you mean with delete and backup the previous build?
ws step in a pipeline would still use the same thing unless you include the build number in the path. But if you do this then you need to look at disk space as you would add a new directory for each build.
If you need a clean directory, you can use the
deleteDir step in a pipeline.
Reusing the workspace can be of advantage when you have larger git repositories as you don’t need to clone the complete repo each time.
If the build system allows, separate the git directory with the sources from the directories where you build.
I needed to do the samething and i can tell the performance is not affected, but depending on the code you are executing it could be more or less complicated.
By one side you will have the environmental variable WORKSPACE which is defined in the system (for example when running os commands, either bash or batch), by another side there are native groovy commands that plays with a defined workspace (for example clone from a repo using jenkins functions). When you use a custom workspace jenkins automatically does not update this workspace in the both scenarios aforementioned, but you need to take care of that, but once it is done, the performance shouldn’t be affected
Thank you veri much!