Draft: PoC for XRay in ES
What does this MR do and why?
Prototype for #440822 (closed)
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screen_Recording_2024-02-15_at_11.43.59
How to set up and validate locally
Enable Elasticsearch for your gdk https://gitlab.com/gitlab-org/gitlab-development-kit/-/blob/main/doc/howto/elasticsearch.md?ref_type=heads
Execute migration to create new index via Rails console
Elastic::MigrationWorker.new.perform
Ruby setup of XRay report for project: In rails console
project = Project.find_by_full_path("gitlab-org/mw_test")
build = FactoryBot.create(:ci_build, project: project)
xray_report = Rack::Test::UploadedFile.new(
Rails.root.join('ee/spec/fixtures/repository_xray/gl-repository-xray.json.gz'),
'application/x-gzip',
original_filename: 'go.json'
)
xray_artifact = FactoryBot.create(:ee_ci_job_artifact, file_type: :repository_xray , file_format: :gzip, job: build, file: xray_report)
Ai::StoreRepositoryXrayService.new(build).execute
Trigger code generation via API
curl -X POST -H "Content-Type: Application/json" -H "Authorization: Bearer $GDK_AI_API_TOKEN" http://gdk.test:3000/api/v4/code_suggestions/completions --data '{ "current_file": {
"file_name": "utils.go",
"content_above_cursor": "# generate function that loads env variables from .env file",
"content_below_cursor": ""
},
"project_path": "gitlab-org/mw_test",
"intent": "generation"
}'
Edited by Mikołaj Wawrzyniak