Skip to content
2 changes: 1 addition & 1 deletion gitlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 18 additions & 0 deletions gitlab/v4/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down