0

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.

user8810618
  • 115
  • 11
  • Have you check the permissions whether the Jenkins user has permission to read the groovy file ? – Sourav May 14 '21 at 11:27
  • @SouravAtta, I don't think that it's a permission problem because I did this task, two weeks ago. But, I forgot which command I used to read the .groovy file – user8810618 May 14 '21 at 11:49

0 Answers0