I am testing a seed job in jenkins. So that, I am using dsl groovy script which call uploaded script from a File location parameter" in Jenkins configuration.
So I defined, 'src/test' as a File location parameter".
Then, I am calling it in the dsl step in the seed job using readFileFromWorkspace
function.
steps {
dsl{
text(readFile("src/test/UnixDSLJob.groovy"))
ignoreExisting()
removeAction('DELETE')
removeViewAction('DELETE')
}
}
I got this error :
ERROR: (script, line 20) File src/test/UnixDSLJob.groovy does not exist in workspace
Then, I tried to test if there is no issue about the existance of the file using this command :
def file = readFileFromWorkspace("src/test/UnixDSLJob.groovy")
out.println(file)
I got the same error.
Or, I am sure that I upload the file before lunching the build.
I tried many solutions given here, like using readFile
instead ofreadFileFromWorkspace
, but I still having same issue.