diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2018-06-14 19:05:17 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2018-06-14 19:05:17 +0200 |
commit | e1af0a08d9fb29e67a96d67cc2609eecdfc182f7 (patch) | |
tree | 99b96b3cf56e5633d068706fcc841b2528400d16 | |
parent | ebf822cef7e686d8a198dcf419c20b1bfb88dea3 (diff) | |
download | gitlab-e1af0a08d9fb29e67a96d67cc2609eecdfc182f7.tar.gz |
ProjectPipelineJob objects can only be listed
And they are not directly related to ProjectJob objects.
Fixes #531
-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 |