From 6b32cebaab6a5be4649ebbe3e402294bca023c27 Mon Sep 17 00:00:00 2001 From: Aditya Date: Mon, 25 May 2026 09:55:12 +0530 Subject: [PATCH] fix: continue importing remaining URLs on failure in import-url command Previously the import-url command would exit immediately on the first failed URL, leaving remaining URLs unprocessed. Now all URLs are attempted regardless of individual failures and a non-zero exit code is returned only if any import failed. Closes #399 Signed-off-by: Aditya --- cmd/importURL.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/importURL.go b/cmd/importURL.go index 69c32e8e..61e3c6ac 100644 --- a/cmd/importURL.go +++ b/cmd/importURL.go @@ -95,6 +95,7 @@ func NewImportURLCommand(globalClientOpts *connectors.ClientOptions) *cobra.Comm return } } + var hasErrors bool sepSpecificationFiles := strings.Split(specificationFiles, ",") for _, f := range sepSpecificationFiles { mainArtifact := true @@ -120,11 +121,15 @@ func NewImportURLCommand(globalClientOpts *connectors.ClientOptions) *cobra.Comm // Try downloading the artifcat msg, err := mc.DownloadArtifact(f, mainArtifact, secret) if err != nil { - fmt.Printf("Got error when invoking Microcks client importing Artifact: %s", err) - os.Exit(1) + fmt.Printf("Failed to import '%s': %s\n", f, err) + hasErrors = true + continue } fmt.Printf("Microcks has discovered '%s'\n", msg) } + if hasErrors { + os.Exit(1) + } }, }