Summary
You want to use a property whose value is extremely large in a Groovy job. When the property is expanded, you see the following error:
String too long. The given string is 85408 Unicode code units long, but only a maximum of 65535 is allowed.
Problem
This issue can occur if you expand properties using $[/path/to/property]
. The way to understand this is as follows:
Prior to the script being executed by the Groovy interpreter, it is parsed by the CD interpreter and the $[myvar]
notation is written as text into the Groovy script. Then the Groovy script simply has a string constant. There is a Groovy limitation where string constants cannot exceed 65535 characters.
Solution
Instead of expanding properties like:
$[/path/to/property]
You should instead use:
ef.getProperty(propertyName: "/path/to/property").property.value
This getProperty
mechanism for retrieving the value is functionally equal to the $[/path/to/property]
method, but the method is a Groovy method being executed in the script by the Groovy interpreter and so it comes in escaped for Groovy.