How to get the folder where the Jenkinsfile test file (Jenkins) was downloaded

We have a large project (in terms of size), which we are trying to build with the help Jenkinsfilethat is checked inside the project itself.

To save disk time and build time, we try to minimize the number of copies, so we want to use the folder in which it is marked Jenkinsfile, since this is already a fully cloned repo.

In manual search, I saw that there is a folder in the tasks folder workspace@script. This is the path to the folder that I would like to receive.

I would expect it to pwd()do the trick, but for some reason it only works inside the nodes, allowing the path to this folder.

stage "Build"

def scriptWorkspace=??

node {
  sh """
    TERM=xterm ls --color /etc
    set

    docker run ... -v ${scriptWorkspace}:/mercurial-repository ...
  """
}
0
1

JENKINS-33273 SCM (Mercurial , , " ), Jenkinsfile node, script.

+2

All Articles