Skip to content

[Code chat] constrain rollout for gitlab-org/gitlab only

Context

Currently, the ActiveContext Code processes allows per-namespace rollout by specifying NAMESPACE_IDS in the SaasInitialIndexingEventWorker.

We need to support rollout specific to the gitlab-org/gitlab project so that we can do initial indexing on staging/production. This would make it easier to monitor the initial rollout.

References

Proposal

In ProcessPendingEnabledNamespaceEventWorker, update the eligible_projects method so that it filters only for the gitlab-org/gitlab project. This should be toggled behind a Feature Flag.

Option 1

FF specific to gitlab-org/gitlab: index_only_gitlab_org_gitlab

def eligible_projects(projects, existing_project_ids, enabled_namespace)
  records = []

  if Feature.enabled?(:index_only_gitlab_org_gitlab, :instance)
    records << {
      project_id: 278964, # https://gitlab.com/gitlab-org/gitlab
      enabled_namespace_id: enabled_namespace.id,
      connection_id: connection.id
    }
  else
    projects.each do |project|
      next if existing_project_ids.include?(project.id)
      next unless project.project_setting.duo_features_enabled

      records << {
        project_id: project.id,
        enabled_namespace_id: enabled_namespace.id,
        connection_id: connection.id
      }
    end
  end

  records
end

Option 2

FF for any project:

def eligible_projects(projects, existing_project_ids, enabled_namespace)
  records = []

  projects.each do |project|
    next if Feature.disabled?(:active_context_code_index_project, project)
    next if existing_project_ids.include?(project.id)
    next unless project.project_setting.duo_features_enabled

    records << {
      project_id: project.id,
      enabled_namespace_id: enabled_namespace.id,
      connection_id: connection.id
    }
  end

  records
end
Edited by Pam Artiaga