summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorg0t mi1k <have.you.g0tmi1k@gmail.com>2023-01-23 05:43:35 +0000
committerg0t mi1k <have.you.g0tmi1k@gmail.com>2023-02-08 14:41:24 +0000
commit6b291efa2ea3d6d681ff9004443ff181d7a72ced (patch)
tree0d70d2de5d4356b568d41d2f1774213e53e06fbb
parent2ce6a666d7c6f3c239dab91aa0bf5553c5dfd8dc (diff)
Add patch: run_pipeline_schedule
Using GitLab's API v4, it is possible to manually run a scheduled pipeline job. REF: https://docs.gitlab.com/ee/api/pipeline_schedules.html#run-a-scheduled-pipeline-immediately
-rwxr-xr-xdebian/patches/0001-add-run_pipeline_schedule.patch54
-rwxr-xr-xdebian/patches/series1
2 files changed, 55 insertions, 0 deletions
diff --git a/debian/patches/0001-add-run_pipeline_schedule.patch b/debian/patches/0001-add-run_pipeline_schedule.patch
new file mode 100755
index 0000000..5ecbee9
--- /dev/null
+++ b/debian/patches/0001-add-run_pipeline_schedule.patch
@@ -0,0 +1,54 @@
+Description:
+ Using GitLab's API v4, it is possible to manually run a scheduled pipeline job.
+ REF: https://docs.gitlab.com/ee/api/pipeline_schedules.html#run-a-scheduled-pipeline-immediately
+Author: g0t mi1k <have.you.g0tmi1k@gmail.com>
+Last-Update: Mon, 23 Jan 2023 05:28:26 +0000
+Forwarded: https://github.com/bluefeet/GitLab-API-v4/pull/55
+---
+ author/sections/pipeline_schedules.yml | 1 +
+ lib/GitLab/API/v4.pm | 20 ++++++++++++++++++++
+ 2 files changed, 21 insertions(+)
+
+diff --git a/author/sections/pipeline_schedules.yml b/author/sections/pipeline_schedules.yml
+index 71eeb30..2d7b76d 100644
+--- a/author/sections/pipeline_schedules.yml
++++ b/author/sections/pipeline_schedules.yml
+@@ -4,6 +4,7 @@
+ - create_pipeline_schedule: schedule = POST projects/:project_id/pipeline_schedules?
+ - edit_pipeline_schedule: schedule = PUT projects/:project_id/pipeline_schedules/:pipeline_schedule_id?
+ - take_ownership_of_pipeline_schedule: schedule = POST projects/:project_id/pipeline_schedules/:pipeline_schedule_id/take_ownership
++- run_pipeline_schedule: variable = POST projects/:project_id/pipeline_schedules/:pipeline_schedule_id/play
+ - delete_pipeline_schedule: schedule = DELETE projects/:project_id/pipeline_schedules/:pipeline_schedule_id
+ - create_pipeline_schedule_variable: variable = POST projects/:project_id/pipeline_schedules/:pipeline_schedule_id/variables?
+ - edit_pipeline_schedule_variable: variable = PUT projects/:project_id/pipeline_schedules/:pipeline_schedule_id/variables/:variable_key?
+diff --git a/lib/GitLab/API/v4.pm b/lib/GitLab/API/v4.pm
+index 87ba571..b992795 100644
+--- a/lib/GitLab/API/v4.pm
++++ b/lib/GitLab/API/v4.pm
+@@ -7086,6 +7086,26 @@ sub take_ownership_of_pipeline_schedule {
+ return $self->_call_rest_client( 'POST', 'projects/:project_id/pipeline_schedules/:pipeline_schedule_id/take_ownership', [@_], $options );
+ }
+
++=item run_pipeline_schedule
++
++ my $variable = $api->run_pipeline_schedule(
++ $project_id,
++ $pipeline_schedule_id,
++ );
++
++Sends a C<POST> request to C<projects/:project_id/pipeline_schedules/:pipeline_schedule_id/play> and returns the decoded response content.
++
++=cut
++
++sub run_pipeline_schedule {
++ my $self = shift;
++ croak 'run_pipeline_schedule must be called with 2 arguments' if @_ != 2;
++ croak 'The #1 argument ($project_id) to run_pipeline_schedule must be a scalar' if ref($_[0]) or (!defined $_[0]);
++ croak 'The #2 argument ($pipeline_schedule_id) to run_pipeline_schedule must be a scalar' if ref($_[1]) or (!defined $_[1]);
++ my $options = {};
++ return $self->_call_rest_client( 'POST', 'projects/:project_id/pipeline_schedules/:pipeline_schedule_id/play', [@_], $options );
++}
++
+ =item delete_pipeline_schedule
+
+ my $schedule = $api->delete_pipeline_schedule(
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100755
index 0000000..32b4e8b
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-add-run_pipeline_schedule.patch