Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support standardized output format for argo lint #14035

Open
pakio opened this issue Dec 27, 2024 · 2 comments · May be fixed by #14041
Open

Support standardized output format for argo lint #14035

pakio opened this issue Dec 27, 2024 · 2 comments · May be fixed by #14041
Labels
area/cli The `argo` CLI type/feature Feature request

Comments

@pakio
Copy link

pakio commented Dec 27, 2024

Summary

Support output formatting on argo lint command. Currently, as long as I'm aware of, lint command does not support any of the output formatting but instead it write the error line by line to the stdout/stderr.

example:

/test/hello-world.yaml: in "hello-world-" (Workflow): strict decoding error: unknown field "spec.templates[0].args", unknown field "spec.templates[0].command", unknown field "spec.templates[0].image"
time="2024-12-27T14:45:33.534Z" level=error msg="yaml file at index 0 is not valid: error converting YAML to JSON: yaml: line 15: did not find expected key"

By standardized output formatting I expect to see the output something like this:

{
    "status": "success", # enum: success or error
    "output": [
        {
            "path": "/path/to/file1.yaml",
            "message": "strict decoding error: unknown field...",
            "severity": "error", # enum: info/warning/error
            "start_line": 1,
            "end_line": 5
        },
        {
            "path": "/path/to/file2.yaml",
            "message": "yaml file at index 0 is not valid: error...",
            "severity": "error", # enum: info/warning/error
            "start_line": 15,
            "end_line": 15
        }
    ]
}

Some formats that I'm aware of at this moment but there could be some more

  • custom json format
    • simple yet powerful, can leave some flexibility for the users to write their own post-processing based on the result
  • checkstyle
    • drawback: there's no standardized format for them (issue)
  • annotations object from GitHub api
    • standard format supported by GitHub
    • supports detailed information such as severity and start/end lines where lint error occurred
    • it would be a good fit if somebody considers to integrate with GitHub actions or other CI tools

Use Cases

Main use case that I have in my mind at the moment is to use them in the CI pipeline to automate the lint error reporting. It's already possible to determine whether there was error or not by checking it's exit code, but further information should be checked manually by the users. By supporting standardized format users can automate this process by piping the output to other tools/scripts.


Message from the maintainers:

Love this feature request? Give it a 👍. We prioritise the proposals with the most 👍.

@pakio pakio added the type/feature Feature request label Dec 27, 2024
@pakio pakio changed the title Standardized output format for argo lint Support standardized output format for argo lint Dec 27, 2024
@terrytangyuan
Copy link
Member

Great idea. Would you like to submit a PR?

@pakio
Copy link
Author

pakio commented Dec 27, 2024

Thanks for the quick feedback. and yes, I will submit a PR once it's ready.
I probably go with a simple json format output similar to GitHub api, for future extensibility. any feedback is appreciated.

@blkperl blkperl added the area/cli The `argo` CLI label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli The `argo` CLI type/feature Feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants