Skip to content

Commit

Permalink
[backend] bs_regpush: support artifacthub data
Browse files Browse the repository at this point in the history
Data can be pushed by using a "artifacthub:repoid:owner:email" argument.
  • Loading branch information
mlschroe committed Jan 31, 2024
1 parent 3399a18 commit f7ebd91
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/backend/bs_regpush
Expand Up @@ -475,17 +475,20 @@ sub construct_container_tar {
push @tar, {'name' => $blobid, 'file' => $fd, 'mtime' => $mtime, 'offset' => 0, 'size' => (-s $fd)};
}
push @tar, {'name' => 'manifest.json', 'data' => $manifest, 'mtime' => $mtime, 'size' => length($manifest)};
return \@tar;
return (\@tar, $mtime);
}

sub open_tarfile {
my ($tarfile) = @_;

my ($tar, $tarfd, $containerinfo);
if ($tarfile =~ /\.containerinfo$/) {
if ($tarfile =~ /^artifacthub:(.+)/) {
$containerinfo = { 'type' => 'artifacthub', 'artifacthubdata' => $1 };
($tar) = BSContar::container_from_artifacthub($containerinfo->{'artifacthubdata'});
} elsif ($tarfile =~ /\.containerinfo$/) {
my $containerinfo_json = readstr($tarfile);
$containerinfo = JSON::XS::decode_json($containerinfo_json);
$tar = construct_container_tar($containerinfo);
($tar) = construct_container_tar($containerinfo);
} elsif ($tarfile =~ /\.helminfo$/) {
my $chart = $tarfile;
$chart =~ s/\.helminfo$/.tgz/;
Expand Down Expand Up @@ -683,8 +686,8 @@ if ($use_image_tags && @tarfiles > 1) {
$use_image_tags = 0;
}

# use oci types if we have a helm chart
$oci = 1 if grep {/\.helminfo$/} @tarfiles;
# use oci types if we have a helm chart or artifacthub data
$oci = 1 if grep {/\.helminfo$/ || /^artifacthub:/} @tarfiles;

my %digests_to_sign;
my @multimanifests;
Expand Down

0 comments on commit f7ebd91

Please sign in to comment.