| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9c5b8d5 commit c6dd57c
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -236,6 +236,33 @@ Download the artifacts zip archive of a job: | |||
| 236 | 236 | ||
| 237 | 237 | $ gitlab project-job artifacts --id 10 --project-id 1 > artifacts.zip | |
| 238 | 238 | ||
| 239 | + Runners | ||
| 240 | + ------- | ||
| 241 | + | ||
| 242 | + List owned runners: | ||
| 243 | + | ||
| 244 | + .. code-block:: console | ||
| 245 | + | ||
| 246 | + $ gitlab runner list | ||
| 247 | + | ||
| 248 | + List owned runners with a filter: | ||
| 249 | + | ||
| 250 | + .. code-block:: console | ||
| 251 | + | ||
| 252 | + $ gitlab runner list --scope active | ||
| 253 | + | ||
| 254 | + List all runners in the GitLab instance (specific and shared): | ||
| 255 | + | ||
| 256 | + .. code-block:: console | ||
| 257 | + | ||
| 258 | + $ gitlab runner-all list | ||
| 259 | + | ||
| 260 | + Get a runner's details: | ||
| 261 | + | ||
| 262 | + .. code-block:: console | ||
| 263 | + | ||
| 264 | + $ gitlab -v runner get --id 123 | ||
| 265 | + | ||
| 239 | 266 | Other | |
| 240 | 267 | ----- | |
| 241 | 268 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,9 @@ Reference | |||
| 19 | 19 | + :class:`gitlab.v4.objects.Runner` | |
| 20 | 20 | + :class:`gitlab.v4.objects.RunnerManager` | |
| 21 | 21 | + :attr:`gitlab.Gitlab.runners` | |
| 22 | + + :class:`gitlab.v4.objects.RunnerAll` | ||
| 23 | + + :class:`gitlab.v4.objects.RunnerAllManager` | ||
| 24 | + + :attr:`gitlab.Gitlab.runners_all` | ||
| 22 | 25 | ||
| 23 | 26 | * GitLab API: https://docs.gitlab.com/ce/api/runners.html | |
| 24 | 27 | ||
@@ -41,14 +44,20 @@ for this parameter are: | |||
| 41 | 44 | The returned objects hold minimal information about the runners. Use the | |
| 42 | 45 | ``get()`` method to retrieve detail about a runner. | |
| 43 | 46 | ||
| 47 | + Runners returned via ``runners_all.list()`` also cannot be manipulated | ||
| 48 | + directly. You will need to use the ``get()`` method to create an editable | ||
| 49 | + object. | ||
| 50 | + | ||
| 44 | 51 | :: | |
| 45 | 52 | ||
| 46 | 53 | # List owned runners | |
| 47 | 54 | runners = gl.runners.list() | |
| 48 | - # With a filter | ||
| 55 | + | ||
| 56 | + # List owned runners with a filter | ||
| 49 | 57 | runners = gl.runners.list(scope='active') | |
| 50 | - # List all runners, using a filter | ||
| 51 | - runners = gl.runners.all(scope='paused') | ||
| 58 | + | ||
| 59 | + # List all runners in the GitLab instance (specific and shared), using a filter | ||
| 60 | + runners = gl.runners_all.list(scope='paused') | ||
| 52 | 61 | ||
| 53 | 62 | Get a runner's detail:: | |
| 54 | 63 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -164,6 +164,8 @@ def __init__( | |||
| 164 | 164 | """See :class:`~gitlab.v4.objects.RegistryRepositoryManager`""" | |
| 165 | 165 | self.runners = objects.RunnerManager(self) | |
| 166 | 166 | """See :class:`~gitlab.v4.objects.RunnerManager`""" | |
| 167 | + self.runners_all = objects.RunnerAllManager(self) | ||
| 168 | + """See :class:`~gitlab.v4.objects.RunnerManager`""" | ||
| 167 | 169 | self.settings = objects.ApplicationSettingsManager(self) | |
| 168 | 170 | """See :class:`~gitlab.v4.objects.ApplicationSettingsManager`""" | |
| 169 | 171 | self.appearance = objects.ApplicationAppearanceManager(self) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -19,6 +19,8 @@ | |||
| 19 | 19 | "RunnerJobManager", | |
| 20 | 20 | "Runner", | |
| 21 | 21 | "RunnerManager", | |
| 22 | + "RunnerAll", | ||
| 23 | + "RunnerAllManager", | ||
| 22 | 24 | "GroupRunner", | |
| 23 | 25 | "GroupRunnerManager", | |
| 24 | 26 | "ProjectRunner", | |
@@ -39,6 +41,7 @@ class RunnerJobManager(ListMixin, RESTManager): | |||
| 39 | 41 | ||
| 40 | 42 | class Runner(SaveMixin, ObjectDeleteMixin, RESTObject): | |
| 41 | 43 | jobs: RunnerJobManager | |
| 44 | + _repr_attr = "description" | ||
| 42 | 45 | ||
| 43 | 46 | ||
| 44 | 47 | class RunnerManager(CRUDMixin, RESTManager): | |
@@ -68,7 +71,7 @@ class RunnerManager(CRUDMixin, RESTManager): | |||
| 68 | 71 | "maximum_timeout", | |
| 69 | 72 | ), | |
| 70 | 73 | ) | |
| 71 | - _list_filters = ("scope", "tag_list") | ||
| 74 | + _list_filters = ("scope", "type", "status", "paused", "tag_list") | ||
| 72 | 75 | _types = {"tag_list": types.CommaSeparatedListAttribute} | |
| 73 | 76 | ||
| 74 | 77 | @cli.register_custom_action("RunnerManager", (), ("scope",)) | |
@@ -121,6 +124,17 @@ def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Runner: | |||
| 121 | 124 | return cast(Runner, super().get(id=id, lazy=lazy, **kwargs)) | |
| 122 | 125 | ||
| 123 | 126 | ||
| 127 | + class RunnerAll(RESTObject): | ||
| 128 | + _repr_attr = "description" | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + class RunnerAllManager(ListMixin, RESTManager): | ||
| 132 | + _path = "/runners/all" | ||
| 133 | + _obj_cls = RunnerAll | ||
| 134 | + _list_filters = ("scope", "type", "status", "paused", "tag_list") | ||
| 135 | + _types = {"tag_list": types.CommaSeparatedListAttribute} | ||
| 136 | + | ||
| 137 | + | ||
| 124 | 138 | class GroupRunner(RESTObject): | |
| 125 | 139 | pass | |
| 126 | 140 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ | |||
| 4 | 4 | import responses | |
| 5 | 5 | ||
| 6 | 6 | import gitlab | |
| 7 | + from gitlab.v4.objects.runners import Runner, RunnerAll | ||
| 7 | 8 | ||
| 8 | 9 | runner_detail = { | |
| 9 | 10 | "active": True, | |
@@ -233,8 +234,18 @@ def test_group_runners_list(gl: gitlab.Gitlab, resp_get_runners_list): | |||
| 233 | 234 | assert len(runners) == 1 | |
| 234 | 235 | ||
| 235 | 236 | ||
| 236 | - def test_all_runners_list(gl: gitlab.Gitlab, resp_get_runners_list): | ||
| 237 | + def test_runners_all(gl: gitlab.Gitlab, resp_get_runners_list): | ||
| 237 | 238 | runners = gl.runners.all() | |
| 239 | + assert isinstance(runners[0], Runner) | ||
| 240 | + assert runners[0].active is True | ||
| 241 | + assert runners[0].id == 6 | ||
| 242 | + assert runners[0].name == "test-name" | ||
| 243 | + assert len(runners) == 1 | ||
| 244 | + | ||
| 245 | + | ||
| 246 | + def test_runners_all_list(gl: gitlab.Gitlab, resp_get_runners_list): | ||
| 247 | + runners = gl.runners_all.list() | ||
| 248 | + assert isinstance(runners[0], RunnerAll) | ||
| 238 | 249 | assert runners[0].active is True | |
| 239 | 250 | assert runners[0].id == 6 | |
| 240 | 251 | assert runners[0].name == "test-name" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments