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
d4e13596
Commit
d4e13596
authored
Oct 10, 2021
by
hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
major update / refactoring for ran dashboard, including mysql db and test results table
parent
0aa06742
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
210 additions
and
78 deletions
+210
-78
ci-scripts/mysql4testresults/docker-compose.yml
ci-scripts/mysql4testresults/docker-compose.yml
+12
-0
ci-scripts/mysql4testresults/sql_connect.py
ci-scripts/mysql4testresults/sql_connect.py
+33
-0
ci-scripts/ran_dashboard/ran_dashboard.py
ci-scripts/ran_dashboard/ran_dashboard.py
+101
-78
ci-scripts/ran_dashboard/ran_dashboard_cfg.yaml
ci-scripts/ran_dashboard/ran_dashboard_cfg.yaml
+0
-0
ci-scripts/ran_dashboard/sqlconnect.py
ci-scripts/ran_dashboard/sqlconnect.py
+64
-0
No files found.
ci-scripts/mysql4testresults/docker-compose.yml
0 → 100644
View file @
d4e13596
version
:
'
2'
services
:
mysql
:
container_name
:
oaicicd_mysql
restart
:
always
image
:
mysql:latest
environment
:
MYSQL_ROOT_PASSWORD
:
'
ucZBc2XRYdvEm59F'
ports
:
-
"
3307:3306"
volumes
:
-
/home/oaicicd/mysql/data:/var/lib/mysql
ci-scripts/mysql4testresults/sql_connect.py
0 → 100644
View file @
d4e13596
import
pymysql
import
sys
from
datetime
import
datetime
#This is the script used to write the test results to the mysql DB
#Called by Jenkins pipeline (jenkinsfile)
#Must be located in /home/oaicicid/mysql on the database host
#Usage from Jenkinsfile :
#python3 /home/oaicicd/mysql/sql_connect.py ${JOB_NAME} ${params.eNB_MR} ${params.eNB_Branch} ${env.BUILD_ID} ${env.BUILD_URL} ${StatusForDb} ''
class
SQLConnect
:
def
__init__
(
self
):
self
.
connection
=
pymysql
.
connect
(
host
=
'172.22.0.2'
,
user
=
'root'
,
password
=
'ucZBc2XRYdvEm59F'
,
db
=
'oaicicd_tests'
,
port
=
3306
)
def
put
(
self
,
TEST
,
MR
,
BRANCH
,
BUILD
,
BUILD_LINK
,
STATUS
):
now
=
datetime
.
now
().
strftime
(
"%Y-%m-%d %H:%M:%S"
)
cur
=
self
.
connection
.
cursor
()
cur
.
execute
(
'INSERT INTO test_results (TEST,MR,BRANCH,BUILD,BUILD_LINK,STATUS,DATE) VALUES (%s,%s,%s,%s,%s,%s,%s);'
,
(
TEST
,
MR
,
BRANCH
,
BUILD
,
BUILD_LINK
,
STATUS
,
now
))
self
.
connection
.
commit
()
self
.
connection
.
close
()
if
__name__
==
"__main__"
:
mydb
=
SQLConnect
()
mydb
.
put
(
sys
.
argv
[
1
],
sys
.
argv
[
2
],
sys
.
argv
[
3
],
sys
.
argv
[
4
],
sys
.
argv
[
5
],
sys
.
argv
[
6
])
ci-scripts/ran_dashboard.py
→
ci-scripts/ran_dashboard
/ran_dashboard
.py
View file @
d4e13596
This diff is collapsed.
Click to expand it.
ci-scripts/ran_dashboard_cfg.yaml
→
ci-scripts/ran_dashboard
/ran_dashboard
_cfg.yaml
View file @
d4e13596
File moved
ci-scripts/ran_dashboard/sqlconnect.py
0 → 100644
View file @
d4e13596
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
:
def
__init__
(
self
):
self
.
connection
=
pymysql
.
connect
(
host
=
'172.22.0.2'
,
user
=
'root'
,
password
=
'ucZBc2XRYdvEm59F'
,
db
=
'oaicicd_tests'
,
port
=
3306
)
self
.
data
=
{}
#retrieve data from mysql database and organize it in a dictionary (per MR passed as argument)
def
get
(
self
,
MR
):
self
.
data
[
MR
]
=
{}
cur
=
self
.
connection
.
cursor
()
#get counters per test
sql
=
"select TEST,STATUS, count(*) AS COUNT from test_results where MR=(%s) group by TEST, STATUS;"
cur
.
execute
(
sql
,
MR
)
response
=
cur
.
fetchall
()
if
len
(
response
)
==
0
:
#no test results yet
self
.
data
[
MR
][
'PASS'
]
=
''
self
.
data
[
MR
][
'FAIL'
]
=
''
else
:
for
i
in
range
(
0
,
len
(
response
)):
test
=
response
[
i
][
0
]
status
=
response
[
i
][
1
]
count
=
response
[
i
][
2
]
if
test
in
self
.
data
[
MR
]:
self
.
data
[
MR
][
test
][
status
]
=
count
else
:
self
.
data
[
MR
][
test
]
=
{}
self
.
data
[
MR
][
test
][
status
]
=
count
#get last failing build and link
sql
=
"select TEST,BUILD, BUILD_LINK from test_results where MR=(%s) and STATUS='FAIL' 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_fail'
not
in
self
.
data
[
MR
][
test
]:
self
.
data
[
MR
][
test
][
'last_fail'
]
=
[]
self
.
data
[
MR
][
test
][
'last_fail'
].
append
(
build
)
self
.
data
[
MR
][
test
][
'last_fail'
].
append
(
link
)
#close database connection
def
close_connection
(
self
):
self
.
connection
.
close
()
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