Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(runners): fix listing for /runners/all#2167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
JohnVillalovos merged 1 commit intomainfromfix/runners-all
Jul 23, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletionsdocs/cli-examples.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -236,6 +236,33 @@ Download the artifacts zip archive of a job:

$ gitlab project-job artifacts --id 10 --project-id 1 > artifacts.zip

Runners
-------

List owned runners:

.. code-block:: console

$ gitlab runner list

List owned runners with a filter:

.. code-block:: console

$ gitlab runner list --scope active

List all runners in the GitLab instance (specific and shared):

.. code-block:: console

$ gitlab runner-all list

Get a runner's details:

.. code-block:: console

$ gitlab -v runner get --id 123

Other
-----

Expand Down
15 changes: 12 additions & 3 deletionsdocs/gl_objects/runners.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,9 @@ Reference
+ :class:`gitlab.v4.objects.Runner`
+ :class:`gitlab.v4.objects.RunnerManager`
+ :attr:`gitlab.Gitlab.runners`
+ :class:`gitlab.v4.objects.RunnerAll`
+ :class:`gitlab.v4.objects.RunnerAllManager`
+ :attr:`gitlab.Gitlab.runners_all`

* GitLab API: https://docs.gitlab.com/ce/api/runners.html

Expand All@@ -41,14 +44,20 @@ for this parameter are:
The returned objects hold minimal information about the runners. Use the
``get()`` method to retrieve detail about a runner.

Runners returned via ``runners_all.list()`` also cannot be manipulated
directly. You will need to use the ``get()`` method to create an editable
object.

::

# List owned runners
runners = gl.runners.list()
# With a filter

# List owned runners with a filter
runners = gl.runners.list(scope='active')
# List all runners, using a filter
runners = gl.runners.all(scope='paused')

# List all runners in the GitLab instance (specific and shared), using a filter
runners = gl.runners_all.list(scope='paused')

Get a runner's detail::

Expand Down
2 changes: 2 additions & 0 deletionsgitlab/client.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -164,6 +164,8 @@ def __init__(
"""See :class:`~gitlab.v4.objects.RegistryRepositoryManager`"""
self.runners = objects.RunnerManager(self)
"""See :class:`~gitlab.v4.objects.RunnerManager`"""
self.runners_all = objects.RunnerAllManager(self)
"""See :class:`~gitlab.v4.objects.RunnerManager`"""
self.settings = objects.ApplicationSettingsManager(self)
"""See :class:`~gitlab.v4.objects.ApplicationSettingsManager`"""
self.appearance = objects.ApplicationAppearanceManager(self)
Expand Down
16 changes: 15 additions & 1 deletiongitlab/v4/objects/runners.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,6 +19,8 @@
"RunnerJobManager",
"Runner",
"RunnerManager",
"RunnerAll",
"RunnerAllManager",
"GroupRunner",
"GroupRunnerManager",
"ProjectRunner",
Expand All@@ -39,6 +41,7 @@ class RunnerJobManager(ListMixin, RESTManager):

class Runner(SaveMixin, ObjectDeleteMixin, RESTObject):
jobs: RunnerJobManager
_repr_attr = "description"


class RunnerManager(CRUDMixin, RESTManager):
Expand DownExpand Up@@ -68,7 +71,7 @@ class RunnerManager(CRUDMixin, RESTManager):
"maximum_timeout",
),
)
_list_filters = ("scope", "tag_list")
_list_filters = ("scope", "type", "status", "paused", "tag_list")
_types = {"tag_list": types.CommaSeparatedListAttribute}

@cli.register_custom_action("RunnerManager", (), ("scope",))
Expand DownExpand Up@@ -121,6 +124,17 @@ def get(self, id: Union[str, int], lazy: bool = False, **kwargs: Any) -> Runner:
return cast(Runner, super().get(id=id, lazy=lazy, **kwargs))


class RunnerAll(RESTObject):
_repr_attr = "description"


class RunnerAllManager(ListMixin, RESTManager):
_path = "/runners/all"
_obj_cls = RunnerAll
_list_filters = ("scope", "type", "status", "paused", "tag_list")
_types = {"tag_list": types.CommaSeparatedListAttribute}


class GroupRunner(RESTObject):
pass

Expand Down
13 changes: 12 additions & 1 deletiontests/unit/objects/test_runners.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,6 +4,7 @@
import responses

import gitlab
from gitlab.v4.objects.runners import Runner, RunnerAll

runner_detail = {
"active": True,
Expand DownExpand Up@@ -233,8 +234,18 @@ def test_group_runners_list(gl: gitlab.Gitlab, resp_get_runners_list):
assert len(runners) == 1


deftest_all_runners_list(gl: gitlab.Gitlab, resp_get_runners_list):
deftest_runners_all(gl: gitlab.Gitlab, resp_get_runners_list):
runners = gl.runners.all()
assert isinstance(runners[0], Runner)
assert runners[0].active is True
assert runners[0].id == 6
assert runners[0].name == "test-name"
assert len(runners) == 1


def test_runners_all_list(gl: gitlab.Gitlab, resp_get_runners_list):
runners = gl.runners_all.list()
assert isinstance(runners[0], RunnerAll)
assert runners[0].active is True
assert runners[0].id == 6
assert runners[0].name == "test-name"
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp