Loading GitLab.pm +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use GitLab::Commits; use GitLab::CustomAttributes; use GitLab::Events; use GitLab::Groups; use GitLab::Jobs; use GitLab::Members; use GitLab::Namespaces; use GitLab::Projects; Loading GitLab/API.pm +2 −2 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ sub new { $self->{http} = LWP::UserAgent->new( default_headers => HTTP::Headers->new( "PRIVATE-TOKEN" => $self->{token}, "Private-Token" => $self->{token}, ), keep_alive => $defaults{keep_alive}, ); Loading Loading @@ -129,7 +129,7 @@ sub sudo { if defined $who && !$self->is_admin; $log->debug(defined $who ? "impersonating '$who'" : "stopped impersonation"); $self->http->default_header(SUDO => $who); $self->http->default_header(Sudo => $who); $self->{impersonate} = $who; return; # don't return default_header's output Loading GitLab/Jobs.pm 0 → 100644 +156 −0 Original line number Diff line number Diff line package GitLab::Jobs; use utf8; use strict; use warnings; use vars qw($VERSION); use GitLab::API; use Log::Any qw($log); our $VERSION = v10.4.1; my $requests = { project_jobs => { method => "GET", path => "/projects/<pid>/jobs", query => [qw( scope )], paginated => 1, }, pipeline_jobs => { method => "GET", path => "/projects/<pid>/pipelines/<pipeline_id>/jobs", query => [qw( scope )], paginated => 1, }, job => { method => "GET", path => "/projects/<pid>/jobs/<job_id>", }, # get_artifacts # download_artifacts # get_trace_file job_cancel => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/cancel", }, job_retry => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/retry", }, job_erase => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/erase", }, keep_artifacts => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/artifacts/keep", }, job_play => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/play", }, }; sub import { $log->debug("initializing " . __PACKAGE__); while (my ($name, $tmpl) = each(%$requests)) { $tmpl->{name} = $name unless exists $tmpl->{name}; GitLab::API->register($tmpl); } } 1; __END__ =head1 NAME GitLab::Jobs - implements jobs API calls See L<GitLab API -- Jobs|https://docs.gitlab.com/ee/api/jobs.html> for details and response formats. =head1 VERSION Implements API calls for GitLab CE C<v10.4.1>. =head1 DESCRIPTION =over =item L<project_jobs()|https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs> $jobs = $gitlab->project_jobs( :pid[, :scope]); Get a list of jobs in a project. =item L<pipeline_jobs()|https://docs.gitlab.com/ee/api/jobs.html#list-pipeline-jobs> $jobs = $gitlab->pipeline_jobs( :pid, :pipeline_id[, :scope]); Get a list of jobs for a pipeline. =item L<job()|https://docs.gitlab.com/ee/api/jobs.html#get-a-single-job> $jobs = $gitlab->job( :pid, :job_id ); Get a single job of a project. =item L<job_cancel()|https://docs.gitlab.com/ee/api/jobs.html#cancel-a-job> $gitlab->job_cancel( :pid, :job_id ); Cancel a single job of a project. =item L<job_retry()|https://docs.gitlab.com/ee/api/jobs.html#retry-a-job> $gitlab->job_retry( :pid, :job_id ); Retry a single job of a project. =item L<job_erase()|https://docs.gitlab.com/ee/api/jobs.html#erase-a-job> $gitlab->job_erase( :pid, :job_id ); Erase a single job of a project (remove job artifacts and a job trace). =item L<keep_artifacts()|https://docs.gitlab.com/ee/api/jobs.html#keep-artifacts> $gitlab->keep_artifacts( :pid, :job_id ); Prevents artifacts from being deleted when expiration is set. =item L<job_play()|https://docs.gitlab.com/ee/api/jobs.html#play-a-job> $gitlab->job_play( :pid, :job_id ); Triggers a manual action to start a job. =back =head1 AUTHOR Roman Lacko <L<xlacko1@fi.muni.cz>> =head1 SEE ALSO =over =item L<GitLab> Wrapper around L<GitLab::API> and other C<GitLab::*> modules. =back Loading
GitLab.pm +1 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,7 @@ use GitLab::Commits; use GitLab::CustomAttributes; use GitLab::Events; use GitLab::Groups; use GitLab::Jobs; use GitLab::Members; use GitLab::Namespaces; use GitLab::Projects; Loading
GitLab/API.pm +2 −2 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ sub new { $self->{http} = LWP::UserAgent->new( default_headers => HTTP::Headers->new( "PRIVATE-TOKEN" => $self->{token}, "Private-Token" => $self->{token}, ), keep_alive => $defaults{keep_alive}, ); Loading Loading @@ -129,7 +129,7 @@ sub sudo { if defined $who && !$self->is_admin; $log->debug(defined $who ? "impersonating '$who'" : "stopped impersonation"); $self->http->default_header(SUDO => $who); $self->http->default_header(Sudo => $who); $self->{impersonate} = $who; return; # don't return default_header's output Loading
GitLab/Jobs.pm 0 → 100644 +156 −0 Original line number Diff line number Diff line package GitLab::Jobs; use utf8; use strict; use warnings; use vars qw($VERSION); use GitLab::API; use Log::Any qw($log); our $VERSION = v10.4.1; my $requests = { project_jobs => { method => "GET", path => "/projects/<pid>/jobs", query => [qw( scope )], paginated => 1, }, pipeline_jobs => { method => "GET", path => "/projects/<pid>/pipelines/<pipeline_id>/jobs", query => [qw( scope )], paginated => 1, }, job => { method => "GET", path => "/projects/<pid>/jobs/<job_id>", }, # get_artifacts # download_artifacts # get_trace_file job_cancel => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/cancel", }, job_retry => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/retry", }, job_erase => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/erase", }, keep_artifacts => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/artifacts/keep", }, job_play => { method => "POST", path => "/projects/<pid>/jobs/<job_id>/play", }, }; sub import { $log->debug("initializing " . __PACKAGE__); while (my ($name, $tmpl) = each(%$requests)) { $tmpl->{name} = $name unless exists $tmpl->{name}; GitLab::API->register($tmpl); } } 1; __END__ =head1 NAME GitLab::Jobs - implements jobs API calls See L<GitLab API -- Jobs|https://docs.gitlab.com/ee/api/jobs.html> for details and response formats. =head1 VERSION Implements API calls for GitLab CE C<v10.4.1>. =head1 DESCRIPTION =over =item L<project_jobs()|https://docs.gitlab.com/ee/api/jobs.html#list-project-jobs> $jobs = $gitlab->project_jobs( :pid[, :scope]); Get a list of jobs in a project. =item L<pipeline_jobs()|https://docs.gitlab.com/ee/api/jobs.html#list-pipeline-jobs> $jobs = $gitlab->pipeline_jobs( :pid, :pipeline_id[, :scope]); Get a list of jobs for a pipeline. =item L<job()|https://docs.gitlab.com/ee/api/jobs.html#get-a-single-job> $jobs = $gitlab->job( :pid, :job_id ); Get a single job of a project. =item L<job_cancel()|https://docs.gitlab.com/ee/api/jobs.html#cancel-a-job> $gitlab->job_cancel( :pid, :job_id ); Cancel a single job of a project. =item L<job_retry()|https://docs.gitlab.com/ee/api/jobs.html#retry-a-job> $gitlab->job_retry( :pid, :job_id ); Retry a single job of a project. =item L<job_erase()|https://docs.gitlab.com/ee/api/jobs.html#erase-a-job> $gitlab->job_erase( :pid, :job_id ); Erase a single job of a project (remove job artifacts and a job trace). =item L<keep_artifacts()|https://docs.gitlab.com/ee/api/jobs.html#keep-artifacts> $gitlab->keep_artifacts( :pid, :job_id ); Prevents artifacts from being deleted when expiration is set. =item L<job_play()|https://docs.gitlab.com/ee/api/jobs.html#play-a-job> $gitlab->job_play( :pid, :job_id ); Triggers a manual action to start a job. =back =head1 AUTHOR Roman Lacko <L<xlacko1@fi.muni.cz>> =head1 SEE ALSO =over =item L<GitLab> Wrapper around L<GitLab::API> and other C<GitLab::*> modules. =back