Skip to content

Commit 564de48

Browse files
author
Agustin Henze
committed
feat: add endpoint to get the variables of a pipeline
It adds a new endpoint which was released in the Gitlab CE 11.11. Signed-off-by: Agustin Henze <tin@redhat.com>
1 parent 794d64c commit 564de48

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

docs/gl_objects/builds.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Get a pipeline for a project::
2929

3030
pipeline = project.pipelines.get(pipeline_id)
3131

32+
Get variables of a pipeline::
33+
34+
variables = pipeline.variables.list()
35+
3236
Create a pipeline for a particular reference::
3337

3438
pipeline = project.pipelines.create({'ref': 'master'})

gitlab/v4/objects.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3100,8 +3100,21 @@ class ProjectPipelineJobManager(ListMixin, RESTManager):
31003100
_list_filters = ("scope",)
31013101

31023102

3103+
class ProjectPipelineVariable(RESTObject):
3104+
_id_attr = "key"
3105+
3106+
3107+
class ProjectPipelineVariableManager(ListMixin, RESTManager):
3108+
_path = "/projects/%(project_id)s/pipelines/%(pipeline_id)s/variables"
3109+
_obj_cls = ProjectPipelineVariable
3110+
_from_parent_attrs = {"project_id": "project_id", "pipeline_id": "id"}
3111+
3112+
31033113
class ProjectPipeline(RESTObject, RefreshMixin, ObjectDeleteMixin):
3104-
_managers = (("jobs", "ProjectPipelineJobManager"),)
3114+
_managers = (
3115+
("jobs", "ProjectPipelineJobManager"),
3116+
("variables", "ProjectPipelineVariableManager"),
3117+
)
31053118

31063119
@cli.register_custom_action("ProjectPipeline")
31073120
@exc.on_http_error(exc.GitlabPipelineCancelError)

0 commit comments

Comments
 (0)