Skip to content

Draft: feat(ci): add --scope and --source flags for list command

Peter Leitzen requested to merge pl-ci-list-scope-source into main

Description

This MR adds the ability to filter "glab ci list" by --scope and --source flags.

Examples

glab ci list --scope running
glab ci list --source schedule

Related Issues

n/a

How has this been tested?

$ glab ci list --scope running -P 10
Showing 10 pipelines on gitlab-org/gitlab (Page 1)

(running)#698196142  refs/merge-requests/104306/merge  (about 5 minutes ago)
(running)#698195365  refs/merge-requests/103757/merge  (about 6 minutes ago)
(running)#698192780  refs/merge-requests/104267/merge  (about 10 minutes ago)
(running)#698191942  master                            (about 12 minutes ago)
(running)#698191434  refs/merge-requests/104311/merge  (about 13 minutes ago)
(running)#698190893  ruby3                             (about 14 minutes ago)
(running)#698189862  refs/merge-requests/104316/merge  (about 15 minutes ago)
(running)#698188197  refs/merge-requests/97248/merge   (about 18 minutes ago)
(running)#698186459  master                            (about 20 minutes ago)
(running)#698182761  refs/merge-requests/104451/merge  (about 23 minutes ago)

$ glab ci list --source schedule -P 10
Showing 10 pipelines on gitlab-org/gitlab (Page 1)

(running)#698190893  ruby3       (about 14 minutes ago)
(success)#698187369  ruby3-sync  (about 20 minutes ago)
(running)#698146053  master      (about 1 hour ago)
(success)#698109188  ruby3       (about 2 hours ago)
(success)#698105297  ruby3-sync  (about 2 hours ago)
(success)#698061621  master      (about 3 hours ago)
(success)#698007690  ruby3       (about 4 hours ago)
(success)#698002850  ruby3-sync  (about 4 hours ago)
(success)#697929017  master      (about 5 hours ago)
(failed)#697878116   ruby3       (about 6 hours ago)

$ glab ci list --source foo
GET https://gitlab.com/api/v4/projects/gitlab-org/gitlab/pipelines: 400 {error: source does not have a valid value}

$ glab ci list --scope foo
GET https://gitlab.com/api/v4/projects/gitlab-org/gitlab/pipelines: 400 {error: scope does not have a valid value}

Screenshots (if appropriate):

Screenshot_from_2022-11-17_22-25-29

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)
Edited by Peter Leitzen

Merge request reports