diff options
author | Max Wittig <max.wittig@siemens.com> | 2020-04-22 08:27:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 08:27:49 +0200 |
commit | 9d66cb3ccc8d9edac68380b4b8ff285a9782e698 (patch) | |
tree | ab04f82adbfd84c9f42fb77cd434bf9c52179b72 /gitlab/v4/objects.py | |
parent | 7907e5a4b602d22d03d71ca51c6803f634bd8a78 (diff) | |
parent | 930122b1848b3d42af1cf8567a065829ec0eb44f (diff) | |
download | gitlab-9d66cb3ccc8d9edac68380b4b8ff285a9782e698.tar.gz |
Merge pull request #1069 from zillow/feat/add-custom-pipeline-schedule-play
feat: Add play command to project pipeline schedules
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r-- | gitlab/v4/objects.py | 18 |
1 files changed, 18 insertions, 0 deletions
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" |