diff options
author | Max Wittig <max.wittig95@gmail.com> | 2019-06-10 13:40:00 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-10 13:40:00 +0200 |
commit | 463cedc952155ad56ce0762bc04e0ff303b093fe (patch) | |
tree | 6bb478b0243b1ba13ab0427a187b9f054441e177 | |
parent | 5af0b527a44d10b648c2c1464cfbb25c2a642af0 (diff) | |
parent | 564de484f5ef4c76261057d3d2207dc747da020b (diff) | |
download | gitlab-463cedc952155ad56ce0762bc04e0ff303b093fe.tar.gz |
Merge pull request #785 from agustinhenze/add-pipeline-get-variables-endpoint
Add new endpoint to get the variables of a pipeline
-rw-r--r-- | docs/gl_objects/builds.rst | 4 | ||||
-rw-r--r-- | gitlab/v4/objects.py | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/docs/gl_objects/builds.rst b/docs/gl_objects/builds.rst index a80fe6d..d74d9d6 100644 --- a/docs/gl_objects/builds.rst +++ b/docs/gl_objects/builds.rst @@ -29,6 +29,10 @@ Get a pipeline for a project:: pipeline = project.pipelines.get(pipeline_id) +Get variables of a pipeline:: + + variables = pipeline.variables.list() + Create a pipeline for a particular reference:: pipeline = project.pipelines.create({'ref': 'master'}) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 16a3da8..8fc7150 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3100,8 +3100,21 @@ class ProjectPipelineJobManager(ListMixin, RESTManager): _list_filters = ("scope",) +class ProjectPipelineVariable(RESTObject): + _id_attr = "key" + + +class ProjectPipelineVariableManager(ListMixin, RESTManager): + _path = "/projects/%(project_id)s/pipelines/%(pipeline_id)s/variables" + _obj_cls = ProjectPipelineVariable + _from_parent_attrs = {"project_id": "project_id", "pipeline_id": "id"} + + class ProjectPipeline(RESTObject, RefreshMixin, ObjectDeleteMixin): - _managers = (("jobs", "ProjectPipelineJobManager"),) + _managers = ( + ("jobs", "ProjectPipelineJobManager"), + ("variables", "ProjectPipelineVariableManager"), + ) @cli.register_custom_action("ProjectPipeline") @exc.on_http_error(exc.GitlabPipelineCancelError) |