Skip to content

Commit 48bc54f

Browse files
committed
feat: add play command to project pipeline schedules
1 parent efc6182 commit 48bc54f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

gitlab/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from gitlab import utils # noqa
3131

3232
__title__ = "python-gitlab"
33-
__version__ = "2.2.0"
33+
__version__ = "2.2.1"
3434
__author__ = "Gauvain Pocentek"
3535
__email__ = "gauvainpocentek@gmail.com"
3636
__license__ = "LGPL3"

gitlab/v4/objects.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3774,6 +3774,24 @@ def take_ownership(self, **kwargs):
37743774
server_data = self.manager.gitlab.http_post(path, **kwargs)
37753775
self._update_attrs(server_data)
37763776

3777+
@cli.register_custom_action("ProjectPipelineSchedule")
3778+
@exc.on_http_error(exc.GitlabOwnershipError)
3779+
def play(self, **kwargs):
3780+
# https://docs.gitlab.com/ee/api/pipeline_schedules.html#run-a-scheduled-pipeline-immediately # noqa
3781+
"""Play a pipeline schedule immediately.
3782+
3783+
Args:
3784+
**kwargs: Extra options to send to the server (e.g. sudo)
3785+
3786+
Raises:
3787+
GitlabAuthenticationError: If authentication is not correct
3788+
GitlabOwnershipError: If the request failed
3789+
"""
3790+
path = "%s/%s/play" % (self.manager.path, self.get_id())
3791+
server_data = self.manager.gitlab.http_post(path, **kwargs)
3792+
self._update_attrs(server_data)
3793+
return server_data
3794+
37773795

37783796
class ProjectPipelineScheduleManager(CRUDMixin, RESTManager):
37793797
_path = "/projects/%(project_id)s/pipeline_schedules"

0 commit comments

Comments
 (0)