microcks / microcks/microcks-cli
fix: import-url command exits early on first failure when importing multiple URLs
- Dominant language
- Go
- Stars
- 52
- Forks
- 68
- Avg merge
- 6h 54m
- Merged PRs (30d)
- 10
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
Contributor guide
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.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100