From a8b484b2031cf05ec1b6b20f7193ab68c7735ff1 Mon Sep 17 00:00:00 2001 From: Ed Ganiukov Date: Mon, 30 Dec 2024 14:47:07 +0100 Subject: [PATCH] buildbinary: support comma-separated list of base repositories (#1363) --- internal/cli/cmd/buildbinary.go | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/internal/cli/cmd/buildbinary.go b/internal/cli/cmd/buildbinary.go index e586ea5db..b8f41b0f3 100644 --- a/internal/cli/cmd/buildbinary.go +++ b/internal/cli/cmd/buildbinary.go @@ -143,20 +143,22 @@ func buildLocations(ctx context.Context, env cfg.Context, reg registry.Manager, for _, image := range resolvables { var repository compute.Computable[oci.RepositoryWithParent] - if baseRepository != "" { - repository = registry.StaticRepository(nil, filepath.Join(baseRepository, pkg.PackageName().String()), oci.RegistryAccess{}) - } else { - repository = reg.AllocateName(pkg.PackageName().String(), userTag) + for _, bp := range strings.Split(baseRepository, ",") { + if bp != "" { + repository = registry.StaticRepository(nil, filepath.Join(bp, pkg.PackageName().String()), oci.RegistryAccess{}) + } else { + repository = reg.AllocateName(pkg.PackageName().String(), userTag) + } + + var img compute.Computable[oci.ImageID] + if opts.publishToDocker { + img = docker.PublishImage(repository, image) + } else { + img = oci.PublishResolvable(repository, image, nil) + } + + images = append(images, fromImage(pkg.PackageName(), img)) } - - var img compute.Computable[oci.ImageID] - if opts.publishToDocker { - img = docker.PublishImage(repository, image) - } else { - img = oci.PublishResolvable(repository, image, nil) - } - - images = append(images, fromImage(pkg.PackageName(), img)) } }