-
Notifications
You must be signed in to change notification settings - Fork 671
add "list pipeline jobs" handler #378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1707,6 +1707,10 @@ def raw(self, file_path, ref, streamed=False, action=None, chunk_size=1024, | |
|
||
|
||
class ProjectPipeline(RESTObject): | ||
_managers = ( | ||
('jobs', 'PipelineJobManager'), | ||
) | ||
|
||
@cli.register_custom_action('ProjectPipeline') | ||
@exc.on_http_error(exc.GitlabPipelineCancelError) | ||
def cancel(self, **kwargs): | ||
|
@@ -1764,6 +1768,12 @@ def create(self, data, **kwargs): | |
return CreateMixin.create(self, data, path=path, **kwargs) | ||
|
||
|
||
class PipelineJobManager(ListMixin, RESTManager): | ||
_path = '/projects/%(project_id)s/pipelines/%(pipeline_id)s/jobs' | ||
_obj_cls = ProjectJob | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although this seems to be a good idea to use a ProjectJob, things get a bit more complicated than expected when using the CLI. To avoid bad surprises I try to stick to the upstream API logic: we are requesting a different URL so we get a different object class. Could you create and use a |
||
_from_parent_attrs = {'project_id': 'project_id', 'pipeline_id': 'id'} | ||
|
||
|
||
class ProjectSnippetNote(SaveMixin, ObjectDeleteMixin, RESTObject): | ||
pass | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you can list and get jobs, you should use a
RetrieveMixin
here.