Adds CI info to CandidateDetails view model
What does this MR do and why?
First step to show CI info in Ml::CandidateController#show is to add it to the view model that is passed to vue. This MR contains only the backend changes related to it. It adds the following items to the view model:
- ci_job.path: path to the ci_build
- ci_job.name: name of the job
- ci_job.user.username: username of the user that triggered the pipeline
- ci_job.user.path: path to the user that triggered the pipeline
- ci_job.merge_request.path: path to the MR, in case the pipeline belongs to an MR
- ci_job.merge_request.title: title of the MR, in case the pipeline belongs to an MR
Since the view model is getting too large, view model creation is extracted into its own Presenter
How to set up and validate locally
-
Enable the feature flag
echo "Feature.enable(:ml_experiment_tracking)" | bundle exec rails c
-
Create an experiment and a candidate
user_id = 1 # if you are using root project_id = 1 # not necessarily 1, but the project you are using for testing. On a pristine gdk installation, project 1 is usually `toolbox/gitlab-smoke-tests` exp = Ml::Experiment.create!(name: 'Gitlab Experiment', user_id: user_id, project_id: project_id) c = exp.candidates.create!(user_id: user_id, start_time: 0, internal_id: 1, project_id: project_id)
-
Navigate to the candidate "/path_to_project/-/ml/candidates/1". Verify that page loads correctly.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #406784 (closed)
Edited by Eduardo Bonet