Class: Gitlab::QA::Component::AiGateway
- Defined in:
- lib/gitlab/qa/component/ai_gateway.rb
Constant Summary collapse
- DOCKER_IMAGE =
'registry.gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/model-gateway'
- DOCKER_IMAGE_TAG =
'latest'
- LOG_FILE_NAME =
'modelgateway_debug.log'
- TEST_SIGNING_KEY =
Test signing key to enable direct connection code completions gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/blob/97f54f4b7e43258a39bba7f29f38fe44bd316ce5/example.env#L79
<<~SIGNING_KEY -----BEGIN PRIVATE KEY----- MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQD35X6SQq7VuIV8 jRNta9yfQJzVLqfYOFwSqismmvR1/2y/pO7HWsXo1HhkQdzF7U1zJLh8b0PiSkDE dpUzkt5b4mPIit7khx7/wMi+t+gi1dpP+gTXxqOB8A/UzvQxBEKhizoGw/hG7vzT MYqJRO1xHCYsMNU2TfWuoGR/7RXIidXzXmEShZ6bFeEWqupV7D0X6n8WVMd+NrZZ lCNP0O67kCZGpABHcQ/uDUcRhyHYFkGHoSwp7KS2416PXMiRs01VRUG7fnOkgo4C zyPWfuzSMjkKPm9gr9P0qYGsNrOBmV0guyLg4JWcVhDvkuh32r/kHrwxwUDYSLyI GfAKKmZDAgMBAAECggEAKLfCEdVw0PCywayNKQdIgRf51W0JFhOGfBewvXHs/ty/ nhLsmEN+sn8DxLlUwWX4YhYBVN8UcBJGOn7yhDrML0eA9asUcBu0VHSer0TslPGP dFzazXPL3kdHh8BJN9aSozoyg8ijT/NoBRXkGCasNvdVWyOCQfM4NutoK+MOFZbL krtGPWfjTPByaZnV1PDJq95wz6LQeSdNwZLABE4YIrBxg0V1zu1gb0paltHZjPaM 68rm6Hp78CqI/5v9/RqQaso8aYVdjBaEkEI40CgKZY8Jm04NE4EcQM4Z4IYFc8I/ Ewj0giQIkZrGuucOA9S8TNqDjerv+8NoLMRCRcTk8QKBgQD9nHZGdW+2+IjShTal EzjHH37APQKXYi0R9IESdzRnkUrL/8Rnxe5f7VxmDXJys0+IGo+8JoqGRUWJD8WZ oBNW8oqJ4OH/dH07v2W0a0L0Z0Fcq6lv6tFcq1inSLPlk6EW3h4vTlrknuQ6QaKq 74SksBB4dCGDLlOaL8jldg9YVwKBgQD6O0CciiL3xVdnx4cGHDEjs9UU10z0EeVs 0gNxdAdkQEdgj9wI1yzNywFXtI+UA26j7207vYcU0hQ029roJN5ogTOkcCuf9WPQ RV/+BQhiEJGYmZF8KlWiCB1HTxvc3p04EmIsp1N6yuqoE0jUFIS3A4GYYHPDZwDa G8Y+W68d9QKBgQC7aFxqcqusDPqmfrRDxfGGC7sRecQpc+4UP5cFuzrpcY9RMl7D xJsDHhbSfwtcwS57SA2BHwXsdNIOl64QeR7xeGdxvdGjgURt22DfsweWLZs6TMv3 nRE7Jo9rhqkRdEds65RopsE6AkRq3EfFgxuEy2pQaJi/JIO5A6i0D8sFHwKBgQCI rtDuMO5E1QCXaX+xsLiOve5IggpAz324YUcMM8rN0earMimIkrCggKDtHW3H9c/7 sA7EsRQWJWJwNR9v6qOqBdkFm1fY+htZamuyv2EC3/YHmurDHgTEixYjG20mylqq hDAoIAYTbr+aq13+qm6L4VhquVTCiYMHoGA7M62F+QKBgQCfTv5XVu+bEEBKyTkf oVWjaLbO99zrgRYmZ9zhiRtlYFKefQ4kKxr+SRcia2dxQiNVPh5qUkX6ukvgCEVl GoFTlopsX/CbilNarkwa/nvgQQeZAlrFpONifrtfZffV2Cs6wcwYAL8W5qFtl6iy ZpLGJZdEWAPTxB6ppnDC75/KOg== -----END PRIVATE KEY----- SIGNING_KEY
- TEST_VALIDATION_KEY =
Test validation key to enable direct connection code completions gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist/-/blob/97f54f4b7e43258a39bba7f29f38fe44bd316ce5/example.env#L79
<<~VALIDATION_KEY -----BEGIN PRIVATE KEY----- MIIEvQIBADANBgkqhkiG9w0BA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ID x9o38/pKjwKBgH1YQRQ11IpiSCnMyDpKAi7Nrnb35OaK8k+d28hBMfzZaWE1XP1e UFy34cBWjYpqnEdwlcqVC6YAcKrvsNUq9wrL4R0svwHwD7R2LoQT2VjhA/VmNgMC f2U1I+GDlENx9kNtBQzK0Khf36BHNxn5YhV06ndQxS4DlNQ4obMJ/40DAoGBAIWm DfaZ6HRzNAOpFJ5IoGYmCZXOR36PAvdo8z3ndRr2FjagRvonJjrx7fe7TgEA6jPn yAg85O5ubbZSJJr2hZF8QHW65hFyH+KDeQoqRBXKK4+CVV2z92QEnqFIUsCgGHuv XzMC9/8/DXLUs99brSSj2ZT0/SVxbC6ovennnssxAoGALtm2AUBMgsU6b9B+Fp2L ZBQSwkyd3bOD7sFJHhbmiRE/ag2lsaE+dNg9H42fhOV0MXfPkEBWCIaGt931T5+q FVATlTTDAx2CRmJCOyXkQ6mGBFTkQPqDwmWvwjbK9B5r0SnGfCpk4uEYWoYYsX05 t14Huwf9VVUTCfEi0+wWcko= -----END PRIVATE KEY----- VALIDATION_KEY
Constants inherited from Base
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
- #configure_environment(gitlab_hostname:) ⇒ Object
- #container_log_path ⇒ Object
- #host_log_path ⇒ Object
-
#initialize ⇒ AiGateway
constructor
A new instance of AiGateway.
- #name ⇒ Object
- #teardown ⇒ Object
Methods inherited from Base
#add_network_alias, #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
Constructor Details
#initialize ⇒ AiGateway
Returns a new instance of AiGateway.
80 81 82 83 84 85 86 |
# File 'lib/gitlab/qa/component/ai_gateway.rb', line 80 def initialize super # These keys are test keys and are safe to be shared, but masking them in logs so they do not raise concern @secrets << TEST_SIGNING_KEY @secrets << TEST_VALIDATION_KEY end |
Instance Method Details
#configure_environment(gitlab_hostname:) ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/gitlab/qa/component/ai_gateway.rb', line 100 def configure_environment(gitlab_hostname:) @environment = { 'AIGW_GITLAB_URL' => "http://#{gitlab_hostname}", 'AIGW_GITLAB_API_URL' => "http://#{gitlab_hostname}/api/v4", 'AIGW_CUSTOMER_PORTAL_URL' => Runtime::Env.customer_portal_url, 'AIGW_MOCK_MODEL_RESPONSES' => true, 'AIGW_LOGGING__LEVEL' => 'debug', 'AIGW_LOGGING__TO_FILE' => LOG_FILE_NAME, 'AIGW_SELF_SIGNED_JWT__SIGNING_KEY' => TEST_SIGNING_KEY, 'AIGW_SELF_SIGNED_JWT__VALIDATION_KEY' => TEST_VALIDATION_KEY, 'CLOUD_CONNECTOR_SERVICE_NAME' => 'gitlab-ai-gateway' } end |
#container_log_path ⇒ Object
96 97 98 |
# File 'lib/gitlab/qa/component/ai_gateway.rb', line 96 def container_log_path File.join('home', 'aigateway', 'app', LOG_FILE_NAME) end |
#host_log_path ⇒ Object
92 93 94 |
# File 'lib/gitlab/qa/component/ai_gateway.rb', line 92 def host_log_path File.join(Runtime::Env.host_artifacts_dir, name, 'logs', LOG_FILE_NAME) end |
#name ⇒ Object
88 89 90 |
# File 'lib/gitlab/qa/component/ai_gateway.rb', line 88 def name @name ||= 'ai-gateway' end |
#teardown ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/gitlab/qa/component/ai_gateway.rb', line 114 def teardown # Copy debug log file to host artifacts directory begin Docker::Command.execute( "cp #{name}:#{container_log_path} #{host_log_path}" ) rescue Support::ShellCommand::StatusError => e Runtime::Logger.warn( "Unable to copy log file from #{name}: #{e.}" ) end super end |