[BUG] Extra file JSON object passed via CLI --extra-files parameter is improperly parsed #2519
Labels
priority: p3
Desirable enhancement or fix. May not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Environment details
release-please
version: 17.0.0Issue:
When passing an object via the
--extra-files
parameter (for example, an object with"type": "yaml"
,"path": "scripts/helm/dev-ext/sa-east-1/values.yaml"
,"jsonpath": "$.rollout-Canary.image.tag"
and"glob": false
), Release Please appears to parse each property separately as a file path. Instead of treating the JSON object as a single extra file configuration, its keys and values are fetched individually from the target branch.Reproduction:
{type:"yaml"
path:"scripts/helm/dev-ext/sa-east-1/values.yaml"
jsonpath:"$.rollout-Canary.image.tag"
glob:false}
as separate files from branch
main
.Expected Behavior:
The JSON array containing the extra file object should be parsed correctly. The CLI should use the
"type"
field to determine the updater (e.g.,GenericYaml
for"yaml"
type) and apply the"jsonpath"
to update the file content, rather than treating the object properties as independent file paths.The CLI should pick up the
--extra-files
parameter as a valid JSON array containing a single object. That object should then be processed by theextraFilePaths
andextraFileUpdates
methods (see attached snippet from base.ts), determining the file paths and updater type without fetching individual object properties from the branch.Context:
Looking at the source code in base.ts, the method
extraFilePaths(extraFile: ExtraFile)
expects an object but then processes it in a way that suggests the entire object should represent a single extra file. The behavior above indicates that the passed JSON isn’t being recognized as an object with keys but rather as separate string inputs.Requirements
I'm using the CLI with the
--extra-files
parameter instead of a configuration file or manifest because in our CI pipeline we don't expect to have both files in the repository. We need this behavior to override options locally. I have also tested using a configuration file, but every time the CLI still attempts to fetch the file remotely from the main branch. I'm open to learning if there's a way to override some config or manifest options using local files, but currently, my goal is to pass the extra file data directly via the CLI.Additional Context
Below is a brief excerpt from
base.ts
where the extra files are processed:Also this following code when the GenericYaml CompositeUpdate is called:
This issue suggests that the CLI does not recognize the JSON object as a whole, and each property ends up being treated as a separate file.
Any help or guidance to resolve this behavior would be appreciated.
The text was updated successfully, but these errors were encountered: