fix: import-url command exits early on first failure when importing multiple URLs

Open Beginner friendly
#399 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go
Domain
cli

Research direction

Start with cmd/importURL.go and compare the corresponding fix in PR #394 for the import command. Update the import-url loop so every URL is attempted and the command exits with code 1 only when at least one import fails. Verify that later URLs are still processed after an earlier failure.

Written by the indexing model from the issue text.

Description

Why we need this:
When importing multiple comma-separated URLs, if one URL fails,
the command immediately exits and remaining URLs are never imported.
This is the same issue that was fixed in the import command in PR #394.

How this will help:
All URLs should be attempted regardless of individual failures,
giving users complete feedback in one run.

Motivation:
Consistent behavior across all import commands (import, import-url).

Problem

When running:
microcks import-url "https://url1.yaml,https://url2.yaml,https://url3.yaml"

If url1 fails, os.Exit(1) is called immediately inside the loop
and url2, url3 are never imported.

Looking at cmd/importURL.go:
for _, f := range sepSpecificationFiles {
msg, err := mc.DownloadArtifact(f, mainArtifact, secret)
if err != nil {
os.Exit(1) // exits immediately, remaining URLs skipped
}
}

Same bug as #393, fixed in import command via PR #394.

Fix

  • Collect errors instead of exiting immediately
  • Attempt all URLs regardless of individual failures
  • Exit with code 1 only if any URL failed
Dominant language
Go
Stars
52
Forks
67
Avg merge
1d 1h
Merged PRs (30d)
13

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microcks/microcks-cli

All issues in microcks/microcks-cli

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.