From bc7a2e60f25dad66e0fbdee287b1b43b4277dabc Mon Sep 17 00:00:00 2001 From: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com> Date: Wed, 26 Jun 2024 21:34:16 +0530 Subject: [PATCH] Did fix on type errors Signed-off-by: hansinikarunarathne <107214435+hansinikarunarathne@users.noreply.github.com> --- .github/workflows/trivy.yaml | 9 ++++++++- hack/trivy_scan.py | 10 +++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/trivy.yaml b/.github/workflows/trivy.yaml index 9d6bb72d96..bcae8bc336 100644 --- a/.github/workflows/trivy.yaml +++ b/.github/workflows/trivy.yaml @@ -38,8 +38,15 @@ jobs: run: | pip install prettytable - # Run the python script (trivy_scan.py) - name: Run image extracting and security scanning script run: | cd hack python3 trivy_scan.py + + - name: Upload trivy scanned_results + uses: actions/upload-artifact@v4 + with: + name: trivy_scanned_results + path: image_lists/ + + diff --git a/hack/trivy_scan.py b/hack/trivy_scan.py index 84f8d19284..216c5b76f9 100644 --- a/hack/trivy_scan.py +++ b/hack/trivy_scan.py @@ -141,10 +141,10 @@ def extract_images(version): image_name_scan = image_name.split('/')[-1] - scan_output_file = os.path.join(file_reports_dir, f"{image_name_scan}_scan.json") - if image_tag: - image_name_scan = f"{image_name_scan}:{image_tag}" + image_name_scan = f"{image_name_scan}_{image_tag}" + + scan_output_file = os.path.join(file_reports_dir, f"{image_name_scan}_scan.json") log(f"Scanning ",line, flush=True) @@ -190,7 +190,7 @@ def extract_images(version): severity_counts["MEDIUM"], severity_counts["LOW"] ]) - log(image_table , flush=True) + log(f"{image_table}\n") severity_report_file = os.path.join(severity_count, f"{image_name_scan}_severity_report.json") with open(severity_report_file, 'w') as report_file: @@ -331,5 +331,5 @@ def extract_images(version): f.write(str(table)) log("Output saved to:", output_file, flush=True) -log("Severirty counts with images respect to WGs are saved in the" ,ALL_SEVERITY_COUNTS, flush=True) +log("Severity counts with images respect to WGs are saved in the",ALL_SEVERITY_COUNTS, flush=True) log("Scanned Json reports on images are saved in" ,SCAN_REPORTS_DIR, flush=True) \ No newline at end of file