From a64e16415dc98c069c72c711e6b03144739f422e Mon Sep 17 00:00:00 2001 From: Christopher Zorn Date: Wed, 8 Apr 2020 15:02:23 -0700 Subject: [PATCH 1/6] Add a play option to a pipeline schedule to trigger it immediately --- gitlab/__init__.py | 2 +- gitlab/v4/objects.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gitlab/__init__.py b/gitlab/__init__.py index f46cbac5a..0e383713c 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -30,7 +30,7 @@ from gitlab import utils # noqa __title__ = "python-gitlab" -__version__ = "2.2.0" +__version__ = "2.2.1" __author__ = "Gauvain Pocentek" __email__ = "gauvainpocentek@gmail.com" __license__ = "LGPL3" diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 29b10fc1d..c72c41e7a 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3774,6 +3774,23 @@ def take_ownership(self, **kwargs): server_data = self.manager.gitlab.http_post(path, **kwargs) self._update_attrs(server_data) + @cli.register_custom_action("ProjectPipelineSchedule") + @exc.on_http_error(exc.GitlabOwnershipError) + def play(self, **kwargs): + # https://docs.gitlab.com/ee/api/pipeline_schedules.html#run-a-scheduled-pipeline-immediately # noqa + """Play a pipeline schedule immediately. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabOwnershipError: If the request failed + """ + path = "%s/%s/play" % (self.manager.path, self.get_id()) + server_data = self.manager.gitlab.http_post(path, **kwargs) + self._update_attrs(server_data) + class ProjectPipelineScheduleManager(CRUDMixin, RESTManager): _path = "/projects/%(project_id)s/pipeline_schedules" From fc3c2b319b8daaadec6d0d3e9b813c3d71e300f8 Mon Sep 17 00:00:00 2001 From: Christopher Zorn Date: Wed, 8 Apr 2020 16:08:18 -0700 Subject: [PATCH 2/6] return the response from the api --- gitlab/v4/objects.py | 1 + 1 file changed, 1 insertion(+) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index c72c41e7a..5afffc901 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3790,6 +3790,7 @@ def play(self, **kwargs): path = "%s/%s/play" % (self.manager.path, self.get_id()) server_data = self.manager.gitlab.http_post(path, **kwargs) self._update_attrs(server_data) + return server_data class ProjectPipelineScheduleManager(CRUDMixin, RESTManager): From 4efc74ce1bb0bce1e109adddaa0178df79320e85 Mon Sep 17 00:00:00 2001 From: Christopher Zorn Date: Wed, 8 Apr 2020 16:12:36 -0700 Subject: [PATCH 3/6] return the response from the api as json with pipeline id --- gitlab/v4/objects.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 5afffc901..cc1efa512 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3790,7 +3790,13 @@ def play(self, **kwargs): path = "%s/%s/play" % (self.manager.path, self.get_id()) server_data = self.manager.gitlab.http_post(path, **kwargs) self._update_attrs(server_data) - return server_data + split_server_message = server_data.split() + if split_server_message[0] == 'message:': + return_data = {'message': server_data, + 'pipeline_id': split_server_message[1]} + else: + return_data = server_data + return return_data class ProjectPipelineScheduleManager(CRUDMixin, RESTManager): From 68232f881e3b626a46c23f4061a26876a95cecfd Mon Sep 17 00:00:00 2001 From: Christopher Zorn Date: Wed, 8 Apr 2020 16:13:33 -0700 Subject: [PATCH 4/6] return the response from the api --- gitlab/v4/objects.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index cc1efa512..5afffc901 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3790,13 +3790,7 @@ def play(self, **kwargs): path = "%s/%s/play" % (self.manager.path, self.get_id()) server_data = self.manager.gitlab.http_post(path, **kwargs) self._update_attrs(server_data) - split_server_message = server_data.split() - if split_server_message[0] == 'message:': - return_data = {'message': server_data, - 'pipeline_id': split_server_message[1]} - else: - return_data = server_data - return return_data + return server_data class ProjectPipelineScheduleManager(CRUDMixin, RESTManager): From e85a718c32167bf07b5aa146ff2661f2feec7de6 Mon Sep 17 00:00:00 2001 From: Christopher Zorn Date: Wed, 8 Apr 2020 15:02:23 -0700 Subject: [PATCH 5/6] feat: Add a play option to a pipeline schedule to trigger it immediately --- gitlab/__init__.py | 2 +- gitlab/v4/objects.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gitlab/__init__.py b/gitlab/__init__.py index f46cbac5a..0e383713c 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -30,7 +30,7 @@ from gitlab import utils # noqa __title__ = "python-gitlab" -__version__ = "2.2.0" +__version__ = "2.2.1" __author__ = "Gauvain Pocentek" __email__ = "gauvainpocentek@gmail.com" __license__ = "LGPL3" diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 29b10fc1d..5afffc901 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3774,6 +3774,24 @@ def take_ownership(self, **kwargs): server_data = self.manager.gitlab.http_post(path, **kwargs) self._update_attrs(server_data) + @cli.register_custom_action("ProjectPipelineSchedule") + @exc.on_http_error(exc.GitlabOwnershipError) + def play(self, **kwargs): + # https://docs.gitlab.com/ee/api/pipeline_schedules.html#run-a-scheduled-pipeline-immediately # noqa + """Play a pipeline schedule immediately. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabOwnershipError: If the request failed + """ + path = "%s/%s/play" % (self.manager.path, self.get_id()) + server_data = self.manager.gitlab.http_post(path, **kwargs) + self._update_attrs(server_data) + return server_data + class ProjectPipelineScheduleManager(CRUDMixin, RESTManager): _path = "/projects/%(project_id)s/pipeline_schedules" From cc8d91e53f7fa704bdc71216ea1573ea1f7f1668 Mon Sep 17 00:00:00 2001 From: Christopher Zorn Date: Wed, 8 Apr 2020 15:02:23 -0700 Subject: [PATCH 6/6] feat: Add a play option to a pipeline schedule to trigger it immediately fix: return the response from the api --- gitlab/__init__.py | 2 +- gitlab/v4/objects.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/gitlab/__init__.py b/gitlab/__init__.py index f46cbac5a..0e383713c 100644 --- a/gitlab/__init__.py +++ b/gitlab/__init__.py @@ -30,7 +30,7 @@ from gitlab import utils # noqa __title__ = "python-gitlab" -__version__ = "2.2.0" +__version__ = "2.2.1" __author__ = "Gauvain Pocentek" __email__ = "gauvainpocentek@gmail.com" __license__ = "LGPL3" diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 29b10fc1d..5afffc901 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3774,6 +3774,24 @@ def take_ownership(self, **kwargs): server_data = self.manager.gitlab.http_post(path, **kwargs) self._update_attrs(server_data) + @cli.register_custom_action("ProjectPipelineSchedule") + @exc.on_http_error(exc.GitlabOwnershipError) + def play(self, **kwargs): + # https://docs.gitlab.com/ee/api/pipeline_schedules.html#run-a-scheduled-pipeline-immediately # noqa + """Play a pipeline schedule immediately. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabOwnershipError: If the request failed + """ + path = "%s/%s/play" % (self.manager.path, self.get_id()) + server_data = self.manager.gitlab.http_post(path, **kwargs) + self._update_attrs(server_data) + return server_data + class ProjectPipelineScheduleManager(CRUDMixin, RESTManager): _path = "/projects/%(project_id)s/pipeline_schedules" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy