| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -155,6 +155,11 @@ Update a schedule:: | |||
| 155 | 155 | sched.cron = '1 2 * * *' | |
| 156 | 156 | sched.save() | |
| 157 | 157 | ||
| 158 | + Trigger a pipeline schedule immediately:: | ||
| 159 | + | ||
| 160 | + sched = projects.pipelineschedules.get(schedule_id) | ||
| 161 | + sched.play() | ||
| 162 | + | ||
| 158 | 163 | Delete a schedule:: | |
| 159 | 164 | ||
| 160 | 165 | sched.delete() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -145,6 +145,10 @@ class GitlabJobEraseError(GitlabRetryError): | |||
| 145 | 145 | pass | |
| 146 | 146 | ||
| 147 | 147 | ||
| 148 | + class GitlabPipelinePlayError(GitlabRetryError): | ||
| 149 | + pass | ||
| 150 | + | ||
| 151 | + | ||
| 148 | 152 | class GitlabPipelineRetryError(GitlabRetryError): | |
| 149 | 153 | pass | |
| 150 | 154 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3775,6 +3775,24 @@ def take_ownership(self, **kwargs): | |||
| 3775 | 3775 | server_data = self.manager.gitlab.http_post(path, **kwargs) | |
| 3776 | 3776 | self._update_attrs(server_data) | |
| 3777 | 3777 | ||
| 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 | + | ||
| 3778 | 3796 | ||
| 3779 | 3797 | class ProjectPipelineScheduleManager(CRUDMixin, RESTManager): | |
| 3780 | 3798 | _path = "/projects/%(project_id)s/pipeline_schedules" | |
| Back | FazBrowse Home | New Git URL |
0 commit comments