You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The import-dir command scans a directory and attempts to import all matching files. If one or more files fail to import, it records the failure in ImportResult.FailedCount and prints an error message. However, the command runner does not check the failed count to return a non-zero exit code.
Impact
In CI/CD environments (GitHub Actions, Tekton, GitLab CI), the CLI exits with status 0, indicating success even if all API specifications failed to import. This hides deployment failures.
Code Reference
cmd/importDir.go
Diagram
graph TD
A[Start import-dir] --> B[Scan Directory]
B --> C[Import File 1: Success]
B --> D[Import File 2: FAILED]
C & D --> E[Display Results Summary]
E --> F["Exit Status Code 0 (Success)"]
F --> G["CI/CD pipeline reports green/success despite failures"]
Loading
Steps to Reproduce
Run microcks import-dir ./specs where at least one spec has invalid content.
The console displays ✗ Failed: ....
Check the exit code of the process (echo $? or $LASTEXITCODE in PowerShell). It returns 0.
Describe the bug
Description
The
import-dircommand scans a directory and attempts to import all matching files. If one or more files fail to import, it records the failure inImportResult.FailedCountand prints an error message. However, the command runner does not check the failed count to return a non-zero exit code.Impact
In CI/CD environments (GitHub Actions, Tekton, GitLab CI), the CLI exits with status
0, indicating success even if all API specifications failed to import. This hides deployment failures.Code Reference
Diagram
graph TD A[Start import-dir] --> B[Scan Directory] B --> C[Import File 1: Success] B --> D[Import File 2: FAILED] C & D --> E[Display Results Summary] E --> F["Exit Status Code 0 (Success)"] F --> G["CI/CD pipeline reports green/success despite failures"]Steps to Reproduce
microcks import-dir ./specswhere at least one spec has invalid content.✗ Failed: ....echo $?or$LASTEXITCODEin PowerShell). It returns0.