Ensure that ci_runner_versions is populated when new cell is created

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

TL;DR: The ci_runner_versions table caches the upgrade recommendation for each of the known runner versions present in the ci_runner_machines table. If a cell is created, or an org is moved to a new cell, we should ensure that all versions that are new to that cell are processed and added to ci_runner_versions.

The following discussion from !155731 (merged) should be addressed:

  • @tkuah started a discussion: (+5 comments)

    Important note: Whenever we move an organization to a different cell, we should call Ci::Runners::ProcessRunnerVersionUpdateWorker with the versions of the moved runners, so that ci_runner_versions in the target cell is ensured to be populated with the necessary versions (I'll create a

    Assuming we move a ci_runners for an organization to another cell. But we have not run Ci::Runners::ProcessRunnerVersionUpdateWorker.

    1. What happens to the application ? Does it break completely, can it recover gracefully ?

Proposals

  1. If we have code that runs on cell creation, we could run the following code at that point:

    Ci::RunnerManager.distinct.where.not(version: nil).pluck(:version).each do |version|
      Ci::Runners::ProcessRunnerVersionUpdateWorker.perform_async(version)
    end
  2. Otherwise, we could create a cronjob that runs daily for self-healing purposes, executing the code above.

Edited by 🤖 GitLab Bot 🤖