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

snyk: added snyk stats to metadata #153

Merged
merged 1 commit into from
Feb 28, 2024
Merged

Conversation

jperezdealgaba
Copy link
Collaborator

Related: https://issues.redhat.com/browse/OSH-347
Reproducer: csmock -t snyk --force -r rhel-8-x86_64 osbuild-106-1.el10+4.src.rpm

Added the stats from snyk results (snyk coverage rate, analyzed files and total of files) to the metadata file.

py/common/snyk.py Fixed Show fixed Hide fixed
py/common/snyk.py Fixed Show fixed Hide fixed
py/plugins/snyk.py Show resolved Hide resolved
props.post_process_hooks += [filter_hook]
def write_snyk_stats_metadata(results):
results_file = results.dbgdir_raw + SNYK_OUTPUT
return snyk_write_analysis_meta(results, results_file)
Copy link
Collaborator Author

@jperezdealgaba jperezdealgaba Feb 20, 2024

Choose a reason for hiding this comment

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

Note: In the future, the results_file variable should always be the same path, but until the chroot/snyk problem is not solved, we need to have two different paths.

py/common/snyk.py Fixed Show fixed Hide fixed
Copy link
Member

@kdudka kdudka left a comment

Choose a reason for hiding this comment

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

The newly introduced module needs to be installed by CMake to keep the RPM packaging (or local installations) working:

# install common python modules to the csmock/common subdirectory

py/common/snyk.py Outdated Show resolved Hide resolved
py/plugins/snyk.py Outdated Show resolved Hide resolved
@kdudka
Copy link
Member

kdudka commented Feb 26, 2024

The newly introduced module needs to be installed by CMake...

@jperezdealgaba Note that this problem had already been revealed by the failing CI tests.

py/common/snyk.py Fixed Show fixed Hide fixed

def snyk_write_analysis_meta(results, raw_results_file):
try:
with open(raw_results_file) as snyk_results_file:

Check warning

Code scanning / vcs-diff-lint

snyk_write_analysis_meta: Using open without explicitly specifying an encoding Warning

snyk_write_analysis_meta: Using open without explicitly specifying an encoding
py/CMakeLists.txt Show resolved Hide resolved
py/common/snyk.py Outdated Show resolved Hide resolved
py/common/snyk.py Outdated Show resolved Hide resolved
py/common/snyk.py Outdated Show resolved Hide resolved
Related: https://issues.redhat.com/browse/OSH-347
Reproducer: csmock -t snyk --force -r rhel-8-x86_64 osbuild-106-1.el10+4.src.rpm

Added the stats from snyk results (snyk coverage rate, analyzed files and total of files) to the metadata file.
@@ -0,0 +1,52 @@
# Copyright (C) 2024 Red Hat, Inc.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@kdudka I have updated the license header to refer to 2024. Should I do another commit to update plugin/snyk header?

Copy link
Member

Choose a reason for hiding this comment

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

@jperezdealgaba Thanks! I do not think it is critical. We may eventually migrate csutils to use the two-lines SPDX license headers like we did for OSH: openscanhub/openscanhub@3115651

@lzaoral What do you think about it?

Copy link
Member

Choose a reason for hiding this comment

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

@kdudka It is not necessary.

Copy link
Member

Choose a reason for hiding this comment

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

@lzaoral Sure. I was just thinking about modernization of csutils so that we do not waste time on maintaining the legacy GPL headers in source code files.

Copy link
Member

Choose a reason for hiding this comment

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

@kdudka I was reacting to @jperezdealgaba's idea.

Of course, I agree with modernisation of licensing information.

Copy link
Member

@kdudka kdudka left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for the update!

@kdudka kdudka self-assigned this Feb 28, 2024
@kdudka kdudka merged commit 802bbf3 into csutils:main Feb 28, 2024
42 of 43 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.

3 participants