Skip to content

WIP: Services jsonb inheritance experiment II

Andy Schoenen requested to merge services_jsonb_settings_3 into master

What does this MR do?

It evaluates the possibility to use a JSON field to store service settings and to merge those settings in order to implement settings field by field inheritance. Like described in #213568 (closed) (Option E)

Strategy

  1. Find a way to query a project service with all its ancestors to get all available settings.
  2. Find a way to merge those settings to have a valid set of inherited and overwritten settings.
  3. Boolean values are also settings, and they are used in queries like project.services.push_hooks. We need to find a way to implement the inheritance also for those settings.

Results

  1. This query can be used to get all services with ancestors.
  2. We can merge settings in ruby. This way it is also possible to use the properties field
  3. If the boolean field allows NULL we can implement the inheritance in the merging loop. To query for those fields like project.services.push_hooks, we can't use the scope anymore and need to implement a method that finds the right services on the application level

Next steps

We can try implementing this solution for a simple service that is using properties and don't have many hook options Good candidates are:

  • AsanaService
  • AssemblaService
  • CampfireService
  • EmailsOnPushService
  • ExternalWikiService
  • FlowdockService
  • PivotaltrackerService
Edited by Andy Schoenen

Merge request reports

Loading