How to read properties file from Jenkins 2.0 pipeline script

前端 未结 4 1784
终归单人心
终归单人心 2020-12-03 10:44

I am attempting to write a pipeline script to use with Jenkins 2.0 to replicate our existing build. This original build used the envInject plugin to read a Java properties

4条回答
  •  萌比男神i
    2020-12-03 11:10

    I just fought with this yesterday and today. I wish the availability of this was easier to find.

    Grab the 'Pipeline Utility Steps' plugin.

    Use the readProperties step.

     def props = readProperties  file: 'dir/my.properties'
    

    One word of warning - what I expected to be booleans in the properties files were treated as strings.

提交回复
热议问题