Adds CI information to candidate detail
What does this MR do and why?
If a candidate is associated to a ci_build, render some information about that CI on the detail page: the job, the MR (in case the job belongs to an MR pipeline), and the user that triggered the job (if it exists)
Screenshots or screen recordings
How to set up and validate locally
Set up is a bit cumbersome, as you will need to create a Merge request to have the pipeline (or use one that you already created)
-
Enable the feature flag
echo "Feature.enable(:ml_experiment_tracking)" | bundle exec rails c
-
Create a Merge request on a project
-
Create an experiment and a candidate (in rails console)
user_id = 1 # if you are using root project_id = 1 # not necessarily 1, but the project you created the merge request on 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 the page loads, but does not show the CI rows.
-
Associate the candidate with a job from the merge request (in rails console)
project_id = 1 # not necessarily 1, but the project you created the merge request on merge_request_id = 1 # or the id of your merge request c = Ml::Candidate.by_project_id_and_iid(project_id, 1) c.ci_build = MergeRequest.by_id(merge_request_id).head_pipeline.builds[0] c.save!
-
Navigate again to the candidate "/path_to_project/-/ml/candidates/1". Now the CI row should be showing
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)