Jenkins : Content Replace Plugin

Plugin Information

View Content Replace on the plugin site for more information.

A plugin for Jenkins allows you to replace file content with regex expressions.

Features

  • Regex expression for search. e.g. (Version=)([0-9]+\.[0-9]+\.[0-9]+)
  • You can use variables enclosed in ${}

Requirements

Jenkins

Jenkins version 2.7.3 or newer is required.


Freestyle job configuration


Pipeline job configuration

contentReplace(
	configs: [
		fileContentReplaceConfig(
			configs: [
				fileContentReplaceItemConfig( 
					search: '(Version=)\\d+.\\d+.\\d+',
					replace: '$11.0.${BUILD_ID}',
					matchCount: 1)
				],
			fileEncoding: 'UTF-8', 
			filePath: 'versions.txt')
		])

Changelog

Version 1.0.10 (Aug 20, 2019)

  • Fixed, match count

Version 1.0.8 (Aug 09, 2019)

  • Fixed, close InputStream after read the file‘s content

Version 1.0.7 (June 21, 2019)

  • Fixed, matchCount not to be reset to 1 When editing the configuration file again

Version 1.0.5 (Apr 07, 2019)

  • Fixed, support windows slave, linux master

Version 1.0.4 (Feb 21, 2019)

  • Fixed, support for absolute path file
  • Fixed, matchCount not to be reset to 1 When editing the configuration file again

Version 1.0.3 (Feb 19, 2019)

  • "File path" can be configured using variables

Version 1.0.2 (Oct 26, 2018)

  • Add "Match count" config

Version 1.0.1 (Aug 22, 2018)

  • Simply replace the contents of the specified encoded file

Attachments: