Add support for Reference Fix Commits improver#2163
Add support for Reference Fix Commits improver#2163ziadhany wants to merge 8 commits intoaboutcode-org:mainfrom
Conversation
b9b3fe1 to
ae2b35a
Compare
8bf03c1 to
374de5e
Compare
|
Pipeline Logs: |
vulnerabilities/tests/pipelines/v2_improvers/test_reference_collect_commits_v2.py
Outdated
Show resolved
Hide resolved
| None | ||
| """ | ||
| purl = url2purl(url) | ||
| if not purl or purl.type not in VCS_URLS_SUPPORTED_TYPES: |
There was a problem hiding this comment.
What's the reason to do
purl.type not in VCS_URLS_SUPPORTED_TYPES:
When we are already doing url2purl(purl) to ensure we get a package. Also put it in try except block with a logger.
vulnerabilities/pipelines/v2_improvers/reference_collect_commits.py
Outdated
Show resolved
Hide resolved
TG1999
left a comment
There was a problem hiding this comment.
Nits for your consideration
| total_iterations=impacted_packages_advisories.count(), logger=self.log | ||
| ) | ||
| for adv in progress.iter(impacted_packages_advisories.paginated(per_page=500)): | ||
| urls = {r.url for r in adv.references.all()} | {p.patch_url for p in adv.patches.all()} |
There was a problem hiding this comment.
refs = adv.references.values_list("url", flat=True)
patches = adv.patches.values_list("patch_url", flat=True)
urls = set(refs) | set(patches)
Fetch only needed columns ?
There was a problem hiding this comment.
I updated the code @TG1999. I added a prefetch and now only fetching the required columns.
| vcs_url, commit_hash = vcs_data | ||
| package_commit_obj, _ = PackageCommitPatch.objects.get_or_create( | ||
| vcs_url=vcs_url, commit_hash=commit_hash | ||
| ) |
There was a problem hiding this comment.
Can we handle this at bulk level, and avoid get or create and addition in a loop ?
Update the pipeline and fix the test Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
Signed-off-by: ziad hany <ziadhany2016@gmail.com>
db09f78 to
bb4550f
Compare
| total_iterations=impacted_packages_advisories.count(), logger=self.log | ||
| ) | ||
| for adv in progress.iter(impacted_packages_advisories.paginated(per_page=500)): | ||
| urls = {r.url for r in adv.references.all()} | {p.patch_url for p in adv.patches.all()} |
There was a problem hiding this comment.
I updated the code @TG1999. I added a prefetch and now only fetching the required columns.
Issue: