Skip to content

Commit

Permalink
ci: test
Browse files Browse the repository at this point in the history
Signed-off-by: r3drun3 <[email protected]>
  • Loading branch information
R3DRUN3 committed Jan 10, 2024
1 parent adf4d39 commit 2d57c05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fail-fast: false
matrix:
# provide relevant list of images to scan on each run
images: ['docker.io/library/nginx:1.21.6', 'docker.io/openpolicyagent/opa:0.46.0']
images: ['docker.io/library/nginx:1.21.6', 'docker.io/openpolicyagent/opa:0.46.0', 'docker.io/python:3.9.18-slim-bullseye']

# outputs:
# # Expose the 'images' array as an output
Expand Down
21 changes: 9 additions & 12 deletions send_mail_report.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
import os
import yaml
#import html
import smtplib
from datetime import datetime
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart


# Get the path to the YAML file
# Get the path to the Github Action YAML file
yaml_file_path = os.path.join(os.path.dirname(__file__), '.github/workflows/patch.yaml')

# Read the YAML file to get the patched image list
Expand All @@ -15,17 +15,14 @@
patched_images = yaml_content.get('jobs', {}).get('immunize', {}).get('strategy', {}).get('matrix', {}).get('images', [])

print("Patched images:", patched_images)
# Get the current timestamp
current_timestamp = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
current_timestamp = datetime.now().strftime('%Y-%m-%d')
# Prepare the HTML content
subject = 'IMMUNIZE: Patched Image Report'
html_body = '<h2>Patched Images πŸ’‰- {}</h2><ul>'.format(current_timestamp)
html_body = '<h2>Patched Images πŸ’‰ {}</h2><ul>'.format(current_timestamp)
for image in patched_images:
# encoded_image_name = html.escape(image)
github_link = f'https://github.com/r3drun3/pkgs/container/immunize/{image}'
html_body += f'<li>{image}</li>'
html_body += '</ul><br />'
html_body += 'check the full catalog <a href="https://github.com/R3DRUN3?tab=packages&repo_name=immunize">here</a>'
html_body += 'check the full catalog πŸ“š <a href="https://github.com/R3DRUN3?tab=packages&repo_name=immunize">here</a> !'

# Get email and password from GitHub secrets
email_address = os.environ.get('EMAIL_ADDRESS', '')
Expand All @@ -47,4 +44,4 @@
server.login(email_address, email_password)
server.sendmail(email_address, recipients, message.as_string())

print('Email sent successfully!')
print('Emails sent successfully!')

0 comments on commit 2d57c05

Please sign in to comment.