Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Field

Data type

Description

Notes

[replacmentsRoot] denoted ---

Array

Multiple replacments can be defined in the yaml configuration and are separated by ---

Every replacement in the file must start with --- specified on its own line

filename

String

File name to replace string(s). Wildcard characters are allowed. If not specified, it means * (all files).

Example :

Optional.

Example 1:

fileName: '*.xml' replaces strings in all .xml files.

Example 2:

fileName: 'pom.xml' replaces strings in pom.xml file.

regexFileName

String

Regix Regex to match the files to replace the string.

Cannot have both filename and regexFileName in the same replacement.

stringToReplace

String

The string to be replaced.

regexToReplace

String

Regex that specifies a string pattern to be replaced. eg: <apiVersion>\d+\.0</apiVersion>

Cannot have both stringToReplace and regexToReplace in the same replacement.

replaceWithString

String

Specify the value for the replacement.

replaceWithEnv

String

Specify the name of the Environment variable. The value of the specified will be used for the replacement. You can use the Project, Target, and Instance Properties of FlexDeploy.

Example 1:

replaceWithEnv: FD_ENVIRONMENT_CODE

Example 2:

replaceWithEnv: FD_PROJECT_NAME

replaceWithFile

String

Specify the file with path. All the contents of the file will be used for replacement. eg: /u01/content/copyright.txt , $FD_ARTIFACTS_DIR/fdreplacements/copyright.txt, fdreplacment/copyright.txt (in temp)

replaceWithRandomCSV

String

Specify the comma-separated values. Will be used of them randomly for replacement. eg: Car,Bus,Train

replaceWithRandomCSVFile

String

Specify the path for csv file with column name. Will be used of them randomly for replacement. eg: /u01/content/states.csv , /u01/content/address.csv!state

replaceWithGroovyResults

String

Provide the groovy script. String value will be replaced with returned String.

replaceWhenEnv

String

Replaces when the environment variable matches the value. Can have multiple entries for replaceWhenEnv. The default condition is ‘and’, when multiple exists. FD_ENVIRONMENT_CODE is a default environment variable.

Example 1 (Replacing only when deploying to one or more environments):

replaceWhenEnv: [DEV,QA]

Example 2 (Replacing when an environment variable matches):

replaceWhenEnv:
- env: FDBLD_IS_MAIN_BRANCH
value: Y

Example 3 (multiple conditions)

replaceWhenEnv:
- env: FDSF_ACCOUNT_CODE        
value: FLEXAGON8     

- env: FDBLD_IS_MAIN_BRANCH
value: Y

...

Sample Replacement Configurations

Simple string replacement in all

...

files

Code Block
---
fileName: '*.xml'
replacements: 
  - stringToReplace:  '<CreatedBy>Taylor Swift</CreatedBy>'
    replaceWithString: '<CreatedBy>System</CreatedBy>'

...