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

Added new reporter: MARKDOWN_SUMMARY Reporter #3250

Merged
merged 10 commits into from Dec 28, 2023
Merged

Added new reporter: MARKDOWN_SUMMARY Reporter #3250

merged 10 commits into from Dec 28, 2023

Conversation

saishivarcr
Copy link
Contributor

@saishivarcr saishivarcr commented Dec 27, 2023

New reporter MARKDOWN_SUMMARY_REPORTER, allows saving MegaLinter results summary as a markdown file. This file can be further utilised to add comments on the pull request (PR) from Jenkins and other continuous integration (CI) tools.

@echoix
Copy link
Collaborator

echoix commented Dec 27, 2023

Do you use or intend to use it with Jenkins? I think you could expand on the use cases in your documentation for better discovery.

I see another useful use-case with this: something that implements #1489

I once tried to start it, but only finished the research phase.
https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/
https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary

The only missing change to enable this functionality would be to check if the GITHUB_STEP_SUMMARY env var exists, and if so, save the Markdown file there.

@nvuillam
Copy link
Member

nvuillam commented Dec 27, 2023

@saishivarcr thanks a lot for your PR :)

we already have reporters for Github, Gitlab & Azure (and probably bitbucket someday) -> https://megalinter.io/latest/reporters/

If it is for jenkins purpose, why not some JENKINS_COMMENT_REPORTER, that would handle the overwrite on existing comment etc... like the other CI platforms reporters ? ( or even a standalone Jenkins Plugin ? 👼 )

Otherwise, I'm ok to merge your PR, but with the following pre-requisites:

  • rename it as MARKDOWN_SUMMARY_REPORTER
  • deactivate it by default, except if you find a way to post it by default as Job Summary like suggested by @echoix :)

@saishivarcr
Copy link
Contributor Author

Thanks @echoix for providing your feedback.

Do you use or intend to use it with Jenkins? I think you could expand on the use cases in your documentation for better discovery.

Yes, my primary use case is to post the job summary as a PR comment from the Jenkins pipeline job. Once the summary report is available in markdown format, one can write a custom script to post it to Bitbucket or other repository hosting platforms (non-Github/Gitlab) without waiting for such functionality to be made officially available.

I see another useful use-case with this: something that implements #1489

I once tried to start it, but only finished the research phase. https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/ https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary

The only missing change to enable this functionality would be to check if the GITHUB_STEP_SUMMARY env var exists, and if so, save the Markdown file there.

Yes, this use case can now be covered easily with minimal enhancements. I will work on this in a separate PR.

@saishivarcr
Copy link
Contributor Author

Thanks @nvuillam for your feedback.

If it is for jenkins purpose, why not some JENKINS_COMMENT_REPORTER, that would handle the overwrite on existing comment etc... like the other CI platforms reporters ? ( or even a standalone Jenkins Plugin ? 👼 )

I wanted to make it generic and not tied to either Jenkins or other CI platforms. The Jenkins plugin is a great idea, but I don't have much experience in developing one. This can be considered for further enhancements in upcoming versions.

  • rename it as MARKDOWN_SUMMARY_REPORTER

Yes, this is a good suggestion; I will make this change.

  • deactivate it by default, except if you find a way to post it by default as Job Summary like suggested by @echoix :)

By default, this feature is deactivated. Could you kindly verify this once again through a code review on your end?

@nvuillam
Copy link
Member

@saishivarcr I already checked your code and it seems right to me, so once the renaming done, I'll merge then it'll be shipped in the next release 🥳 🎈

megalinter/constants.py Outdated Show resolved Hide resolved
@saishivarcr saishivarcr changed the title Added new reporter: SUMMARY Reporter Added new reporter: MARKDOWN_SUMMARY Reporter Dec 27, 2023
Copy link
Member

@nvuillam nvuillam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, many thanks :)
Plz check comments for tiny updates :)

Copy link
Member

@nvuillam nvuillam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great :)

@nvuillam nvuillam merged commit 40eb95c into oxsecurity:main Dec 28, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants