Class: Gitlab::QA::Component::DuoWorkflowService

Inherits:
Base
  • Object
show all
Defined in:
lib/gitlab/qa/component/duo_workflow_service.rb

Overview

Boots the Duo Workflow Service (DWS) gRPC server in agentic-mock mode for Duo Agent Platform foundational-flow E2E tests. DWS ships inside the same model-gateway image as the AI Gateway; we reuse that image and switch the container to the DWS server via ENABLE_DUO_WORKFLOW_SERVICE / DISABLE_AI_GATEWAY (handled by the image's scripts/run.sh).

Constant Summary collapse

DOCKER_IMAGE =

Same artifact as the AI Gateway container, so the agentic mock model and DWS agree.

AiGateway::DOCKER_IMAGE
DOCKER_IMAGE_TAG =
AiGateway::DOCKER_IMAGE_TAG
GRPC_PORT =
50052
LOG_FILE_NAME =
'duo-workflow-service.log'

Constants inherited from Base

Base::CERTIFICATES_PATH

Instance Attribute Summary

Attributes inherited from Base

#additional_hosts, #airgapped_network, #docker, #environment, #logger, #network, #network_aliases, #ports, #runner_network, #secrets, #volumes

Instance Method Summary collapse

Methods inherited from Base

#add_exec_commands, #add_network_alias, #get_reconfigure_log_file_from_artifact, #hostname, #image, #instance, #ip_address, #prepare, #prepare_airgapped_network, #prepare_docker_container, #prepare_docker_image, #prepare_network, #prepare_runner_network, #process_exec_commands, #pull, #restart, #start, #start_instance, #tag, #teardown!

Methods included from Scenario::Actable

#act, included

Constructor Details

#initializeDuoWorkflowService

Returns a new instance of DuoWorkflowService.



20
21
22
23
24
25
# File 'lib/gitlab/qa/component/duo_workflow_service.rb', line 20

def initialize
  super

  @secrets << AiGateway::TEST_SIGNING_KEY
  @secrets << AiGateway::TEST_VALIDATION_KEY
end

Instance Method Details

#configure_environment(gitlab_hostname:) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/gitlab/qa/component/duo_workflow_service.rb', line 31

def configure_environment(gitlab_hostname:)
  @environment = {
    # Switch the shared image from the AIGW FastAPI app to the DWS gRPC server.
    'ENABLE_DUO_WORKFLOW_SERVICE' => true,
    'DISABLE_AI_GATEWAY' => true,
    'PORT' => GRPC_PORT,

    # Agentic mock: select the deterministic in-process mock model. With both flags set,
    # DWS makes no real LLM/AIGW call; the goal's <response>/<tool_calls> directives drive it.
    'AIGW_MOCK_MODEL_RESPONSES' => true,
    'AIGW_USE_AGENTIC_MOCK' => true,

    # Disable DWS auth: with auth ENABLED, DWS prefetches JWKS from GitLab + CustomersDot
    # at startup and hard-fails if unreachable (bad in a sealed CI network). Disabling
    # skips that prefetch and bypasses ExecuteWorkflow token validation.
    'DUO_WORKFLOW_AUTH__ENABLED' => false,

    # ...but Rails still calls the GenerateToken RPC first, which needs the signing key
    # present or the encode fails. So supply the DWS-prefixed self-signed keypair.
    'DUO_WORKFLOW_SELF_SIGNED_JWT__SIGNING_KEY' => AiGateway::TEST_SIGNING_KEY,
    'DUO_WORKFLOW_SELF_SIGNED_JWT__VALIDATION_KEY' => AiGateway::TEST_VALIDATION_KEY,

    # Falls back to AIGW_GITLAB_URL if unset; set both for consistency.
    'DUO_WORKFLOW_AUTH__OIDC_GITLAB_URL' => "http://#{gitlab_hostname}",
    'AIGW_GITLAB_URL' => "http://#{gitlab_hostname}"
  }
end

#nameObject



27
28
29
# File 'lib/gitlab/qa/component/duo_workflow_service.rb', line 27

def name
  @name ||= 'duo-workflow-service'
end

#teardownObject

DWS logs to stdout/stderr and writes no in-container log file (unlike the AI Gateway), so capture docker logs into the host artifacts directory before the container is force-removed on teardown. Without this the DWS logs are lost on removal.



62
63
64
65
66
# File 'lib/gitlab/qa/component/duo_workflow_service.rb', line 62

def teardown
  capture_logs
ensure
  super
end