prefapp / firestarter-workflows

Repository with all firestarter workflows
0 stars 0 forks source link

[`state-repo`] Fix concurrency problems when more than one service is updated for the same `tenant/app/env` #160

Closed juanjosevazquezgil closed 1 month ago

juanjosevazquezgil commented 1 month ago

Motivation

Currently, when dealing with multiple services for the same tenant/app/env, the workflow state-repo-helm-apps is called once for each service that's been updated. This causes a concurrecy problem, where the new workflows calls are made before the previous has been completed and that causes them to exit with an error

Possible solutions

  1. Disable automerging for tenant/app/env with multiple services: the easiest, but also the most error prone. The user would have to manually merge each PR after the previous state-repo-helm-apps workflow call has finished. Not what we want to do, and written here only for posterity.
  2. Enable concurrency for state-repo-helm-apps: possible temporal solution similar to the previous one, but fully automated. Could work but not ideal.
  3. Update the action so it uses the tenant/app/env data we input to launch only once and update all services at the same time in the same PR: the ideal solution, would fix the problem while introducing little to no side effects. Could be a hard to make change and warrant a v5 release

Acceptance criteria

juanjosevazquezgil commented 1 month ago

We have decided to go with option 3. We have also come to the following conclusions:

  1. The input of the action action-state-repo-update-image must change from service_name (string) to service_name_list (list of strings). This is a breaking change and means action-state-repo-update-image's version must be bumped to the next major.
  2. As a direct consequence of (1), the action action-make-state-repo-dispatches also has to be updated and bumped to the next major, because it will now send a list of service_name instead of a single one.
  3. Since action-state-repo-update-image is called from the various state-type repos, all code repos, regardless of if they were affected or not by this bug, must be updated to the new action-make-state-repo-dispatches version.

Also, we need to test what happens when two different flavors would modify the same tenant/app/env/images.yaml.