FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-gitlab/gitlab/v4/objects/runners.py at main · python-gitlab/python-gitlab · GitHub
python-gitlab
python-gitlab
Repository navigation
Code
Issues
16
(16)
Pull requests
15
(15)
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
runners.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
162 lines (132 loc) · 4.69 KB
Breadcrumbs
python-gitlab
/
gitlab
/
v4
/
objects
/
runners.py
Copy path
File metadata and controls
162 lines (132 loc) · 4.69 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
from
__future__
import
annotations
from
typing
import
Any
from
gitlab
import
cli
from
gitlab
import
exceptions
as
exc
from
gitlab
import
types
from
gitlab
.
base
import
RESTObject
from
gitlab
.
mixins
import
(
CreateMixin
,
CRUDMixin
,
DeleteMixin
,
ListMixin
,
ObjectDeleteMixin
,
SaveMixin
,
)
from
gitlab
.
types
import
RequiredOptional
__all__
=
[
"RunnerJob"
,
"RunnerJobManager"
,
"Runner"
,
"RunnerManager"
,
"RunnerAll"
,
"RunnerAllManager"
,
"GroupRunner"
,
"GroupRunnerManager"
,
"ProjectRunner"
,
"ProjectRunnerManager"
,
]
class
RunnerJob
(
RESTObject
):
pass
class
RunnerJobManager
(
ListMixin
[
RunnerJob
]):
_path
=
"/runners/{runner_id}/jobs"
_obj_cls
=
RunnerJob
_from_parent_attrs
=
{
"runner_id"
:
"id"
}
_list_filters
=
(
"status"
,
"order_by"
,
"sort"
)
class
Runner
(
SaveMixin
,
ObjectDeleteMixin
,
RESTObject
):
jobs
:
RunnerJobManager
_repr_attr
=
"description"
class
RunnerManager
(
CRUDMixin
[
Runner
]):
_path
=
"/runners"
_obj_cls
=
Runner
_create_attrs
=
RequiredOptional
(
required
=
(
"token"
,),
optional
=
(
"description"
,
"info"
,
"active"
,
"locked"
,
"run_untagged"
,
"tag_list"
,
"access_level"
,
"maximum_timeout"
,
),
)
_update_attrs
=
RequiredOptional
(
optional
=
(
"description"
,
"active"
,
"tag_list"
,
"run_untagged"
,
"locked"
,
"access_level"
,
"maximum_timeout"
,
)
)
_list_filters
=
(
"scope"
,
"type"
,
"status"
,
"paused"
,
"tag_list"
)
_types
=
{
"tag_list"
:
types
.
CommaSeparatedListAttribute
}
@
cli
.
register_custom_action
(
cls_names
=
"RunnerManager"
,
optional
=
(
"scope"
,))
@
exc
.
on_http_error
(
exc
.
GitlabListError
)
def
all
(
self
,
scope
:
str
|
None
=
None
,
**
kwargs
:
Any
)
->
list
[
Runner
]:
"""List all the runners.
Args:
scope: The scope of runners to show, one of: specific,
shared, active, paused, online
get_all: If True, return all the items, without pagination
per_page: Number of items to retrieve per request
page: ID of the page to return (starts with page 1)
iterator: If set to True and no pagination option is
defined, return a generator instead of a list
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabListError: If the server failed to perform the request
Returns:
A list of runners matching the scope.
"""
path
=
"/runners/all"
query_data
=
{}
if
scope
is
not
None
:
query_data
[
"scope"
]
=
scope
obj
=
self
.
gitlab
.
http_list
(
path
,
query_data
,
**
kwargs
)
return
[
self
.
_obj_cls
(
self
,
item
)
for
item
in
obj
]
@
cli
.
register_custom_action
(
cls_names
=
"RunnerManager"
,
required
=
(
"token"
,))
@
exc
.
on_http_error
(
exc
.
GitlabVerifyError
)
def
verify
(
self
,
token
:
str
,
**
kwargs
:
Any
)
->
None
:
"""Validates authentication credentials for a registered Runner.
Args:
token: The runner's authentication token
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabVerifyError: If the server failed to verify the token
"""
path
=
"/runners/verify"
post_data
=
{
"token"
:
token
}
self
.
gitlab
.
http_post
(
path
,
post_data
=
post_data
,
**
kwargs
)
class
RunnerAll
(
RESTObject
):
_repr_attr
=
"description"
class
RunnerAllManager
(
ListMixin
[
RunnerAll
]):
_path
=
"/runners/all"
_obj_cls
=
RunnerAll
_list_filters
=
(
"scope"
,
"type"
,
"status"
,
"paused"
,
"tag_list"
)
_types
=
{
"tag_list"
:
types
.
CommaSeparatedListAttribute
}
class
GroupRunner
(
RESTObject
):
pass
class
GroupRunnerManager
(
ListMixin
[
GroupRunner
]):
_path
=
"/groups/{group_id}/runners"
_obj_cls
=
GroupRunner
_from_parent_attrs
=
{
"group_id"
:
"id"
}
_create_attrs
=
RequiredOptional
(
required
=
(
"runner_id"
,))
_list_filters
=
(
"scope"
,
"tag_list"
)
_types
=
{
"tag_list"
:
types
.
CommaSeparatedListAttribute
}
class
ProjectRunner
(
ObjectDeleteMixin
,
RESTObject
):
pass
class
ProjectRunnerManager
(
CreateMixin
[
ProjectRunner
],
DeleteMixin
[
ProjectRunner
],
ListMixin
[
ProjectRunner
]
):
_path
=
"/projects/{project_id}/runners"
_obj_cls
=
ProjectRunner
_from_parent_attrs
=
{
"project_id"
:
"id"
}
_create_attrs
=
RequiredOptional
(
required
=
(
"runner_id"
,))
_list_filters
=
(
"scope"
,
"tag_list"
)
_types
=
{
"tag_list"
:
types
.
CommaSeparatedListAttribute
}
Back
|
FazBrowse Home
|
New Git URL