Upsert entity - option to append/detach relationships rather than overwrite
M
Mark Tarry
When performing an entity upsert via automations, API, Terraform, GitHub Actions, etc, any relationship values are overwritten with that specified on the upsert request.
This makes maintaining "many" relationships non-trivial, as now the caller must:
- Fetch the current entity state
- Extract the relationship which are to be modified
- Manipulate the relationship arrays
- Perform the upsert API call
Notice the above requires 2 API calls (GET and PATCH) - meaning that, in any scenario where it's possible to have multiple jobs running in parallel (e.g. automations, event-driven workflows), we also now need some form of "transaction locking" in place, to ensure we don't end up with relations being overwritten from a race condition.
M
Mark Tarry
I noticed a similar suggestion here: https://roadmap.port.io/ideas/p/ability-to-aggregate-relations-across-multiple-portyaml-files
But this seemed to focus on GitOps data ingestion, whereas I'm focusing on data pushed via the Port API