summaryrefslogtreecommitdiff
path: root/docs/gl_objects/runners.rst
blob: 70bd60fc3eac8f908ac8f356d64817bec2af7c28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#######
Runners
#######

Runners are external processes used to run CI jobs. They are deployed by the
administrator and registered to the GitLab instance.

Shared runners are available for all projects. Specific runners are enabled for
a list of projects.

Global runners (admin)
======================

Reference
---------

* v4 API:

  + :class:`gitlab.v4.objects.Runner`
  + :class:`gitlab.v4.objects.RunnerManager`
  + :attr:`gitlab.Gitlab.runners`

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

Examples
--------

Use the ``list()`` and ``all()`` methods to list runners.

Both methods accept a ``scope`` parameter to filter the list. Allowed values
for this parameter are:

* ``active``
* ``paused``
* ``online``
* ``specific`` (``all()`` only)
* ``shared`` (``all()`` only)

.. note::

   The returned objects hold minimal information about the runners. Use the
   ``get()`` method to retrieve detail about a runner.

::

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

Get a runner's detail::

    runner = gl.runners.get(runner_id)

Update a runner::

    runner = gl.runners.get(runner_id)
    runner.tag_list.append('new_tag')
    runner.save()

Remove a runner::

    gl.runners.delete(runner_id)
    # or
    runner.delete()

Project runners
===============

Reference
---------

* v4 API:

  + :class:`gitlab.v4.objects.ProjectRunner`
  + :class:`gitlab.v4.objects.ProjectRunnerManager`
  + :attr:`gitlab.v4.objects.Project.runners`

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

Examples
--------

List the runners for a project::

    runners = project.runners.list()

Enable a specific runner for a project::

    p_runner = project.runners.create({'runner_id': runner.id})

Disable a specific runner for a project::

    project.runners.delete(runner.id)