Skip to content

Improve validations for Ci::Runner#runner_type

See EE MR https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5672

What does this MR do?

Right now we don't have the right validations to ensure the runner_type is consistent with other attributes so we need to improve this.

It ensures that:

  • project runner has at least one project,
  • group runner has exactly one group,
  • is_shared is consistent with runner_type,
  • project runner does not have groups,
  • group runner does not have projects,
  • runner factory by default defines instance runner, project/group runner has to be explicitly asked.

Are there points in the code the reviewer needs to double check?

Are these validations going to cause any serious performance problems? I think we save a runner every time contacted_at changes and we are loading these relations every time. Seems problematic? Are there other such instances these validations will trigger since we assume that runners are saved infrequently otherwise.

Why was this MR needed?

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

#46010 (closed)

Edited by Kamil Trzciński

Merge request reports