Skip to content

Add job to /api/v4/job/allowed_agents context

Hordur Freyr Yngvason requested to merge add-job-to-allowed-agents-log into master

What does this MR do and why?

This way, the log fields meta.project and meta.root_namespace get automatically filled with the job's project and root namespace, which is very useful for identifying the source of a request.

See https://gitlab.com/gitlab-org/configure/general/-/issues/286#note_1124050509

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

  1. Create a CI job in your GDK
  2. Grab its token, e.g. CI::Job.last.token
  3. Call /api/v4/job/allowed_agents with the job token (docs)
  4. Find the corresponding log entry in $GDK/gitlab/log/api_json.log (search for allowed_agents). Notice that meta.job_id, meta.pipeline_id, meta.project, root_namespace are all filled now.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Merge request reports