Commit 953029ac authored by hardy's avatar hardy

improve test results post to git

parent 5109fc66
...@@ -387,7 +387,7 @@ pipeline { ...@@ -387,7 +387,7 @@ pipeline {
steps { steps {
script { script {
dir ('ci-scripts/ran_dashboard') { dir ('ci-scripts/ran_dashboard') {
sh "python3 Hdashboard.py testevent ${params.eNB_MR}" sh "python3 Hdashboard.py testevent ${params.eNB_MR} ${JOB_NAME} ${env.BUILD_URL} ${StatusForDb} "
} }
} }
} }
......
...@@ -507,28 +507,37 @@ class Dashboard: ...@@ -507,28 +507,37 @@ 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,singlemr): def PostGitNote(self,mr,jobname,buildurl,status):
gl = gitlab.Gitlab.from_config('OAI') gl = gitlab.Gitlab.from_config('OAI')
project_id = 223 project_id = 223
project = gl.projects.get(project_id) project = gl.projects.get(project_id)
editable_mr = project.mergerequests.get(int(singlemr)) editable_mr = project.mergerequests.get(int(singlemr))
mr_notes = editable_mr.notes.list() mr_notes = editable_mr.notes.list()
mr_note = editable_mr.notes.create({'body': '<a href="https://oaitestdashboard.s3.eu-west-1.amazonaws.com/MR'+singlemr+'/index.html">Test Results for your MR are updated (End to End LTE/NSA/SA/2x2/OAIUE)</a>'}) mr_note = editable_mr.notes.create({
'body': 'Completed Test : '+jobname+' , status : <b>'+status+'</b>\n'+\
buildurl+'\n'+\
'<a href="https://oaitestdashboard.s3.eu-west-1.amazonaws.com/MR'+mr+'/index.html">Consolidated Test Results (End to End LTE/NSA/SA/2x2/OAIUE)</a>'
})
editable_mr.save() editable_mr.save()
def main(): def main():
#call from Jenkinsfile : sh "python3 Hdashboard.py testevent ${params.eNB_MR} ${JOB_NAME} ${env.BUILD_URL} ${StatusForDb} "
#individual MR test results + test dashboard, event based (end of jenkins pipeline) #individual MR test results + test dashboard, event based (end of jenkins pipeline)
if len(sys.argv)>1: if len(sys.argv)>1:
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]
status=sys.argv[5]
htmlDash=Dashboard() htmlDash=Dashboard()
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')
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) htmlDash.PostGitNote(mr,jobname,buildurl,status)
#test and MR status dash boards, cron based #test and MR status dash boards, cron based
else: else:
htmlDash=Dashboard() htmlDash=Dashboard()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment