From 07b99881dfa6efa9665245647460e99846ccd341 Mon Sep 17 00:00:00 2001 From: Christopher Zorn Date: Wed, 8 Apr 2020 17:02:29 -0700 Subject: 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 --- gitlab/exceptions.py | 4 ++++ gitlab/v4/objects.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) (limited to 'gitlab') diff --git a/gitlab/exceptions.py b/gitlab/exceptions.py index f95e686..fd2ff2a 100644 --- a/gitlab/exceptions.py +++ b/gitlab/exceptions.py @@ -145,6 +145,10 @@ class GitlabJobEraseError(GitlabRetryError): pass +class GitlabPipelinePlayError(GitlabRetryError): + pass + + class GitlabPipelineRetryError(GitlabRetryError): pass diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 756ec4f..f6c09d9 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3775,6 +3775,24 @@ class ProjectPipelineSchedule(SaveMixin, ObjectDeleteMixin, RESTObject): server_data = self.manager.gitlab.http_post(path, **kwargs) self._update_attrs(server_data) + @cli.register_custom_action("ProjectPipelineSchedule") + @exc.on_http_error(exc.GitlabPipelinePlayError) + def play(self, **kwargs): + """Trigger a new scheduled pipeline, which runs immediately. + The next scheduled run of this pipeline is not affected. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabPipelinePlayError: 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" -- cgit v1.2.1