Skip to content
  • Vladimir Shushlin's avatar
    Fix allow_descendants_override_disabled_shared_runners in database · c798eabe
    Vladimir Shushlin authored and Mehmet Emin INAC's avatar Mehmet Emin INAC committed
    In https://gitlab.com/gitlab-org/gitlab/-/merge_requests/126539
    we introduced the validation on
    allow_descendants_override_disabled_shared_runners
    to always be false if shared runners are enabled.
    
    It's guarded by
    
    ```ruby
    changes.has_key?(:allow_descendants_override_disabled_shared_runners)
    ```
    
    but it can break the creation of new groups
    https://gitlab.com/gitlab-org/gitlab/blob/49d501d4/app/services/groups/create_service.rb#L105-105
    because it can copy invalid configuration from the parent group:
    
    ```ruby
    @group.shared_runners_enabled = @group.parent.shared_runners_enabled
    @group.allow_descendants_override_disabled_shared_runners = @group.parent.allow_descendants_override_disabled_shared_runners
    ```
    
    This MR fixes the invalid combination of
    1. `shared_runners_enabled = TRUE` AND
    2. `allow_descendants_override_disabled_shared_runners = TRUE`
    
    This combination doesn't make sense: we always allow to disable shared runners
    on the descendants.
    
    Changelog: fixed
    c798eabe