feat(ci get): add --merge-request and --status flags

Summary

Implements #8210 (closed).

  • Adds --merge-request=<iid> (short: none) to glab ci get to target the head pipeline of a specific merge request. Differs from --branch when the MR's head pipeline diverges from the latest pipeline on its source branch (e.g. forks, detached pipelines).
  • Adds --status=<state> (short: -s) to filter jobs by state. The value is passed through to the API's scope parameter, so it tracks whatever states the API accepts (failed, success, canceled, skipped, etc.) without client-side enumeration drift.
  • Extends the job details table (--with-job-details) with Stage and URL columns.
  • Switches error reporting in this command from printing a red ✘ to stdout to returning the error consistently, so it surfaces on stderr like the rest of the CLI.

--merge-request is mutually exclusive with --pipeline-id and --branch.

Example usage

# Show only failed jobs for the head pipeline of MR !42
glab ci get --merge-request=42 --status=failed --with-job-details

# Get the head pipeline for a specific MR
glab ci get --merge-request=42

# Filter jobs by an arbitrary status, with the short flag
glab ci get -s success

Working example

glab ci get -R gitlab-org/modelops/applied-ml/code-suggestions/ai-assist --merge-request 5141 --status failed --with-job-details

Test plan

  • Unit tests added for --merge-request (resolves MR head pipeline by IID)
  • Unit tests added for the --merge-request error paths (no head pipeline, head pipeline with zero ID)
  • Unit tests added for --status filtering (asserts the API scope param is set)
  • Existing --with-job-details test updated for the new Stage / URL columns
  • Documentation regenerated (docs/source/ci/get.md)
  • All pre-push hooks pass (build, tests, lint, docs)
Edited by Eduardo Bonet

Merge request reports

Loading