Skip to content
代码片段 群组 项目
未验证 提交 02ede60d 编辑于 作者: Roy Zwambag's avatar Roy Zwambag 提交者: GitLab
浏览文件

Merge branch '17405-remove-ff' into 'master'

Remove use_cloud_connector_lb feature flag

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/142564



Merged-by: default avatarRoy Zwambag <rzwambag@gitlab.com>
Approved-by: default avatarRoy Zwambag <rzwambag@gitlab.com>
Co-authored-by: default avatarMatthias Kaeppler <mkaeppler@gitlab.com>
No related branches found
No related tags found
无相关合并请求
---
name: use_cloud_connector_lb
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/139265
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/435142
milestone: '16.8'
type: experiment
group: group::cloud connector
default_enabled: false
...@@ -218,8 +218,8 @@ Therefore, a different setup is required from the [SaaS-only AI features](#test- ...@@ -218,8 +218,8 @@ Therefore, a different setup is required from the [SaaS-only AI features](#test-
1. Export these environment variables in the same terminal session with `gdk start`: 1. Export these environment variables in the same terminal session with `gdk start`:
```shell ```shell
export CODE_SUGGESTIONS_BASE_URL=http://0.0.0.0:5052 # URL to the local AI Gateway instance export AI_GATEWAY_URL=http://0.0.0.0:5052 # URL to the local AI Gateway instance
export LLM_DEBUG=1 # Enable debug logging export LLM_DEBUG=1 # Enable debug logging
``` ```
Alternatively, you can create an `env.runit` file in the root of your GDK with the above snippet. Alternatively, you can create an `env.runit` file in the root of your GDK with the above snippet.
......
...@@ -28,7 +28,7 @@ This should enable everyone to see locally any change in an IDE being sent to th ...@@ -28,7 +28,7 @@ This should enable everyone to see locally any change in an IDE being sent to th
1. In your terminal, navigate to a `gitlab` inside your `gitlab-development-kit` directory 1. In your terminal, navigate to a `gitlab` inside your `gitlab-development-kit` directory
1. Run `bundle exec rails c` to start a Rails console 1. Run `bundle exec rails c` to start a Rails console
1. Call `Feature.enable(:code_suggestions_tokens_api)` from the console 1. Call `Feature.enable(:code_suggestions_tokens_api)` from the console
1. Run the GDK with ```export CODE_SUGGESTIONS_BASE_URL=http://localhost:5052``` 1. Run the GDK with ```export AI_GATEWAY_URL=http://localhost:5052```
1. [Setup AI Gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#how-to-run-the-server-locally) 1. [Setup AI Gateway](https://gitlab.com/gitlab-org/modelops/applied-ml/code-suggestions/ai-assist#how-to-run-the-server-locally)
1. Build tree sitter libraries ```poetry run scripts/build-tree-sitter-lib.py``` 1. Build tree sitter libraries ```poetry run scripts/build-tree-sitter-lib.py```
1. Extra .env changes for all debugging insights 1. Extra .env changes for all debugging insights
...@@ -48,7 +48,7 @@ with the deployed staging AI Gateway. To do this: ...@@ -48,7 +48,7 @@ with the deployed staging AI Gateway. To do this:
```shell ```shell
export GITLAB_LICENSE_MODE=test export GITLAB_LICENSE_MODE=test
export CUSTOMER_PORTAL_URL=https://customers.staging.gitlab.com export CUSTOMER_PORTAL_URL=https://customers.staging.gitlab.com
export CODE_SUGGESTIONS_BASE_URL=https://codesuggestions.staging.gitlab.com export AI_GATEWAY_URL=https://cloud.staging.gitlab.com/ai
``` ```
1. Restart the GDK. 1. Restart the GDK.
......
...@@ -41,7 +41,7 @@ If the settings are enabled, but Code Suggestions are still not displayed, try t ...@@ -41,7 +41,7 @@ If the settings are enabled, but Code Suggestions are still not displayed, try t
```shell ```shell
2023-07-14T17:29:00:763 [debug]: Disabling code completion 2023-07-14T17:29:00:763 [debug]: Disabling code completion
2023-07-14T17:29:01:802 [debug]: Enabling code completion 2023-07-14T17:29:01:802 [debug]: Enabling code completion
2023-07-14T17:29:01:802 [debug]: AI Assist: Using server: https://codesuggestions.gitlab.com/v2/completions 2023-07-14T17:29:01:802 [debug]: AI Assist: Using server: https://cloud.gitlab.com/ai/v2/code/completions
``` ```
### Code Suggestions not displayed in Microsoft Visual Studio ### Code Suggestions not displayed in Microsoft Visual Studio
......
...@@ -2,19 +2,8 @@ ...@@ -2,19 +2,8 @@
module Gitlab module Gitlab
module AiGateway module AiGateway
# Going forward, we should route this through cloud.gitlab.com.
LEGACY_URL = 'https://codesuggestions.gitlab.com'
private_constant :LEGACY_URL
def self.url def self.url
if Feature.enabled?('use_cloud_connector_lb', type: :experiment) ENV['AI_GATEWAY_URL'] || "#{::CloudConnector::Config.base_url}/ai"
ENV['AI_GATEWAY_URL'] || "#{::CloudConnector::Config.base_url}/ai"
else
# TODO: Rename to `AI_GATEWAY_URL`
# See https://gitlab.com/gitlab-org/gitlab/-/issues/434671
#
ENV['CODE_SUGGESTIONS_BASE_URL'] || LEGACY_URL
end
end end
end end
end end
...@@ -6,28 +6,6 @@ ...@@ -6,28 +6,6 @@
subject { described_class.new } subject { described_class.new }
describe '.base_url' do describe '.base_url' do
context 'when use_cloud_connector_lb is disabled' do
before do
stub_feature_flags(use_cloud_connector_lb: false)
end
context 'without CODE_SUGGESTIONS_BASE_URL env var' do
it 'returns correct URL' do
expect(described_class.base_url).to eql('https://codesuggestions.gitlab.com')
end
end
context 'with CODE_SUGGESTIONS_BASE_URL env var' do
before do
stub_env('CODE_SUGGESTIONS_BASE_URL', 'http://test.local')
end
it 'returns correct URL' do
expect(described_class.base_url).to eql('http://test.local')
end
end
end
it 'returns correct URL' do it 'returns correct URL' do
expect(described_class.base_url).to eql('https://cloud.gitlab.com/ai') expect(described_class.base_url).to eql('https://cloud.gitlab.com/ai')
end end
......
...@@ -321,42 +321,6 @@ def request ...@@ -321,42 +321,6 @@ def request
) )
end end
context 'when use_cloud_connector_lb ff is disabled' do
before do
stub_feature_flags(use_cloud_connector_lb: false)
end
context 'when service base URL is not set' do
before do
stub_env('CODE_SUGGESTIONS_BASE_URL', nil)
end
it 'sends requests to this URL instead' do
post_api
_, params = workhorse_send_data
expect(params).to include({
'URL' => 'https://codesuggestions.gitlab.com/v2/code/completions'
})
end
end
context 'when overriding service base URL' do
before do
stub_env('CODE_SUGGESTIONS_BASE_URL', 'http://test.com')
end
it 'sends requests to this URL instead' do
post_api
_, params = workhorse_send_data
expect(params).to include({
'URL' => 'http://test.com/v2/code/completions'
})
end
end
end
context 'with telemetry headers' do context 'with telemetry headers' do
let(:headers) do let(:headers) do
{ {
...@@ -604,34 +568,6 @@ def get_user(session): ...@@ -604,34 +568,6 @@ def get_user(session):
post_api post_api
end end
context 'when use_cloud_connector_lb is disabled' do
before do
stub_feature_flags(use_cloud_connector_lb: false)
end
it 'sends requests to the code generation endpoint' do
expected_body = body.merge(
model_provider: 'anthropic',
prompt_version: 2,
prompt: prompt,
current_file: {
file_name: file_name,
content_above_cursor: prefix,
content_below_cursor: ''
},
model_name: 'claude-2.1'
)
expect(Gitlab::Workhorse)
.to receive(:send_url)
.with(
'https://codesuggestions.gitlab.com/v2/code/generations',
hash_including(body: expected_body.to_json)
)
post_api
end
end
it 'includes additional headers for SaaS' do it 'includes additional headers for SaaS' do
add_on_purchase.namespace.namespace_settings.update_attribute(:code_suggestions, true) add_on_purchase.namespace.namespace_settings.update_attribute(:code_suggestions, true)
...@@ -791,35 +727,6 @@ def get_user(session): ...@@ -791,35 +727,6 @@ def get_user(session):
post_api post_api
end end
context 'when use_cloud_connector_lb is disabled' do
before do
stub_feature_flags(use_cloud_connector_lb: false)
end
it 'sends requests to the code generation endpoint' do
expected_body = body.merge(
model_provider: 'anthropic',
prompt_version: 2,
prompt: prompt,
current_file: {
file_name: file_name,
content_above_cursor: prefix,
content_below_cursor: ''
},
model_name: 'claude-2.1'
)
expect(Gitlab::Workhorse)
.to receive(:send_url)
.with(
'https://codesuggestions.gitlab.com/v2/code/generations',
hash_including(body: expected_body.to_json)
)
post_api
end
end
context 'when body is too big' do context 'when body is too big' do
before do before do
stub_const("#{described_class}::MAX_BODY_SIZE", 10) stub_const("#{described_class}::MAX_BODY_SIZE", 10)
......
...@@ -70,16 +70,6 @@ ...@@ -70,16 +70,6 @@
end end
end end
context 'when use_cloud_connector_lb is disabled' do
let(:endpoint) { 'https://codesuggestions.gitlab.com/v1/x-ray/libraries' }
before do
stub_feature_flags(use_cloud_connector_lb: false)
end
include_examples 'sends request to the XRay libraries'
end
include_examples 'sends request to the XRay libraries' include_examples 'sends request to the XRay libraries'
end end
......
...@@ -4,25 +4,11 @@ ...@@ -4,25 +4,11 @@
let(:base_url) { 'https://cloud.gitlab.com/ai' } let(:base_url) { 'https://cloud.gitlab.com/ai' }
let(:endpoint) { "#{base_url}/#{endpoint_path}" } let(:endpoint) { "#{base_url}/#{endpoint_path}" }
shared_examples_for 'valid endpoint' do it 'returns valid endpoint' do
it 'returns valid endpoint' do expect(task.endpoint).to eq endpoint
expect(task.endpoint).to eq endpoint
end
it 'returns body' do
expect(Gitlab::Json.parse(task.body)).to eq body
end
end end
include_examples 'valid endpoint' it 'returns body' do
expect(Gitlab::Json.parse(task.body)).to eq body
context 'when use_cloud_connector_lb is disabled' do
let(:base_url) { 'https://codesuggestions.gitlab.com' }
before do
stub_feature_flags(use_cloud_connector_lb: false)
end
include_examples 'valid endpoint'
end end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册