I have a Jenkins pipeline with a pipeline script stored in a repository. This pipeline is working well with Jenkins 2.114. After installing a new Jenkins 2.187 on a new machine with all corresponding plugins, I am facing a problem of wrong current directory path returned from pwd() function on this new installation.
Within the pipeline script I am calling pwd() in order to get the current work-space path (the current OS working directory). The returned path is wrong, it even does not exist. env.WORKSPACE returns exactly the same wrong path.
The pipeline creates two folders in the work-space:
{Jenkins_Workspace}/{item_full_name}@script and {Jenkins_Workspace}/{item_full_name}@3.
The returned value from pwd() is {Jenkins_Workspace}/{item_full_name}@2 . env.WORKSPCE gives the same path {Jenkins_Workspace}/{item_full_name}@2. {Jenkins_Workspace}/{item_full_name}@2 does not exist.
It is strange that Jenkins appends @{number} to the workspace. It is a very simple pipeline, which does not execute other projects. It is just one job being executed, i.e. no concurrency.
My configuration:
Jenkins: 2.187
Pipeline: 2.6
OS: Windows Server 2016
Jre: 1.8.0_144-b01
Jenkins home: C:/Jenkins
Jenkins workspace: modified in config.xml to <workspace>D:/Workspace/${ITEM_FULL_NAME}</workspace>