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
Michael Black
OpenXG-RAN
Commits
1f0c2f89
Commit
1f0c2f89
authored
Jan 17, 2022
by
hardy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new git post finalized, to be tested
parent
064ed744
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
137 additions
and
86 deletions
+137
-86
ci-scripts/Jenkinsfile-tmp-multi-enb-nsa
ci-scripts/Jenkinsfile-tmp-multi-enb-nsa
+1
-1
ci-scripts/Jenkinsfile-trig-nsa
ci-scripts/Jenkinsfile-trig-nsa
+81
-36
ci-scripts/ran_dashboard/Hdashboard.py
ci-scripts/ran_dashboard/Hdashboard.py
+55
-49
No files found.
ci-scripts/Jenkinsfile-tmp-multi-enb-nsa
View file @
1f0c2f89
...
...
@@ -390,7 +390,7 @@ pipeline {
steps
{
script
{
dir
(
'ci-scripts/ran_dashboard'
)
{
sh
"python3 Hdashboard.py testevent ${params.eNB_MR}
${JOB_NAME} ${env.BUILD_URL} ${env.BUILD_ID} ${StatusForDb} ${params.eNB_CommitID}
"
sh
"python3 Hdashboard.py testevent ${params.eNB_MR} "
}
}
}
...
...
ci-scripts/Jenkinsfile-trig-nsa
View file @
1f0c2f89
...
...
@@ -27,6 +27,9 @@ def pythonExecutor = params.pythonExecutor
def
TARGET_BRANCH
=
"develop"
def
ALLOW_MERGE
=
true
def
GitPostArgs
=
''
def
DataBaseHost
=
params
.
DataBaseHost
def
jobStatus
pipeline
{
agent
{
...
...
@@ -47,11 +50,28 @@ pipeline {
COMMIT_ID
=
sh
returnStdout:
true
,
script:
"""curl --silent "https://gitlab.eurecom.fr/api/v4/projects/oai%2Fopenairinterface5g/merge_requests/${MR}" | jq ".sha" || true """
COMMIT_ID
=
COMMIT_ID
.
trim
()
echo
"Testing NSA on : ${MR} ${SRC_BRANCH} ${COMMIT_ID}"
def
GitPostArgs
=
MR
+
' '
+
COMMIT_ID
+
' '
commit
=
COMMIT_ID
.
replace
(
"\""
,
""
)
GitPostArgs
+=
MR
+
' '
+
commit
+
' '
echo
GitPostArgs
//calling LTE 2x2
jobName
=
"RAN-LTE-2x2-Module-OAIEPC"
jobStatus
=
build
job:
jobName
,
wait
:
true
,
propagate
:
false
,
parameters:
[
string
(
name:
'eNB_MR'
,
value:
String
.
valueOf
(
MR
)),
string
(
name:
'eNB_Branch'
,
value:
String
.
valueOf
(
SRC_BRANCH
)),
string
(
name:
'eNB_CommitID'
,
value:
String
.
valueOf
(
COMMIT_ID
)),
string
(
name:
'eNB_TargetBranch'
,
value:
String
.
valueOf
(
TARGET_BRANCH
)),
booleanParam
(
name:
'eNB_mergeRequest'
,
value:
Boolean
.
valueOf
(
ALLOW_MERGE
))
]
jobResult
=
jobStatus
.
getResult
()
build_url
=
jobStatus
.
getAbsoluteUrl
()
build_id
=
jobStatus
.
getNumber
().
toString
()
GitPostArgs
+=
jobName
+
' '
+
build_url
+
' '
+
build_id
+
' '
+
jobResult
+
' '
echo
GitPostArgs
//calling NSA B200
jobName
=
"RAN-NSA-B200-Module-LTEBOX"
def
jobStatus
=
build
job:
jobName
,
wait
:
true
,
propagate
:
false
,
parameters:
[
jobStatus
=
build
job:
jobName
,
wait
:
true
,
propagate
:
false
,
parameters:
[
string
(
name:
'eNB_MR'
,
value:
String
.
valueOf
(
MR
)),
string
(
name:
'eNB_Branch'
,
value:
String
.
valueOf
(
SRC_BRANCH
)),
string
(
name:
'eNB_CommitID'
,
value:
String
.
valueOf
(
COMMIT_ID
)),
...
...
@@ -61,34 +81,40 @@ pipeline {
jobResult
=
jobStatus
.
getResult
()
build_url
=
jobStatus
.
getAbsoluteUrl
()
build_id
=
jobStatus
.
getNumber
().
toString
()
GitPostArgs
+=
jobName
+
' '
+
build_url
+
' '
+
build_id
+
' '
+
jobResult
GitPostArgs
+=
jobName
+
' '
+
build_url
+
' '
+
build_id
+
' '
+
jobResult
+
' '
echo
GitPostArgs
//calling NSA 2x2
//build job: "RAN-NSA-2x2-Module-OAIEPC", wait : true, propagate : false, parameters: [
// string(name: 'eNB_MR', value: String.valueOf(MR)),
// string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)),
// string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)),
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
// booleanParam(name: 'eNB_mergeRequest', value: Boolean.valueOf(ALLOW_MERGE))
//]
//calling LTE 2x2
//build job: "RAN-LTE-2x2-Module-OAIEPC", wait : true, propagate : false, parameters: [
// string(name: 'eNB_MR', value: String.valueOf(MR)),
// string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)),
// string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)),
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
// booleanParam(name: 'eNB_mergeRequest', value: Boolean.valueOf(ALLOW_MERGE))
//]
jobName
=
"RAN-NSA-2x2-Module-OAIEPC"
jobStatus
=
build
job:
jobName
,
wait
:
true
,
propagate
:
false
,
parameters:
[
string
(
name:
'eNB_MR'
,
value:
String
.
valueOf
(
MR
)),
string
(
name:
'eNB_Branch'
,
value:
String
.
valueOf
(
SRC_BRANCH
)),
string
(
name:
'eNB_CommitID'
,
value:
String
.
valueOf
(
COMMIT_ID
)),
string
(
name:
'eNB_TargetBranch'
,
value:
String
.
valueOf
(
TARGET_BRANCH
)),
booleanParam
(
name:
'eNB_mergeRequest'
,
value:
Boolean
.
valueOf
(
ALLOW_MERGE
))
]
jobResult
=
jobStatus
.
getResult
()
build_url
=
jobStatus
.
getAbsoluteUrl
()
build_id
=
jobStatus
.
getNumber
().
toString
()
GitPostArgs
+=
jobName
+
' '
+
build_url
+
' '
+
build_id
+
' '
+
jobResult
+
' '
echo
GitPostArgs
//calling SA
//build job: "RAN-SA-Module-CN5G", wait : true, propagate : false, parameters: [
// string(name: 'eNB_MR', value: String.valueOf(MR)),
// string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)),
// string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)),
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
// booleanParam(name: 'eNB_mergeRequest', value: Boolean.valueOf(ALLOW_MERGE))
//]
jobName
=
"RAN-SA-Module-CN5G"
jobStatus
=
build
job:
jobName
,
wait
:
true
,
propagate
:
false
,
parameters:
[
string
(
name:
'eNB_MR'
,
value:
String
.
valueOf
(
MR
)),
string
(
name:
'eNB_Branch'
,
value:
String
.
valueOf
(
SRC_BRANCH
)),
string
(
name:
'eNB_CommitID'
,
value:
String
.
valueOf
(
COMMIT_ID
)),
string
(
name:
'eNB_TargetBranch'
,
value:
String
.
valueOf
(
TARGET_BRANCH
)),
booleanParam
(
name:
'eNB_mergeRequest'
,
value:
Boolean
.
valueOf
(
ALLOW_MERGE
))
]
jobResult
=
jobStatus
.
getResult
()
build_url
=
jobStatus
.
getAbsoluteUrl
()
build_id
=
jobStatus
.
getNumber
().
toString
()
GitPostArgs
+=
jobName
+
' '
+
build_url
+
' '
+
build_id
+
' '
+
jobResult
+
' '
echo
GitPostArgs
//calling OAIUE B200
//build job: "RAN-SA-OAIUE-B200-CN5G", wait : true, propagate : false, parameters: [
// string(name: 'eNB_MR', value: String.valueOf(MR)),
...
...
@@ -105,15 +131,34 @@ pipeline {
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
// booleanParam(name: 'eNB_mergeRequest', value: Boolean.valueOf(ALLOW_MERGE))
//]
//calling OAIUE N310-X300
//build job: "RAN-SA-OAIUE-N310-X300-CN5G", wait : true, propagate : false, parameters: [
// string(name: 'eNB_MR', value: String.valueOf(MR)),
// string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)),
// string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)),
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
// booleanParam(name: 'eNB_mergeRequest', value: Boolean.valueOf(ALLOW_MERGE))
//]
//calling OAIUE N310-X300
jobName
=
"RAN-SA-OAIUE-N310-X300-CN5G"
jobStatus
=
build
job:
jobName
,
wait
:
true
,
propagate
:
false
,
parameters:
[
string
(
name:
'eNB_MR'
,
value:
String
.
valueOf
(
MR
)),
string
(
name:
'eNB_Branch'
,
value:
String
.
valueOf
(
SRC_BRANCH
)),
string
(
name:
'eNB_CommitID'
,
value:
String
.
valueOf
(
COMMIT_ID
)),
string
(
name:
'eNB_TargetBranch'
,
value:
String
.
valueOf
(
TARGET_BRANCH
)),
booleanParam
(
name:
'eNB_mergeRequest'
,
value:
Boolean
.
valueOf
(
ALLOW_MERGE
))
]
jobResult
=
jobStatus
.
getResult
()
build_url
=
jobStatus
.
getAbsoluteUrl
()
build_id
=
jobStatus
.
getNumber
().
toString
()
GitPostArgs
+=
jobName
+
' '
+
build_url
+
' '
+
build_id
+
' '
+
jobResult
+
' '
echo
GitPostArgs
}
}
}
}
stage
(
'Git Post'
)
{
when
{
expression
{
params
.
DataBaseHost
!=
"none"
}
}
agent
{
label
DataBaseHost
}
steps
{
script
{
dir
(
'ci-scripts/ran_dashboard'
)
{
sh
"python3 Hdashboard.py gitpost ${GitPostArgs}"
}
}
}
...
...
ci-scripts/ran_dashboard/Hdashboard.py
View file @
1f0c2f89
...
...
@@ -509,10 +509,16 @@ class Dashboard:
s3
.
meta
.
client
.
copy
(
copy_source
,
'oaitestdashboard'
,
path
+
'/'
+
'test_styles.css'
)
def
PostGitNote
(
self
,
mr
,
commit
,
jobname
,
buildurl
,
buildid
,
status
):
#current date and time to be posted with test reulst
now
=
datetime
.
now
()
dt_string
=
now
.
strftime
(
"%d/%m/%Y %H:%M"
)
def
PostGitNote
(
self
,
mr
,
commit
,
args
):
#current date and time to be posted with test results
#now = datetime.now()
#dt_string = now.strftime("%d/%m/%Y %H:%M")
if
len
(
args
)
%
4
!=
0
:
print
(
"Wrong Number of Arguments"
)
return
else
:
n_tests
=
len
(
args
)
//
4
gl
=
gitlab
.
Gitlab
.
from_config
(
'OAI'
)
project_id
=
223
...
...
@@ -522,68 +528,68 @@ class Dashboard:
editable_mr
=
project
.
mergerequests
.
get
(
int
(
mr
))
mr_notes
=
editable_mr
.
notes
.
list
(
all
=
True
)
#find key word in notes to find out if such a note has already been posted
n
=
0
found
=
False
while
found
==
False
and
n
<
len
(
mr_notes
):
res
=
re
.
search
(
'Consolidated Test Results'
,
mr_notes
[
n
].
body
)
#this is the marker we are looking for in all notes
if
res
!=
None
:
found
=
True
n
+=
1
body
=
'<a href="https://oaitestdashboard.s3.eu-west-1.amazonaws.com/MR'
+
mr
+
'/index.html">Consolidated Test Results</a><br>'
+
\
'Tested CommitID: '
+
commit
+
'<br>'
for
i
in
range
(
0
,
n_tests
):
jobname
=
args
[
4
*
i
]
buildurl
=
args
[
4
*
i
+
1
]
buildid
=
args
[
4
*
i
+
2
]
status
=
args
[
4
*
i
+
3
]
body
+=
jobname
+
', status is <b>'
+
status
+
'</b>, (<a href="'
+
buildurl
+
'">'
+
buildid
+
'</a>)<br>'
if
found
==
False
:
#create new note
mr_note
=
editable_mr
.
notes
.
create
({
'body'
:
'<a href="https://oaitestdashboard.s3.eu-west-1.amazonaws.com/MR'
+
mr
+
'/index.html">Consolidated Test Results</a><br>'
+
\
dt_string
+
' '
+
commit
+
': '
+
jobname
+
', status is <b>'
+
status
+
'</b>, '
+
\
'(<a href="'
+
buildurl
+
'">'
+
buildid
+
'</a>)<br>'
})
editable_mr
.
save
()
else
:
#retrieve current note : due to post incr in the parsing loop, need to check note n-1
cur_body
=
mr_notes
[
n
-
1
].
body
append_body
=
dt_string
+
' '
+
commit
+
': '
+
jobname
+
', status is <b>'
+
status
+
'</b>, '
+
\
'(<a href="'
+
buildurl
+
'">'
+
buildid
+
'</a>)<br>'
new_body
=
cur_body
+
append_body
#create a new note at the bottom
mr_note
=
editable_mr
.
notes
.
create
({
'body'
:
new_body
'body'
:
body
})
editable_mr
.
save
()
#delete current note
mr_notes
[
n
-
1
].
delete
()
editable_mr
.
save
()
def
main
():
#call from Jenkinsfile : sh "python3 Hdashboard.py testevent ${params.eNB_MR} ${JOB_NAME} ${env.BUILD_URL} ${env.BUILD_ID} ${StatusForDb} "
#call from slave Jenkinsfile : sh "python3 Hdashboard.py testevent ${params.eNB_MR} "
#call from master Jenkinsfile : sh "python3 Hdashboard.py gitpost ${GitPostArgs}"
#individual MR test results + test dashboard, event based (end of jenkins pipeline)
if
len
(
sys
.
argv
)
>
1
:
#individual MR test results + test dashboard, event based (end of slave jenkins pipeline)
if
sys
.
argv
[
1
]
==
"testevent"
:
mr
=
sys
.
argv
[
2
]
jobname
=
sys
.
argv
[
3
]
buildurl
=
sys
.
argv
[
4
]
buildid
=
sys
.
argv
[
5
]
status
=
sys
.
argv
[
6
]
commit
=
sys
.
argv
[
7
]
htmlDash
=
Dashboard
()
if
mr
in
htmlDash
.
mr_list
:
#single MR test results
htmlDash
.
Build
(
'singleMR'
,
mr
,
'/tmp/MR'
+
mr
+
'_index.html'
)
htmlDash
.
CopyToS3
(
'/tmp/MR'
+
mr
+
'_index.html'
,
'oaitestdashboard'
,
'MR'
+
mr
+
'/index.html'
)
#all MR test results
htmlDash
.
Build
(
'Tests'
,
'0000'
,
'/tmp/Tests_index.html'
)
htmlDash
.
CopyToS3
(
'/tmp/Tests_index.html'
,
'oaitestdashboard'
,
'index.html'
)
htmlDash
.
PostGitNote
(
mr
,
commit
,
jobname
,
buildurl
,
buildid
,
status
)
#git post with MR test results, event based (end of master jenkins pipeline)
elif
sys
.
argv
[
1
]
==
"gitpost"
:
mr
=
sys
.
argv
[
2
]
commit
=
sys
.
argv
[
3
]
args
=
[]
for
i
in
range
(
4
,
len
(
sys
.
argv
)):
#jobname, url, id , result
args
.
append
(
sys
.
argv
[
i
])
htmlDash
=
Dashboard
()
if
mr
in
htmlDash
.
mr_list
:
htmlDash
.
PostGitNote
(
mr
,
commit
,
args
)
else
:
print
(
"Not a Merge Request => this build is for testing/debug purpose, no report to git"
)
#test and MR status dash boards, cron based
else
:
print
(
"Wrong argument at position 1"
)
#test and MR status dashboards, cron based
else
:
htmlDash
=
Dashboard
()
#all MR status dashboard
htmlDash
.
Build
(
'MR'
,
'0000'
,
'/tmp/MR_index.html'
)
htmlDash
.
CopyToS3
(
'/tmp/MR_index.html'
,
'oairandashboard'
,
'index.html'
)
#all MR test results
htmlDash
.
Build
(
'Tests'
,
'0000'
,
'/tmp/Tests_index.html'
)
htmlDash
.
CopyToS3
(
'/tmp/Tests_index.html'
,
'oaitestdashboard'
,
'index.html'
)
...
...
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