Skip to content

Adds CI information to candidate detail

Eduardo Bonet requested to merge 406784-parse-ci-variables-3 into master

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

image

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)

  1. Enable the feature flag

    echo "Feature.enable(:ml_experiment_tracking)" | bundle exec rails c
  2. Create a Merge request on a project

  3. 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)
  4. Navigate to the candidate "/path_to_project/-/ml/candidates/1". Verify that the page loads, but does not show the CI rows.

  5. 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!
  6. 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.

Related to #406784 (closed)

Edited by Eduardo Bonet

Merge request reports

Loading