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

Appearance settings

Commit 31eb913

Browse filesBrowse files
mlqGauvain Pocentek
authored andcommitted
Project pipeline schedules
1 parent 70c779c commit 31eb913
Copy full SHA for 31eb913

File tree

Expand file treeCollapse file tree

2 files changed

+77
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+77
-0
lines changed
Open diff view settings
Collapse file

‎gitlab/v3/objects.py‎

Copy file name to clipboardExpand all lines: gitlab/v3/objects.py
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,18 @@ class ProjectFileManager(BaseManager):
14961496
obj_cls = ProjectFile
14971497

14981498

1499+
class ProjectPipelineSchedule(GitlabObject):
1500+
_url = '/projects/%(project_id)s/pipeline_schedules'
1501+
_create_url = '/projects/%(project_id)s/pipeline_schedules'
1502+
1503+
requiredUrlAttrs = ['project_id']
1504+
requiredCreateAttrs = ['description', 'ref', 'cron']
1505+
1506+
1507+
class ProjectPipelineSchedulesManager(BaseManager):
1508+
obj_cls = ProjectPipelineSchedule
1509+
1510+
14991511
class ProjectPipeline(GitlabObject):
15001512
_url = '/projects/%(project_id)s/pipelines'
15011513
_create_url = '/projects/%(project_id)s/pipeline'
@@ -1803,6 +1815,7 @@ class Project(GitlabObject):
18031815
('notificationsettings', 'ProjectNotificationSettingsManager',
18041816
[('project_id', 'id')]),
18051817
('pipelines', 'ProjectPipelineManager', [('project_id', 'id')]),
1818+
('pipeline_schedules', 'ProjectPipelineSchedulesManager', [('project_id', 'id')]),
18061819
('runners', 'ProjectRunnerManager', [('project_id', 'id')]),
18071820
('services', 'ProjectServiceManager', [('project_id', 'id')]),
18081821
('snippets', 'ProjectSnippetManager', [('project_id', 'id')]),
Collapse file

‎gitlab/v4/objects.py‎

Copy file name to clipboardExpand all lines: gitlab/v4/objects.py
+64Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2012,6 +2012,69 @@ def create(self, data, **kwargs):
20122012
return CreateMixin.create(self, data, path=path, **kwargs)
20132013

20142014

2015+
class ProjectPipelineScheduleVariable(SaveMixin, ObjectDeleteMixin, RESTObject):
2016+
_id_attr = 'key'
2017+
2018+
2019+
class ProjectPipelineScheduleVariableManager(CRUDMixin, RESTManager):
2020+
_path = '/projects/%(project_id)s/pipeline_schedules/%(pipeline_schedule_id)s/variables'
2021+
_obj_cls = ProjectPipelineScheduleVariable
2022+
_from_parent_attrs = {'project_id': 'project_id',
2023+
'pipeline_schedule_id' : 'id'}
2024+
_create_attrs = (('pipeline_schedule_id', 'key', 'value'), tuple())
2025+
_create_attrs = (('key', 'value'), tuple())
2026+
2027+
def list(self):
2028+
array = []
2029+
if 'variables' in self._parent._attrs:
2030+
for variable in self._parent._attrs['variables']:
2031+
schedule_variable = self._obj_cls(self, variable)
2032+
array.append(schedule_variable)
2033+
else:
2034+
obj = self._parent.manager.get(self._parent.id)
2035+
for variable in obj._attrs['variables']:
2036+
schedule_variable = self._obj_cls(self, variable)
2037+
array.append(schedule_variable)
2038+
2039+
return array
2040+
2041+
2042+
class ProjectPipelineSchedule(RESTObject):
2043+
_managers = (
2044+
('variables', 'ProjectPipelineScheduleVariableManager'),
2045+
)
2046+
2047+
2048+
class ProjectPipelineSchedulesManager(RetrieveMixin, CreateMixin, RESTManager):
2049+
_path = '/projects/%(project_id)s/pipeline_schedules'
2050+
_obj_cls = ProjectPipelineSchedule
2051+
_from_parent_attrs = {'project_id': 'id'}
2052+
_create_attrs = (('description', 'ref', 'cron'),
2053+
('cron_timezone', 'active'))
2054+
2055+
def create(self, data, **kwargs):
2056+
"""Creates a new object.
2057+
2058+
Args:
2059+
data (dict): Parameters to send to the server to create the
2060+
resource
2061+
**kwargs: Extra options to send to the server (e.g. sudo)
2062+
2063+
Raises:
2064+
GitlabAuthenticationError: If authentication is not correct
2065+
GitlabCreateError: If the server cannot perform the request
2066+
2067+
Returns:
2068+
RESTObject: A new instance of the managed object class build with
2069+
the data sent by the server
2070+
"""
2071+
return CreateMixin.create(self, data, path=self.path, **kwargs)
2072+
2073+
2074+
class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject):
2075+
pass
2076+
2077+
20152078
class ProjectPipelineJob(ProjectJob):
20162079
pass
20172080

@@ -2323,6 +2386,7 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
23232386
('pagesdomains', 'ProjectPagesDomainManager'),
23242387
('pipelines', 'ProjectPipelineManager'),
23252388
('protectedbranches', 'ProjectProtectedBranchManager'),
2389+
('pipeline_schedules', 'ProjectPipelineSchedulesManager'),
23262390
('runners', 'ProjectRunnerManager'),
23272391
('services', 'ProjectServiceManager'),
23282392
('snippets', 'ProjectSnippetManager'),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.