summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMond WAN <mondwan@users.noreply.github.com>2017-03-18 16:48:11 +0800
committerGauvain Pocentek <gauvain@pocentek.net>2017-03-18 09:48:11 +0100
commit8c27e70b821e02921dfec4f8e4c6b77b5b284009 (patch)
treed0b8bfc36fbf7d74e6b2200aede3a85a863e2305
parent3b388447fecab4d86a3387178bfb2876776d7567 (diff)
downloadgitlab-8c27e70b821e02921dfec4f8e4c6b77b5b284009.tar.gz
Implement pipeline creation API (#237)
-rw-r--r--docs/gl_objects/projects.py6
-rw-r--r--docs/gl_objects/projects.rst6
-rw-r--r--gitlab/objects.py6
3 files changed, 17 insertions, 1 deletions
diff --git a/docs/gl_objects/projects.py b/docs/gl_objects/projects.py
index 54bde84..4412f22 100644
--- a/docs/gl_objects/projects.py
+++ b/docs/gl_objects/projects.py
@@ -400,6 +400,12 @@ pipeline = gl.project_pipelines.get(pipeline_id, project_id=1)
pipeline = project.pipelines.get(pipeline_id)
# end pipeline get
+# pipeline create
+pipeline = gl.project_pipelines.create({'project_id': 1, 'ref': 'master'})
+# or
+pipeline = project.pipelines.create({'ref': 'master'})
+# end pipeline create
+
# pipeline retry
pipeline.retry()
# end pipeline retry
diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst
index dc6c48b..300b848 100644
--- a/docs/gl_objects/projects.rst
+++ b/docs/gl_objects/projects.rst
@@ -438,6 +438,12 @@ Cancel builds in a pipeline:
:start-after: # pipeline cancel
:end-before: # end pipeline cancel
+Create a pipeline for a particular reference:
+
+.. literalinclude:: projects.py
+ :start-after: # pipeline create
+ :end-before: # end pipeline create
+
Services
--------
diff --git a/gitlab/objects.py b/gitlab/objects.py
index 4790712..119671c 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -1991,10 +1991,14 @@ class ProjectFileManager(BaseManager):
class ProjectPipeline(GitlabObject):
_url = '/projects/%(project_id)s/pipelines'
- canCreate = False
+ _create_url = '/projects/%(project_id)s/pipeline'
+
canUpdate = False
canDelete = False
+ requiredUrlAttrs = ['project_id']
+ requiredCreateAttrs = ['ref']
+
def retry(self, **kwargs):
"""Retries failed builds in a pipeline.