Skip to content

Commit 8c27e70

Browse files
mondwanGauvain Pocentek
authored and
Gauvain Pocentek
committed
Implement pipeline creation API (#237)
1 parent 3b38844 commit 8c27e70

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

docs/gl_objects/projects.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,12 @@
400400
pipeline = project.pipelines.get(pipeline_id)
401401
# end pipeline get
402402

403+
# pipeline create
404+
pipeline = gl.project_pipelines.create({'project_id': 1, 'ref': 'master'})
405+
# or
406+
pipeline = project.pipelines.create({'ref': 'master'})
407+
# end pipeline create
408+
403409
# pipeline retry
404410
pipeline.retry()
405411
# end pipeline retry

docs/gl_objects/projects.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,12 @@ Cancel builds in a pipeline:
438438
:start-after: # pipeline cancel
439439
:end-before: # end pipeline cancel
440440

441+
Create a pipeline for a particular reference:
442+
443+
.. literalinclude:: projects.py
444+
:start-after: # pipeline create
445+
:end-before: # end pipeline create
446+
441447
Services
442448
--------
443449

gitlab/objects.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1991,10 +1991,14 @@ class ProjectFileManager(BaseManager):
19911991

19921992
class ProjectPipeline(GitlabObject):
19931993
_url = '/projects/%(project_id)s/pipelines'
1994-
canCreate = False
1994+
_create_url = '/projects/%(project_id)s/pipeline'
1995+
19951996
canUpdate = False
19961997
canDelete = False
19971998

1999+
requiredUrlAttrs = ['project_id']
2000+
requiredCreateAttrs = ['ref']
2001+
19982002
def retry(self, **kwargs):
19992003
"""Retries failed builds in a pipeline.
20002004

0 commit comments

Comments
 (0)