Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
spbro
OpenXG-RAN
Commits
c77a4eb7
Commit
c77a4eb7
authored
Jan 26, 2022
by
hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create aws clean function to get rid of closed MR results
parent
4d1bda01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
0 deletions
+28
-0
ci-scripts/ran_dashboard/Hdashboard.py
ci-scripts/ran_dashboard/Hdashboard.py
+28
-0
No files found.
ci-scripts/ran_dashboard/Hdashboard.py
View file @
c77a4eb7
...
...
@@ -544,6 +544,30 @@ class Dashboard:
})
editable_mr
.
save
()
def
AWSCleanup
(
self
,
mode
):
#first build MR list from aws S3 bucket
if
mode
!=
'report'
and
mode
!=
'delete'
:
print
(
"incorrect mode for awsclean"
)
return
aws_mr_list
=
[]
s3
=
boto3
.
resource
(
's3'
)
my_bucket
=
s3
.
Bucket
(
'oaitestdashboard'
)
for
my_bucket_object
in
my_bucket
.
objects
.
all
():
#MR objects are like MR1407/index.html
res
=
re
.
search
(
r'^MR([0-9]+)'
,
my_bucket_object
.
key
)
if
res
!=
None
:
aws_mr_list
.
append
(
res
.
group
(
1
))
#store MR number as a string
#open MR list from GIt already exists as an attribute of this class self.mr_list
#parse aws MR list and delete those MR that are no longer open
for
aws_mr
in
aws_mr_list
:
if
aws_mr
not
in
self
.
mr_list
:
if
mode
==
"report"
:
print
(
aws_mr
+
' can be deleted from AWS S3'
)
else
:
awspath
=
"MR"
+
aws_mr
+
"/"
print
(
'deleting '
+
aws_mr
)
my_bucket
.
objects
.
filter
(
Prefix
=
awspath
).
delete
()
...
...
@@ -579,6 +603,10 @@ def main():
htmlDash
.
PostGitNote
(
mr
,
commit
,
args
)
else
:
print
(
"Not a Merge Request => this build is for testing/debug purpose, no report to git"
)
elif
sys
.
argv
[
1
]
==
"awsclean"
:
mode
=
sys
.
argv
[
2
]
#report or delete
htmlDash
=
Dashboard
()
htmlDash
.
AWSCleanup
(
mode
)
else
:
print
(
"Wrong argument at position 1"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment