Artifactory-Client
view release on metacpan or search on metacpan
lib/Artifactory/Client.pm view on Meta::CPAN
=head2 put( @args )
Invokes PUT request on LWP::UserAgent-like object; params are passed through.
=cut
sub put {
my ( $self, @args ) = @_;
return $self->_request( 'put', @args );
}
=head2 delete( @args )
Invokes DELETE request on LWP::UserAgent-like object; params are passed
through.
=cut
sub delete {
my ( $self, @args ) = @_;
return $self->_request( 'delete', @args );
}
=head2 request( @args )
Invokes request() on LWP::UserAgent-like object; params are passed through.
=cut
sub request {
my ( $self, @args ) = @_;
return $self->_request( 'request', @args );
}
=head1 BUILDS
=cut
=head2 all_builds
Retrieves information on all builds from artifactory.
=cut
sub all_builds {
my $self = shift;
return $self->_get_build('');
}
=head2 build_runs( $build_name )
Retrieves information of a particular build from artifactory.
=cut
sub build_runs {
my ( $self, $build ) = @_;
return $self->_get_build($build);
}
=head2 build_upload( $path_to_json )
Upload Build
=cut
sub build_upload {
my ( $self, $json_file ) = @_;
open( my $fh, '<', $json_file );
chomp( my @lines = <$fh> );
my $json_input = join( "", @lines );
my $data = $self->_json->decode($json_input);
my $url = $self->_api_url() . "/build";
return $self->put(
$url,
"Content-Type" => 'application/json',
Content => $self->_json->encode($data)
);
}
=head2 build_info( $build_name, $build_number )
Retrieves information of a particular build number.
=cut
sub build_info {
my ( $self, $build, $number ) = @_;
return $self->_get_build("$build/$number");
}
=head2 builds_diff( $build_name, $new_build_number, $old_build_number )
Retrieves diff of 2 builds
=cut
sub builds_diff {
my ( $self, $build, $new, $old ) = @_;
return $self->_get_build("$build/$new?diff=$old");
}
=head2 build_promotion( $build_name, $build_number, $payload )
Promotes a build by POSTing payload
=cut
sub build_promotion {
my ( $self, $build, $number, $payload ) = @_;
my $url = $self->_api_url() . "/build/promote/$build/$number";
return $self->post(
$url,
"Content-Type" => 'application/json',
Content => $self->_json->encode($payload)
);
}
=head2 promote_docker_image( targetRepo => "target_repo", dockerRepository => "dockerRepository", tag => "tag", copy => 'false' )
Promotes a Docker image from one repository to another
=cut
sub promote_docker_image {
( run in 0.995 second using v1.01-cache-2.11-cpan-b16cb0d3907 )