In Jenkins, each stage in a pipeline is executed in a separate workspace directory. The workspace is a local directory on the Jenkins agent where the pipeline is running. Each stage can have its own workspace, and the workspace is typically isolated from other stages. So, what if we want to change to some subdirectory?! There’s a function for it already.
Let’s say you want to create a subdirectory called
newsubdir (very creative) and execute
pwd in it. It should look like this:
newsubdir can be relative or absolute path.
In case you face any issues, feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.