Read .txt file from workspace groovy script in Jenkins

前端 未结 2 404
暖寄归人
暖寄归人 2021-01-07 13:04

I am new to Jenkins and to groovy scripting, I want to read a .txt file which is located in the workspace of one of the jobs. I am trying to do this way:

myfil

2条回答
  •  一向
    一向 (楼主)
    2021-01-07 13:30

    Try this:

    file = new File("${Jenkins.instance.getJob('JobName').workspace}/file.txt").text
    

提交回复
热议问题