Reading file from Workspace in Jenkins with Groovy script

前端 未结 7 1555
广开言路
广开言路 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:23

    If you are trying to read a file from the workspace during a pipeline build step, there's a method for that:

    readFile('name-of-file.groovy')
    

    For reference, see https://jenkins.io/doc/pipeline/steps/workflow-basic-steps/#readfile-read-file-from-workspace.

提交回复
热议问题