diff options
-rw-r--r-- | docs/gl_objects/builds.rst | 22 | ||||
-rw-r--r-- | gitlab/v4/objects.py | 2 |
2 files changed, 15 insertions, 9 deletions
diff --git a/docs/gl_objects/builds.rst b/docs/gl_objects/builds.rst index 089aab7..583ddad 100644 --- a/docs/gl_objects/builds.rst +++ b/docs/gl_objects/builds.rst @@ -238,19 +238,25 @@ List jobs for the project:: jobs = project.jobs.list() -To list builds for a specific pipeline or get a single job within a specific -pipeline, create a -:class:`~gitlab.v4.objects.ProjectPipeline` object and use its -:attr:`~gitlab.v4.objects.ProjectPipeline.jobs` method:: +Get a single job:: + + project.jobs.get(job_id) + +List the jobs of a pipeline:: project = gl.projects.get(project_id) pipeline = project.pipelines.get(pipeline_id) - jobs = pipeline.jobs.list() # gets all jobs in pipeline - job = pipeline.jobs.get(job_id) # gets one job from pipeline + jobs = pipeline.jobs.list() -Get a job:: +.. note:: - project.jobs.get(job_id) + Job methods (play, cancel, and so on) are not available on + ``ProjectPipelineJob`` objects. To use these methods create a ``ProjectJob`` + object:: + + pipeline_job = pipeline.jobs.list()[0] + job = project.jobs.get(pipeline_job.id, lazy=True) + job.retry() Get the artifacts of a job:: diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 4a401df..7231919 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -2415,7 +2415,7 @@ class ProjectFileManager(GetMixin, CreateMixin, UpdateMixin, DeleteMixin, return utils.response_content(result, streamed, action, chunk_size) -class ProjectPipelineJob(ProjectJob): +class ProjectPipelineJob(RESTManager): pass |