The feature of being able to insert/merge into an array of maps based on a key is super slick. It also requires that every map within the array contain said key though. It'd be nice if it would fail silently and ignore maps that didn't contain the key.
Example
Since many use this repo with Concourse pipelines, I'll use a pipeline-like example
pipeline.yml
jobs:
- name: first
plan:
- get: resource
- task: do stuff
- task: other stuff
- put: another
settings.yml
jobs:
- name: first
plan:
- (( insert after task "do stuff" ))
- task: more stuff
In this example I'm trying to add a task "more stuff" between the "do stuff" and "other stuff" tasks in the plan. Merging these two files yields an error though.
$ spruce merge pipeline.yml settings.yml
1 error(s) detected:
- $.jobs.first.plan.0: original object does not contain the key 'task' - cannot merge by key
Ideally, this would be the result, it would ignore the maps that don't contain the task key in them.
jobs:
- name: first
plan:
- get: resource
- task: do stuff
- task: more stuff
- task: other stuff
- put: another
The feature of being able to insert/merge into an array of maps based on a key is super slick. It also requires that every map within the array contain said key though. It'd be nice if it would fail silently and ignore maps that didn't contain the key.
Example
Since many use this repo with Concourse pipelines, I'll use a pipeline-like example
pipeline.yml
settings.yml
In this example I'm trying to add a task "more stuff" between the "do stuff" and "other stuff" tasks in the plan. Merging these two files yields an error though.
Ideally, this would be the result, it would ignore the maps that don't contain the
task
key in them.