Skip to content

Commit e1af0a0

Browse files
author
Gauvain Pocentek
committed
ProjectPipelineJob objects can only be listed
And they are not directly related to ProjectJob objects. Fixes #531
1 parent ebf822c commit e1af0a0

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

docs/gl_objects/builds.rst

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,19 +238,25 @@ List jobs for the project::
238238

239239
jobs = project.jobs.list()
240240

241-
To list builds for a specific pipeline or get a single job within a specific
242-
pipeline, create a
243-
:class:`~gitlab.v4.objects.ProjectPipeline` object and use its
244-
:attr:`~gitlab.v4.objects.ProjectPipeline.jobs` method::
241+
Get a single job::
242+
243+
project.jobs.get(job_id)
244+
245+
List the jobs of a pipeline::
245246

246247
project = gl.projects.get(project_id)
247248
pipeline = project.pipelines.get(pipeline_id)
248-
jobs = pipeline.jobs.list() # gets all jobs in pipeline
249-
job = pipeline.jobs.get(job_id) # gets one job from pipeline
249+
jobs = pipeline.jobs.list()
250250

251-
Get a job::
251+
.. note::
252252

253-
project.jobs.get(job_id)
253+
Job methods (play, cancel, and so on) are not available on
254+
``ProjectPipelineJob`` objects. To use these methods create a ``ProjectJob``
255+
object::
256+
257+
pipeline_job = pipeline.jobs.list()[0]
258+
job = project.jobs.get(pipeline_job.id, lazy=True)
259+
job.retry()
254260

255261
Get the artifacts of a job::
256262

gitlab/v4/objects.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2415,7 +2415,7 @@ def raw(self, file_path, ref, streamed=False, action=None, chunk_size=1024,
24152415
return utils.response_content(result, streamed, action, chunk_size)
24162416

24172417

2418-
class ProjectPipelineJob(ProjectJob):
2418+
class ProjectPipelineJob(RESTManager):
24192419
pass
24202420

24212421

0 commit comments

Comments
 (0)