Skip to content

Add adapter to generate old service configuration

What does this MR do and why?

Implements AvailableServicesGenerator that would generate the old legacy services yml file (cloud_connector.yml or access_data.yml) based on provided gitlab_realm (self-managed or gitlab-com)

Gitlab::CloudConnector::AvailableServicesGenerator.new.generate('self-managed').to_yaml # generates cloud_connector.yml

Gitlab::CloudConnector::AvailableServicesGenerator.new.generate('gitlab-com').to_yaml # generates access_data.yml

It introduces config/services that contains service-unit_primitives mappings.

---
name: duo_chat
basic_unit_primitive: duo_chat
gitlab_realm:
  - gitlab-com
  - self-managed
unit_primitives:
  - ask_build
  - ask_commit
  - ask_epic
  - ask_issue
  - ask_merge_request
  - documentation_search
  - duo_chat
  - explain_code
  - fix_code
  - include_dependency_context
  - include_file_context
  - include_issue_context
  - include_merge_request_context
  - include_snippet_context
  - refactor_code
  - write_tests

The generator will interpret these mappings and create suitable legacy available_services. For standalone services, it will generate an individual service for each unit primitive, excluding those listed in the IGNORE_UNIT_PRIMITIVES list or already defined as services.

How to test locally

  1. go to cd src/ruby
  2. make build
  3. gem install gitlab-cloud-connector-0.2.1.gem
  4. irb
  5. require 'cloud_connector'
  6. puts Gitlab::CloudConnector::AvailableServicesGenerator.new.generate('gitlab-com').to_yaml

The result:

Click to expand
---
services:                                                                                                             
  anthropic_proxy:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - categorize_duo_chat_question
        - generate_commit_message
        - generate_issue_description
        - glab_ask_git_command
        - resolve_vulnerability
        - review_merge_request
        - summarize_issue_discussions
        - summarize_review
  code_suggestions:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-02-15 00:00:00 UTC
    min_gitlab_version: '16.8'
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - complete_code
        - generate_code
      duo_pro:
        unit_primitives:
        - complete_code
        - generate_code
  duo_chat:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    min_gitlab_version: '16.9'
    min_gitlab_version_for_free_access: '16.8'
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - ask_build
        - ask_commit
        - ask_epic
        - ask_issue
        - ask_merge_request
        - documentation_search
        - duo_chat
        - explain_code
        - fix_code
        - include_dependency_context
        - include_file_context
        - include_issue_context
        - include_merge_request_context
        - include_snippet_context
        - refactor_code
        - write_tests
      duo_pro:
        unit_primitives:
        - documentation_search
        - duo_chat
        - explain_code
        - fix_code
        - include_file_context
        - include_snippet_context
        - refactor_code
        - write_tests
  duo_workflow:
    backend: gitlab-duo-workflow-service
    bundled_with:
      _irrelevant:
        unit_primitives:
        - duo_workflow_execute_workflow
        - duo_workflow_generate_token
  explain_vulnerability:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - explain_vulnerability
  generate_commit_message:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - generate_commit_message
  generate_description:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - generate_issue_description
  glab_ask_git_command:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    min_gitlab_version: '17.2'
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - glab_ask_git_command
  include_dependency_context:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - include_dependency_context
  include_file_context:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - include_file_context
      duo_pro:
        unit_primitives:
        - include_file_context
  include_issue_context:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - include_issue_context
  include_merge_request_context:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - include_merge_request_context
  include_snippet_context:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - include_snippet_context
      duo_pro:
        unit_primitives:
        - include_snippet_context
  observability_all:
    backend: gitlab-observability-backend
    bundled_with:
      _irrelevant:
        unit_primitives:
        - observability_all
  resolve_vulnerability:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - resolve_vulnerability
  sast:
    backend: gitlab-security-gateway
    bundled_with:
      _irrelevant:
        unit_primitives:
        - security_scans
  self_hosted_models:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - ask_build
        - ask_commit
        - ask_epic
        - ask_issue
        - ask_merge_request
        - complete_code
        - documentation_search
        - duo_chat
        - explain_code
        - fix_code
        - generate_code
        - include_dependency_context
        - include_file_context
        - include_issue_context
        - include_merge_request_context
        - include_snippet_context
        - refactor_code
        - write_tests
  summarize_comments:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - summarize_comments
  summarize_review:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - summarize_review
  troubleshoot_job:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - troubleshoot_job
  vertex_ai_proxy:
    backend: gitlab-ai-gateway
    cut_off_date: 2024-10-17 00:00:00 UTC
    bundled_with:
      duo_enterprise:
        unit_primitives:
        - generate_commit_message
        - generate_cube_query
        - glab_ask_git_command
        - semantic_search_issue
        - summarize_issue_discussions
        - summarize_merge_request
Edited by Nikola Milojevic

Merge request reports

Loading