How to append a text to a file in jenkinsfile

前端 未结 3 1356
清酒与你
清酒与你 2021-02-19 02:43

How to append a text to a file in Jenkinsfile injecting Jenkins BUILD_ID

I wish to see

version := \"1.0.25\"

3条回答
  •  余生分开走
    2021-02-19 03:26

    The pipeline built in writeFile is also very useful here but requires a read+write process to append to a file.

    def readContent = readFile 'build.sbt'
    writeFile file: 'build.sbt', text: readContent+"\r\nversion := 1.0.${env.BUILD_ID}"
    

提交回复
热议问题