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
lizhongxiao
OpenXG-RAN
Commits
4b7de394
Commit
4b7de394
authored
Oct 15, 2021
by
hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add last_pass
parent
8ccb745d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
10 deletions
+58
-10
ci-scripts/ran_dashboard/ran_dashboard.py
ci-scripts/ran_dashboard/ran_dashboard.py
+14
-9
ci-scripts/ran_dashboard/sqlconnect.py
ci-scripts/ran_dashboard/sqlconnect.py
+44
-1
No files found.
ci-scripts/ran_dashboard/ran_dashboard.py
View file @
4b7de394
...
...
@@ -30,6 +30,8 @@
# Import
#-----------------------------------------------------------
#author Remi
#import google spreadsheet API
import
gspread
from
oauth2client.service_account
import
ServiceAccountCredentials
...
...
@@ -110,12 +112,13 @@ class gDashboard:
###line 3 is for the column names
i
=
3
row
=
[
"MR"
,
"Created_at"
,
"Author"
,
"Title"
,
"Assignee"
,
"Reviewer"
,
"CAN START"
,
"IN PROGRESS"
,
"COMPLETED"
,
"Review Form"
,
"OK MERGE"
,
"Merge conflicts"
]
row
=
[
"MR"
,
"Created_at"
,
"Author"
,
"Title"
,
"Assignee"
,
"Reviewer"
,
"CAN START"
,
"IN PROGRESS"
,
"COMPLETED"
,
"Review Form"
,
"OK MERGE"
,
"Merge conflicts"
,
""
]
#tests
for
t
in
range
(
0
,
len
(
self
.
tests
)):
row
.
append
(
"# PASS"
)
row
.
append
(
"# FAIL"
)
row
.
append
(
"Last Pass"
)
row
.
append
(
"Last Fail"
)
self
.
sheet
.
insert_row
(
row
,
index
=
i
,
value_input_option
=
'RAW'
)
...
...
@@ -182,7 +185,7 @@ class gDashboard:
#build final row to be inserted, the first column is left empty for now, will be filled afterward with hyperlinks to gitlab MR
row
=
[
""
,
str
(
date_time_obj
.
date
()),
str
(
self
.
git
[
x
][
'author'
][
'name'
]),
str
(
self
.
git
[
x
][
'title'
]),
\
assignee
,
reviewer
,
\
milestone1
,
milestone2
,
milestone3
,
review_form
,
milestone4
,
conflicts
]
milestone1
,
milestone2
,
milestone3
,
review_form
,
milestone4
,
conflicts
,
""
]
#and append the test results coming from self.db
mr
=
str
(
self
.
git
[
x
][
'iid'
])
for
t
in
self
.
tests
:
...
...
@@ -205,7 +208,7 @@ class gDashboard:
#insert the final row to worksheet
self
.
sheet
.
insert_row
(
row
,
index
=
i
,
value_input_option
=
'RAW'
)
time
.
sleep
(
2
0
)
time
.
sleep
(
1
0
)
#add MR hyperlinks in a list of requests to be sent as one update batch; this to save API calls (quotas)
...
...
@@ -223,15 +226,17 @@ class gDashboard:
for
t
in
self
.
tests
:
job
=
self
.
tests
[
t
][
'job'
]
if
job
in
self
.
db
[
mr
]:
if
len
(
self
.
db
[
mr
][
job
][
'last_pass'
])
>
0
:
hyperlink
=
'
\"
'
+
self
.
db
[
mr
][
job
][
'last_pass'
][
1
]
+
'
\"
'
text
=
'
\"
'
+
self
.
db
[
mr
][
job
][
'last_pass'
][
0
]
+
'"'
requests
.
append
(
self
.
addHyperlink
(
hyperlink
,
text
,
destinationSheetName
,
rowIndex
,
colIndex
))
if
len
(
self
.
db
[
mr
][
job
][
'last_fail'
])
>
0
:
hyperlink
=
'
\"
'
+
self
.
db
[
mr
][
job
][
'last_fail'
][
1
]
+
'
\"
'
text
=
'
\"
'
+
self
.
db
[
mr
][
job
][
'last_fail'
][
0
]
+
'"'
requests
.
append
(
self
.
addHyperlink
(
hyperlink
,
text
,
destinationSheetName
,
rowIndex
,
colIndex
))
colIndex
+=
3
requests
.
append
(
self
.
addHyperlink
(
hyperlink
,
text
,
destinationSheetName
,
rowIndex
,
colIndex
+
1
))
colIndex
+=
4
#move to next test
i
=
i
+
1
#increment row index for next MR
body
=
{
"requests"
:
requests
}
self
.
ss
.
batch_update
(
body
)
...
...
@@ -292,14 +297,14 @@ class gDashboard:
"startRowIndex"
:
1
,
"endRowIndex"
:
40
,
"startColumnIndex"
:
0
,
"endColumnIndex"
:
26
"endColumnIndex"
:
30
},
"destination"
:
{
"sheetId"
:
destinationSheetId
,
"startRowIndex"
:
1
,
"endRowIndex"
:
40
,
"startColumnIndex"
:
0
,
"endColumnIndex"
:
26
"endColumnIndex"
:
30
},
"pasteType"
:
"PASTE_FORMAT"
}
...
...
ci-scripts/ran_dashboard/sqlconnect.py
View file @
4b7de394
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#---------------------------------------------------------------------
# Merge Requests Dashboard for RAN on googleSheet
#
# Required Python Version
# Python 3.x
#
#---------------------------------------------------------------------
#author Remi
import
pymysql
import
sys
from
datetime
import
datetime
import
pickle
#This is the script/package used by the dashboard to retrieve the MR test results from the database
class
SQLConnect
:
...
...
@@ -55,6 +85,19 @@ class SQLConnect:
self
.
data
[
MR
][
test
][
'last_fail'
].
append
(
build
)
self
.
data
[
MR
][
test
][
'last_fail'
].
append
(
link
)
#get last passing build and link
sql
=
"select TEST,BUILD, BUILD_LINK from test_results where MR=(%s) and STATUS='PASS' order by DATE DESC;"
cur
.
execute
(
sql
,
MR
)
response
=
cur
.
fetchall
()
if
len
(
response
)
!=
0
:
for
i
in
range
(
0
,
len
(
response
)):
test
=
response
[
i
][
0
]
build
=
response
[
i
][
1
]
link
=
response
[
i
][
2
]
if
'last_pass'
not
in
self
.
data
[
MR
][
test
]:
self
.
data
[
MR
][
test
][
'last_pass'
]
=
[]
self
.
data
[
MR
][
test
][
'last_pass'
].
append
(
build
)
self
.
data
[
MR
][
test
][
'last_pass'
].
append
(
link
)
#close database connection
...
...
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