Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab-report
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tools
gitlab-report
Commits
98b340f4
Commit
98b340f4
authored
Jul 31, 2023
by
Sigmund, Dominik
Browse files
Options
Downloads
Patches
Plain Diff
Update 2 files
- /.env - /script.py
parent
3a6b6c3c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.env
+4
-1
4 additions, 1 deletion
.env
script.py
+20
-7
20 additions, 7 deletions
script.py
with
24 additions
and
8 deletions
.env
+
4
−
1
View file @
98b340f4
GITLAB_URL=your_gitlab_url
GITLAB_API_TOKEN=your_gitlab_api_token_here
GITLAB_API_TOKEN=your_gitlab_api_token_here
CONFLUENCE_API_TOKEN=your_confluence_api_token_here
CONFLUENCE_API_TOKEN=your_confluence_api_token_here
SENDER_MAIL=your-sender-mail
RECIPIENT_MAIL=your-recipient-mail
\ No newline at end of file
This diff is collapsed.
Click to expand it.
script.py
+
20
−
7
View file @
98b340f4
...
@@ -10,11 +10,6 @@ import requests
...
@@ -10,11 +10,6 @@ import requests
from
dotenv
import
load_dotenv
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
():
def
check_binaries
():
required_binaries
=
[
'
df
'
,
'
gitlab-ctl
'
]
required_binaries
=
[
'
df
'
,
'
gitlab-ctl
'
]
missing_binaries
=
[
binary
for
binary
in
required_binaries
if
not
shutil
.
which
(
binary
)]
missing_binaries
=
[
binary
for
binary
in
required_binaries
if
not
shutil
.
which
(
binary
)]
...
@@ -38,7 +33,25 @@ def load_api_token():
...
@@ -38,7 +33,25 @@ def load_api_token():
print
(
"
Error: Confluence API token not found in .env file.
"
)
print
(
"
Error: Confluence API token not found in .env file.
"
)
exit
(
1
)
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
():
def
get_disk_space
():
# Run the df command to get disk space information
# Run the df command to get disk space information
...
@@ -236,7 +249,7 @@ def create_blog_post(confluence_url, api_token, blog_post_content):
...
@@ -236,7 +249,7 @@ def create_blog_post(confluence_url, api_token, blog_post_content):
# Check if required binaries are available
# Check if required binaries are available
check_binaries
()
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
'
))
subject
=
'
[gitlab.ard.de] Monthly Report - {month} {year}
'
.
format
(
month
=
datetime
.
datetime
.
now
().
strftime
(
'
%B
'
),
year
=
datetime
.
datetime
.
now
().
strftime
(
'
%Y
'
))
...
...
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment