Skip to content

Commit 6bef1a2

Browse files
PeaceRebeljlebon
authored andcommitted
cmd/import: copy file if image source is ociarchive
Import command can do a simple of ociarchive instead of importing each layer. Output of cosa build using podman/buildah is an ociarchive and this can be leveraged there.
1 parent bf41ab7 commit 6bef1a2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cmd-import

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ def parse_args():
6565

6666
def generate_oci_archive(args, tmpd):
6767
tmpf = os.path.join(tmpd, 'out.ociarchive')
68-
subprocess.check_call(['skopeo', 'copy', '--preserve-digests', args.srcimg,
68+
69+
if args.srcimg.startswith('oci-archive:'):
70+
print(f"Copying {args.srcimg.partition(':')[2]} to {tmpf}")
71+
shutil.copy(args.srcimg.partition(':')[2], tmpf)
72+
else:
73+
subprocess.check_call(['skopeo', 'copy', '--preserve-digests', args.srcimg,
6974
f"oci-archive:{tmpf}"])
7075
return tmpf
7176

0 commit comments

Comments
 (0)