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 JUnit XML output format #928

Closed
sebhoss opened this issue Jul 21, 2024 · 8 comments · Fixed by #929
Closed

support JUnit XML output format #928

sebhoss opened this issue Jul 21, 2024 · 8 comments · Fixed by #929
Labels

Comments

@sebhoss
Copy link
Contributor

sebhoss commented Jul 21, 2024

It would be nice to allow outputting linting results as JUnit XML because that can be parsed directly by GitLab and shown in merge requests.

@anderseknert
Copy link
Member

Hi there, @sebhoss! JUnit XML doesn't strike me as the optimal output format for a linter, but if it helps integrating Regal in GitLab, we can probably be pragmatic about it. Do you know of any other linters that do this? Or even better, links (or I guess, screenshots) to merge requests where this can be seen in action?

It's been a while, but I remember how we've looked into various integration options for GitLab in the past, and none of them felt great compared to the ease of which this could be done for GitHub. I'm not sure we looked at using JUnit output though. If we can include links to the Regal docs in the output, that'd be one pretty nice advantage compared to the GitHub integration.

@anderseknert
Copy link
Member

We have some code in OPA contrib to turn OPA's JSON output from tests into JUnit XML here. I guess we could do something similar here just in order to test it out first.

@sebhoss
Copy link
Contributor Author

sebhoss commented Jul 21, 2024

Yeah I agree that the JUnit format is not ideal for linters, but it is kinda flexible and well supported across various tools/platforms. I recently helped getting a similar feature request merged for kube-score in zegl/kube-score#603 and used https://github.com/jstemmer/go-junit-report for that. conftest does support JUnit output as well. The integration in GitLab is described here. I think you should be able to include links to the Regal docs in the optional message for each failure just fine.

@anderseknert
Copy link
Member

Thanks! I still have a week of vacation before I’m back in full capacity but I can take a look at this once I’m back. And of course, if you’d want to work on this yourself, then by all means go ahead! The reporters are quite straightforward to work with, so no deep knowledge of Regal required. I’d be happy to answer any questions along the way.

@sebhoss
Copy link
Contributor Author

sebhoss commented Jul 21, 2024

Ok created #929 for that - happy to incorporate any feedback you have!

@anderseknert
Copy link
Member

Awesome! I'll have a look right away.

@sebhoss
Copy link
Contributor Author

sebhoss commented Jul 21, 2024

Thanks! I'm about to call it a day so replies from my side might be late but I'll check again tomorrow ^^

@anderseknert
Copy link
Member

I've just reviewed, but no stress! We just pushed a release last week, so there's plenty of time until the next one :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants