From 72ade19046f47b35c1b5ad7333f11fee0dc1e56f Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Mon, 29 Jan 2018 17:44:22 +0100 Subject: [PATCH 1/2] make trigger_pipeline return the pipeline Trigger_pipeline returns nothing, which makes it difficult to track the pipeline being trigger. Next PR will be about updating a pipeline object to get latest status (not sure yet the best way to do it) --- gitlab/v4/objects.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index f8b0dce7f..67f80d061 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -2624,7 +2624,8 @@ def trigger_pipeline(self, ref, token, variables={}, **kwargs): """ path = '/projects/%s/trigger/pipeline' % self.get_id() post_data = {'ref': ref, 'token': token, 'variables': variables} - self.manager.gitlab.http_post(path, post_data=post_data, **kwargs) + attrs = self.manager.gitlab.http_post(path, post_data=post_data, **kwargs) + return ProjectPipeline(project.pipelines, attrs) @cli.register_custom_action('Project') @exc.on_http_error(exc.GitlabHousekeepingError) From 8134f84f96059dbde72359c414352e2dbe3535e0 Mon Sep 17 00:00:00 2001 From: Pierre Tardy Date: Mon, 5 Feb 2018 14:58:53 +0100 Subject: [PATCH 2/2] fix pep8 --- gitlab/v4/objects.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 67f80d061..7adf82cc7 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -2624,8 +2624,9 @@ def trigger_pipeline(self, ref, token, variables={}, **kwargs): """ path = '/projects/%s/trigger/pipeline' % self.get_id() post_data = {'ref': ref, 'token': token, 'variables': variables} - attrs = self.manager.gitlab.http_post(path, post_data=post_data, **kwargs) - return ProjectPipeline(project.pipelines, attrs) + attrs = self.manager.gitlab.http_post( + path, post_data=post_data, **kwargs) + return ProjectPipeline(self.pipelines, attrs) @cli.register_custom_action('Project') @exc.on_http_error(exc.GitlabHousekeepingError)