@@ -1610,6 +1610,43 @@ class ProjectFileManager(BaseManager):
16101610 obj_cls = ProjectFile
16111611
16121612
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+
16131650class ProjectSnippetNote (GitlabObject ):
16141651 _url = '/projects/%(project_id)s/snippets/%(snippet_id)s/notes'
16151652 _constructorTypes = {'author' : 'User' }
@@ -1804,6 +1841,7 @@ class Project(GitlabObject):
18041841 ('mergerequests' , ProjectMergeRequestManager , [('project_id' , 'id' )]),
18051842 ('milestones' , ProjectMilestoneManager , [('project_id' , 'id' )]),
18061843 ('notes' , ProjectNoteManager , [('project_id' , 'id' )]),
1844+ ('pipelines' , ProjectPipelineManager , [('project_id' , 'id' )]),
18071845 ('services' , ProjectServiceManager , [('project_id' , 'id' )]),
18081846 ('snippets' , ProjectSnippetManager , [('project_id' , 'id' )]),
18091847 ('tags' , ProjectTagManager , [('project_id' , 'id' )]),
0 commit comments