Skip to content

Commit 07b9988

Browse files
committed
feat: add play command to project pipeline schedules
fix: remove version from setup feat: add pipeline schedule play error exception docs: add documentation for pipeline schedule play
1 parent 7907e5a commit 07b9988

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

docs/gl_objects/pipelines_and_jobs.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ Update a schedule::
155155
sched.cron = '1 2 * * *'
156156
sched.save()
157157

158+
Trigger a pipeline schedule immediately::
159+
160+
sched = projects.pipelineschedules.get(schedule_id)
161+
sched.play()
162+
158163
Delete a schedule::
159164

160165
sched.delete()

gitlab/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ class GitlabJobEraseError(GitlabRetryError):
145145
pass
146146

147147

148+
class GitlabPipelinePlayError(GitlabRetryError):
149+
pass
150+
151+
148152
class GitlabPipelineRetryError(GitlabRetryError):
149153
pass
150154

gitlab/v4/objects.py

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

3778+
@cli.register_custom_action("ProjectPipelineSchedule")
3779+
@exc.on_http_error(exc.GitlabPipelinePlayError)
3780+
def play(self, **kwargs):
3781+
"""Trigger a new scheduled pipeline, which runs immediately.
3782+
The next scheduled run of this pipeline is not affected.
3783+
3784+
Args:
3785+
**kwargs: Extra options to send to the server (e.g. sudo)
3786+
3787+
Raises:
3788+
GitlabAuthenticationError: If authentication is not correct
3789+
GitlabPipelinePlayError: If the request failed
3790+
"""
3791+
path = "%s/%s/play" % (self.manager.path, self.get_id())
3792+
server_data = self.manager.gitlab.http_post(path, **kwargs)
3793+
self._update_attrs(server_data)
3794+
return server_data
3795+
37783796

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

0 commit comments

Comments
 (0)
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