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
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
Hide 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 {
...
@@ -390,7 +390,7 @@ pipeline {
steps
{
steps
{
script
{
script
{
dir
(
'ci-scripts/ran_dashboard'
)
{
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
...
@@ -27,6 +27,9 @@ def pythonExecutor = params.pythonExecutor
def
TARGET_BRANCH
=
"develop"
def
TARGET_BRANCH
=
"develop"
def
ALLOW_MERGE
=
true
def
ALLOW_MERGE
=
true
def
GitPostArgs
=
''
def
DataBaseHost
=
params
.
DataBaseHost
def
jobStatus
pipeline
{
pipeline
{
agent
{
agent
{
...
@@ -47,11 +50,28 @@ pipeline {
...
@@ -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
=
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
()
COMMIT_ID
=
COMMIT_ID
.
trim
()
echo
"Testing NSA on : ${MR} ${SRC_BRANCH} ${COMMIT_ID}"
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
//calling NSA B200
jobName
=
"RAN-NSA-B200-Module-LTEBOX"
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_MR'
,
value:
String
.
valueOf
(
MR
)),
string
(
name:
'eNB_Branch'
,
value:
String
.
valueOf
(
SRC_BRANCH
)),
string
(
name:
'eNB_Branch'
,
value:
String
.
valueOf
(
SRC_BRANCH
)),
string
(
name:
'eNB_CommitID'
,
value:
String
.
valueOf
(
COMMIT_ID
)),
string
(
name:
'eNB_CommitID'
,
value:
String
.
valueOf
(
COMMIT_ID
)),
...
@@ -59,36 +79,42 @@ pipeline {
...
@@ -59,36 +79,42 @@ pipeline {
booleanParam
(
name:
'eNB_mergeRequest'
,
value:
Boolean
.
valueOf
(
ALLOW_MERGE
))
booleanParam
(
name:
'eNB_mergeRequest'
,
value:
Boolean
.
valueOf
(
ALLOW_MERGE
))
]
]
jobResult
=
jobStatus
.
getResult
()
jobResult
=
jobStatus
.
getResult
()
build_url
=
jobStatus
.
getAbsoluteUrl
()
build_url
=
jobStatus
.
getAbsoluteUrl
()
build_id
=
jobStatus
.
getNumber
().
toString
()
build_id
=
jobStatus
.
getNumber
().
toString
()
GitPostArgs
+=
jobName
+
' '
+
build_url
+
' '
+
build_id
+
' '
+
jobResult
GitPostArgs
+=
jobName
+
' '
+
build_url
+
' '
+
build_id
+
' '
+
jobResult
+
' '
echo
GitPostArgs
echo
GitPostArgs
//calling NSA 2x2
//calling NSA 2x2
//build job: "RAN-NSA-2x2-Module-OAIEPC", wait : true, propagate : false, parameters: [
jobName
=
"RAN-NSA-2x2-Module-OAIEPC"
// string(name: 'eNB_MR', value: String.valueOf(MR)),
jobStatus
=
build
job:
jobName
,
wait
:
true
,
propagate
:
false
,
parameters:
[
// string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)),
string
(
name:
'eNB_MR'
,
value:
String
.
valueOf
(
MR
)),
// string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)),
string
(
name:
'eNB_Branch'
,
value:
String
.
valueOf
(
SRC_BRANCH
)),
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
string
(
name:
'eNB_CommitID'
,
value:
String
.
valueOf
(
COMMIT_ID
)),
// booleanParam(name: 'eNB_mergeRequest', value: Boolean.valueOf(ALLOW_MERGE))
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: [
jobResult
=
jobStatus
.
getResult
()
// string(name: 'eNB_MR', value: String.valueOf(MR)),
build_url
=
jobStatus
.
getAbsoluteUrl
()
// string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)),
build_id
=
jobStatus
.
getNumber
().
toString
()
// string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)),
GitPostArgs
+=
jobName
+
' '
+
build_url
+
' '
+
build_id
+
' '
+
jobResult
+
' '
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
echo
GitPostArgs
// booleanParam(name: 'eNB_mergeRequest', value: Boolean.valueOf(ALLOW_MERGE))
//]
//calling SA
//calling SA
//build job: "RAN-SA-Module-CN5G", wait : true, propagate : false, parameters: [
jobName
=
"RAN-SA-Module-CN5G"
// string(name: 'eNB_MR', value: String.valueOf(MR)),
jobStatus
=
build
job:
jobName
,
wait
:
true
,
propagate
:
false
,
parameters:
[
// string(name: 'eNB_Branch', value: String.valueOf(SRC_BRANCH)),
string
(
name:
'eNB_MR'
,
value:
String
.
valueOf
(
MR
)),
// string(name: 'eNB_CommitID', value: String.valueOf(COMMIT_ID)),
string
(
name:
'eNB_Branch'
,
value:
String
.
valueOf
(
SRC_BRANCH
)),
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
string
(
name:
'eNB_CommitID'
,
value:
String
.
valueOf
(
COMMIT_ID
)),
// booleanParam(name: 'eNB_mergeRequest', value: Boolean.valueOf(ALLOW_MERGE))
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
//calling OAIUE B200
//build job: "RAN-SA-OAIUE-B200-CN5G", wait : true, propagate : false, parameters: [
//build job: "RAN-SA-OAIUE-B200-CN5G", wait : true, propagate : false, parameters: [
// string(name: 'eNB_MR', value: String.valueOf(MR)),
// string(name: 'eNB_MR', value: String.valueOf(MR)),
...
@@ -105,19 +131,38 @@ pipeline {
...
@@ -105,19 +131,38 @@ pipeline {
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
// string(name: 'eNB_TargetBranch', value: String.valueOf(TARGET_BRANCH)),
// booleanParam(name: 'eNB_mergeRequest', value: Boolean.valueOf(ALLOW_MERGE))
// 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,81 +509,87 @@ class Dashboard:
...
@@ -509,81 +509,87 @@ class Dashboard:
s3
.
meta
.
client
.
copy
(
copy_source
,
'oaitestdashboard'
,
path
+
'/'
+
'test_styles.css'
)
s3
.
meta
.
client
.
copy
(
copy_source
,
'oaitestdashboard'
,
path
+
'/'
+
'test_styles.css'
)
def
PostGitNote
(
self
,
mr
,
commit
,
jobname
,
buildurl
,
buildid
,
status
):
def
PostGitNote
(
self
,
mr
,
commit
,
args
):
#current date and time to be posted with test reulst
#current date and time to be posted with test results
now
=
datetime
.
now
()
#now = datetime.now()
dt_string
=
now
.
strftime
(
"%d/%m/%Y %H:%M"
)
#dt_string = now.strftime("%d/%m/%Y %H:%M")
gl
=
gitlab
.
Gitlab
.
from_config
(
'OAI'
)
if
len
(
args
)
%
4
!=
0
:
project_id
=
223
print
(
"Wrong Number of Arguments"
)
project
=
gl
.
projects
.
get
(
project_id
)
return
else
:
#retrieve all the notes from the MR
n_tests
=
len
(
args
)
//
4
editable_mr
=
project
.
mergerequests
.
get
(
int
(
mr
))
mr_notes
=
editable_mr
.
notes
.
list
(
all
=
True
)
gl
=
gitlab
.
Gitlab
.
from_config
(
'OAI'
)
project_id
=
223
#find key word in notes to find out if such a note has already been posted
project
=
gl
.
projects
.
get
(
project_id
)
n
=
0
found
=
False
#retrieve all the notes from the MR
while
found
==
False
and
n
<
len
(
mr_notes
):
editable_mr
=
project
.
mergerequests
.
get
(
int
(
mr
))
res
=
re
.
search
(
'Consolidated Test Results'
,
mr_notes
[
n
].
body
)
#this is the marker we are looking for in all notes
mr_notes
=
editable_mr
.
notes
.
list
(
all
=
True
)
if
res
!=
None
:
found
=
True
body
=
'<a href="https://oaitestdashboard.s3.eu-west-1.amazonaws.com/MR'
+
mr
+
'/index.html">Consolidated Test Results</a><br>'
+
\
n
+=
1
'Tested CommitID: '
+
commit
+
'<br>'
if
found
==
False
:
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>'
#create new note
#create new note
mr_note
=
editable_mr
.
notes
.
create
({
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>'
+
\
'body'
:
body
dt_string
+
' '
+
commit
+
': '
+
jobname
+
', status is <b>'
+
status
+
'</b>, '
+
\
'(<a href="'
+
buildurl
+
'">'
+
buildid
+
'</a>)<br>'
})
})
editable_mr
.
save
()
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
})
editable_mr
.
save
()
#delete current note
mr_notes
[
n
-
1
].
delete
()
editable_mr
.
save
()
def
main
():
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
:
if
len
(
sys
.
argv
)
>
1
:
#individual MR test results + test dashboard, event based (end of slave jenkins pipeline)
if
sys
.
argv
[
1
]
==
"testevent"
:
if
sys
.
argv
[
1
]
==
"testevent"
:
mr
=
sys
.
argv
[
2
]
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
()
htmlDash
=
Dashboard
()
if
mr
in
htmlDash
.
mr_list
:
if
mr
in
htmlDash
.
mr_list
:
#single MR test results
htmlDash
.
Build
(
'singleMR'
,
mr
,
'/tmp/MR'
+
mr
+
'_index.html'
)
htmlDash
.
Build
(
'singleMR'
,
mr
,
'/tmp/MR'
+
mr
+
'_index.html'
)
htmlDash
.
CopyToS3
(
'/tmp/MR'
+
mr
+
'_index.html'
,
'oaitestdashboard'
,
'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
.
Build
(
'Tests'
,
'0000'
,
'/tmp/Tests_index.html'
)
htmlDash
.
CopyToS3
(
'/tmp/Tests_index.html'
,
'oaitestdashboard'
,
'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
:
else
:
print
(
"Not a Merge Request => this build is for testing/debug purpose, no report to git"
)
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
:
else
:
htmlDash
=
Dashboard
()
htmlDash
=
Dashboard
()
#all MR status dashboard
htmlDash
.
Build
(
'MR'
,
'0000'
,
'/tmp/MR_index.html'
)
htmlDash
.
Build
(
'MR'
,
'0000'
,
'/tmp/MR_index.html'
)
htmlDash
.
CopyToS3
(
'/tmp/MR_index.html'
,
'oairandashboard'
,
'index.html'
)
htmlDash
.
CopyToS3
(
'/tmp/MR_index.html'
,
'oairandashboard'
,
'index.html'
)
#all MR test results
htmlDash
.
Build
(
'Tests'
,
'0000'
,
'/tmp/Tests_index.html'
)
htmlDash
.
Build
(
'Tests'
,
'0000'
,
'/tmp/Tests_index.html'
)
htmlDash
.
CopyToS3
(
'/tmp/Tests_index.html'
,
'oaitestdashboard'
,
'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