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"