Skip to content

Commit

Permalink
incorporate main branch checks
Browse files Browse the repository at this point in the history
  • Loading branch information
rkpattnaik780 committed Jan 3, 2024
1 parent 38d3b0d commit 9bea990
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
35 changes: 34 additions & 1 deletion ci/security-scan/quay_security_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@

commit_id_path = "ci/security-scan/weekly_commit_ids.env"

IMAGES_MAIN = [
"odh-minimal-notebook-image-main",
"odh-runtime-minimal-notebook-image-main",
"odh-runtime-data-science-notebook-image-main",
"odh-minimal-gpu-notebook-image-main",
"odh-pytorch-gpu-notebook-image-main",
"odh-generic-data-science-notebook-image-main",
"odh-tensorflow-gpu-notebook-image-main",
"odh-trustyai-notebook-image-main",
"odh-habana-notebook-image-main",
"odh-codeserver-notebook-main",
"odh-rstudio-notebook-main",
"odh-rstudio-gpu-notebook-main"
]

IMAGES = [
"odh-minimal-notebook-image-n",
Expand Down Expand Up @@ -114,6 +128,19 @@ def process_image(image, commit_id_path, RELEASE_VERSION_N, HASH_N):
RELEASE_VERSION_N = os.environ['RELEASE_VERSION_N']
HASH_N = os.environ['HASH_N']

for i, image in enumerate(IMAGES_MAIN):
process_image(image, commit_id_path, "", "0133259")

branch_main_data = ""
for key, value in my_dictionary.items():
branch_main_data += f"| [{key}](https://quay.io/repository/opendatahub/workbench-images/manifest/{my_dictionary[key]['sha']}?tab=vulnerabilities) |"
for severity in ['Medium', 'Low', 'Unknown', 'High', 'Critical']:
count = value.get(severity, 0) # Get count for the severity, default to 0 if not present
branch_main_data += f" {count} |"
branch_main_data += "\n"

my_dictionary = {}

# Call the function for each image in IMAGES
for i, image in enumerate(IMAGES):
process_image(image, commit_id_path, RELEASE_VERSION_N, HASH_N)
Expand Down Expand Up @@ -149,6 +176,12 @@ def process_image(image, commit_id_path, RELEASE_VERSION_N, HASH_N):
Date: {todays_date}
# Branch main
| Image Name | Medium | Low | Unknown | High | Critical |
|------------|-------|-----|---------|------|------|
{branch_main}
# Branch N
| Image Name | Medium | Low | Unknown | High | Critical |
Expand All @@ -162,7 +195,7 @@ def process_image(image, commit_id_path, RELEASE_VERSION_N, HASH_N):
{branch_n}
"""

final_markdown = markdown_content.format(table_content=formatted_data, todays_date=d2, branch_n=branch_n_data)
final_markdown = markdown_content.format(table_content=formatted_data, todays_date=d2, branch_n=branch_n_data, branch_main=branch_main_data)

# Writing to the markdown file
with open("ci/security-scan/security_scan_results.md", "w") as markdown_file:
Expand Down
1 change: 1 addition & 0 deletions ci/security-scan/weekly_commit_ids.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ odh-trustyai-notebook-image-n=quay.io/opendatahub/workbench-images@sha256:bf2087
odh-trustyai-notebook-image-n-1=quay.io/opendatahub/workbench-images@sha256:5b5bae7a11f2e34b67726a86d24b8f2c35c701a48d80abbdbc91030033d2fc1f
odh-habana-notebook-image-main=quay.io/opendatahub/workbench-images@sha256:f5237ad45f84a9adfc5e30d6fab809dcd7fd10dc9048b3c82f8dfe71d2d7eb2c
odh-habana-notebook-image-n=quay.io/opendatahub/workbench-images@sha256:b0821ae2abe45387a371108ac08e7474b64255e5c4519de5da594b4617fd79fe
odh-codeserver-notebook-main=quay.io/opendatahub/workbench-images@sha256:2797380eaf0f05d6002e9fbb41a6a8b5368b658230ba46b07341c9c96797f591
odh-codeserver-notebook-n=quay.io/opendatahub/workbench-images@sha256:1c5bcbfc222dfb59849fee67e050719c688c93d3608f7b46edbe5666263641f3
odh-codeserver-notebook-n-1=quay.io/opendatahub/workbench-images@sha256:fd5b9f65c0f46d4c093e2f58fce305eeb125bf19ee1d88f67b9fafe56142e92d
odh-rstudio-notebook-main=quay.io/opendatahub/workbench-images@sha256:cffcf81ca0dba140d3dfc5ab452eebd6db92e55da5bdfbe3f931661489a8a596
Expand Down

0 comments on commit 9bea990

Please sign in to comment.