@@ -1610,6 +1610,43 @@ class ProjectFileManager(BaseManager):
1610
1610
obj_cls = ProjectFile
1611
1611
1612
1612
1613
+ class ProjectPipeline (GitlabObject ):
1614
+ _url = '/projects/%(project_id)s/pipelines'
1615
+ canCreate = False
1616
+ canUpdate = False
1617
+ canDelete = False
1618
+
1619
+ def retry (self , ** kwargs ):
1620
+ """Retries failed builds in a pipeline.
1621
+
1622
+ Raises:
1623
+ GitlabConnectionError: If the server cannot be reached.
1624
+ GitlabPipelineRetryError: If the retry cannot be done.
1625
+ """
1626
+ url = ('/projects/%(project_id)s/pipelines/%(id)s/retry' %
1627
+ {'project_id' : self .project_id , 'id' : self .id })
1628
+ r = self .gitlab ._raw_post (url , data = None , content_type = None , ** kwargs )
1629
+ raise_error_from_response (r , GitlabPipelineRetryError , 201 )
1630
+ self ._set_from_dict (r .json ())
1631
+
1632
+ def cancel (self , ** kwargs ):
1633
+ """Cancel builds in a pipeline.
1634
+
1635
+ Raises:
1636
+ GitlabConnectionError: If the server cannot be reached.
1637
+ GitlabPipelineCancelError: If the retry cannot be done.
1638
+ """
1639
+ url = ('/projects/%(project_id)s/pipelines/%(id)s/cancel' %
1640
+ {'project_id' : self .project_id , 'id' : self .id })
1641
+ r = self .gitlab ._raw_post (url , data = None , content_type = None , ** kwargs )
1642
+ raise_error_from_response (r , GitlabPipelineRetryError , 200 )
1643
+ self ._set_from_dict (r .json ())
1644
+
1645
+
1646
+ class ProjectPipelineManager (BaseManager ):
1647
+ obj_cls = ProjectPipeline
1648
+
1649
+
1613
1650
class ProjectSnippetNote (GitlabObject ):
1614
1651
_url = '/projects/%(project_id)s/snippets/%(snippet_id)s/notes'
1615
1652
_constructorTypes = {'author' : 'User' }
@@ -1804,6 +1841,7 @@ class Project(GitlabObject):
1804
1841
('mergerequests' , ProjectMergeRequestManager , [('project_id' , 'id' )]),
1805
1842
('milestones' , ProjectMilestoneManager , [('project_id' , 'id' )]),
1806
1843
('notes' , ProjectNoteManager , [('project_id' , 'id' )]),
1844
+ ('pipelines' , ProjectPipelineManager , [('project_id' , 'id' )]),
1807
1845
('services' , ProjectServiceManager , [('project_id' , 'id' )]),
1808
1846
('snippets' , ProjectSnippetManager , [('project_id' , 'id' )]),
1809
1847
('tags' , ProjectTagManager , [('project_id' , 'id' )]),
0 commit comments