Reputation: 1845
We're having a big project (in terms of size), that we're trying to build using a Jenkinsfile
that is checked inside the project itself.
In order to conserve disk space and build times we try to minimize the number of copies, so what we would want is to use the folder where the Jenkinsfile
is checked out, since that is already a repo fully cloned.
Manually investigating, I've seen that there is a workspace@script
folder created inside the job's folder. That is folder path that I would like to obtain.
I would have expected pwd()
to do the trick, but for some reason that works only inside nodes, resolving the path to that folder.
stage "Build"
def scriptWorkspace=??
node {
sh """
TERM=xterm ls --color /etc
set
docker run ... -v ${scriptWorkspace}:/mercurial-repository ...
"""
}
Upvotes: 0
Views: 1459
Reputation: 25451
Pending an implementation of JENKINS-33273 for the SCM you are using (Mercurial in this case I suppose? would require use of the “caching” feature in that plugin), Jenkinsfile
is always checked out on a private workspace on the master node, not available to the script itself.
Upvotes: 2