I have a groovy file, I want to run from the Jenkinsfile.
ie. load script.groovy
However, I am not sure how I can reference this file if it is store
You can just assume that all file operations in the Jenkinsfile
are relative to the current workspace (which is the default workspace when using load
inside a node
).
So if the target file (say deploy_esb.groovy
) is inside the folder foo
in your SCM, this should work without additional configuration:
git branch: branch, url: 'ssh://git@giturl/integration_bus.git'
load 'foo/deploy_esb.groovy'
Or this if the file to load is in the same repository than the Jenkinsfile
:
checkout scm
load 'foo/deploy_esb.groovy'