Reading file from Workspace in Jenkins with Groovy script

前端 未结 7 1562
广开言路
广开言路 2020-11-30 04:12

I want to add a Build step with the Groovy plugin to read a file and trigger a build fail depending on the content of the file.

How can I inject the workspace file p

7条回答
  •  悲哀的现实
    2020-11-30 04:38

    If you already have the Groovy (Postbuild) plugin installed, I think it's a valid desire to get this done with (generic) Groovy instead of installing a (specialized) plugin.

    That said, you can get the workspace using manager.build.workspace.getRemote(). Don't forget to add File.separator between path and file name.

提交回复
热议问题