-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
The Marathon plugin uses the net.sf.json.JSONObject class to deserialize the Marathon config. If a user accidentally includes a duplicate key (e.g. in env or labels), this class will combine the values of the duplicate keys into an array in the resulting generated Marathon config (in contrast to most JSON deserialization libraries, which pick the last key), leading to a schema violation when the plugin attempts to PUT the generated config to Marathon (this shows up as an HTTP 422 and no useful error message in Jenkins, due to JENKINS-37287).
For example, if you have an env like this:
{ "foo": "bar", "foo": "baz" }
The Marathon plugin will generate:
{ "foo": ["bar", "baz"] }
Values in the 'env' hash are only allowed to be strings, not arrays, so this fails Marathon's JSON schema validation, leading to the HTTP 422.