Skip to content
Snippets Groups Projects
Commit 98b340f4 authored by Sigmund, Dominik's avatar Sigmund, Dominik
Browse files

Update 2 files

- /.env
- /script.py
parent 3a6b6c3c
Branches main
No related tags found
No related merge requests found
GITLAB_URL=your_gitlab_url
GITLAB_API_TOKEN=your_gitlab_api_token_here
CONFLUENCE_API_TOKEN=your_confluence_api_token_here
\ No newline at end of file
CONFLUENCE_API_TOKEN=your_confluence_api_token_here
SENDER_MAIL=your-sender-mail
RECIPIENT_MAIL=your-recipient-mail
\ No newline at end of file
......@@ -10,11 +10,6 @@ import requests
from dotenv import load_dotenv
gitlab_url = 'https://gitlab.ard.de'
sender_email = 'ard-gitlab-report@br.de'
recipient_email = 'gitlab-oc@cn.ard.de'
def check_binaries():
required_binaries = ['df', 'gitlab-ctl']
missing_binaries = [binary for binary in required_binaries if not shutil.which(binary)]
......@@ -38,7 +33,25 @@ def load_api_token():
print("Error: Confluence API token not found in .env file.")
exit(1)
return api_token, confluence_token
gitlab_url = os.getenv('GITLAB_URL')
if not gitlab_url:
print("Error: Gitlab URL not found in .env file.")
exit(1)
sender_mail = os.getenv('SENDER_MAIL')
if not sender_mail:
print("Error: Sender email address not found in .env file.")
exit(1)
recipient_email = os.getenv('RECIPIENT_MAIL')
if not recipient_email:
print("Error: Recipient email address not found in .env file.")
exit(1)
return api_token, confluence_token, gitlab_url, sender_mail, recipient_email
def get_disk_space():
# Run the df command to get disk space information
......@@ -236,7 +249,7 @@ def create_blog_post(confluence_url, api_token, blog_post_content):
# Check if required binaries are available
check_binaries()
api_token, confluence_token = load_api_token()
api_token, confluence_token, gitlab_url, sender_email, recipient_email = load_api_token()
subject = '[gitlab.ard.de] Monthly Report - {month} {year}'.format(month=datetime.datetime.now().strftime('%B'), year=datetime.datetime.now().strftime('%Y'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment