From 3b557060d30f73cc68bcfe1a2a079e8486d635fb Mon Sep 17 00:00:00 2001 From: hardy Date: Wed, 1 Sep 2021 18:13:57 +0200 Subject: [PATCH 1/3] writing the status to SQL DB + stage exec on 2 agents --- ci-scripts/Jenkinsfile-tmp-multi-enb-nsa | 35 ++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa index 1e4933838b..a21de97d23 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa @@ -24,6 +24,7 @@ // Location of the python executor node shall be in the same subnet as the others servers def pythonExecutor = params.pythonExecutor +def DataBaseHost = params.DataBaseHost // Location of the test XML file to be run def testXMLFile = params.pythonTestXmlFile @@ -45,15 +46,20 @@ def eNB_CommitID def eNB_AllowMergeRequestProcess def eNB_TargetBranch +//Status fed to the database +def StatusForDb = "" + + pipeline { - agent { - label pythonExecutor - } + agent none options { disableConcurrentBuilds() ansiColor('xterm') lock(extra: [[resource: ciSmartPhonesResource2]], resource: ciSmartPhonesResource1) } + stages { + stage ("Py Exec"){ + agent {label pythonExecutor} stages { stage("Build Init") { steps { @@ -273,9 +279,31 @@ pipeline { } } } + } + + + stage ("DB Host"){ + agent {label DataBaseHost} + stages { + stage("SQL Collect ") { + steps { + script { + if (currentBuild.result=='FAILURE') {StatusForDb = 'FAIL'} else {StatusForDb = 'PASS'} + echo "${env.BUILD_URL}" + echo "${env.BUILD_ID}" + echo "${JOB_NAME}" + sh "python3 /home/oaicicd/sql_connect.py ${params.eNB_MR} ${params.eNB_Branch} ${StatusForDb} ''" + } + } + } + } + } + + } post { always { + node(pythonExecutor){ script { if (params.pipelineZipsConsoleLog != null) { if (params.pipelineZipsConsoleLog) { @@ -289,5 +317,6 @@ pipeline { } } } + } } } From fceea50a8b1cfd4e6350d1d448612270119355df Mon Sep 17 00:00:00 2001 From: hardy Date: Fri, 3 Sep 2021 14:34:32 +0200 Subject: [PATCH 2/3] productive version of sql table --- ci-scripts/Jenkinsfile-tmp-multi-enb-nsa | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa index a21de97d23..3d4c749e7a 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa @@ -289,10 +289,7 @@ pipeline { steps { script { if (currentBuild.result=='FAILURE') {StatusForDb = 'FAIL'} else {StatusForDb = 'PASS'} - echo "${env.BUILD_URL}" - echo "${env.BUILD_ID}" - echo "${JOB_NAME}" - sh "python3 /home/oaicicd/sql_connect.py ${params.eNB_MR} ${params.eNB_Branch} ${StatusForDb} ''" + sh "python3 /home/oaicicd/mysql/sql_connect.py ${JOB_NAME} ${params.eNB_MR} ${params.eNB_Branch} ${env.BUILD_ID} ${env.BUILD_URL} ${StatusForDb} ''" } } } From 11eab6882c574b561563d87c61b6e01655a125cc Mon Sep 17 00:00:00 2001 From: hardy Date: Wed, 15 Sep 2021 15:28:59 +0200 Subject: [PATCH 3/3] fix executor agent syntax --- ci-scripts/Jenkinsfile-tmp-multi-enb-nsa | 34 +++++++----------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa index 3d4c749e7a..95aa4046d7 100644 --- a/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa +++ b/ci-scripts/Jenkinsfile-tmp-multi-enb-nsa @@ -51,15 +51,12 @@ def StatusForDb = "" pipeline { - agent none + agent {label pythonExecutor} options { disableConcurrentBuilds() ansiColor('xterm') lock(extra: [[resource: ciSmartPhonesResource2]], resource: ciSmartPhonesResource1) } - stages { - stage ("Py Exec"){ - agent {label pythonExecutor} stages { stage("Build Init") { steps { @@ -276,31 +273,21 @@ pipeline { } } } - } - } - } - } - - - stage ("DB Host"){ - agent {label DataBaseHost} - stages { - stage("SQL Collect ") { - steps { - script { - if (currentBuild.result=='FAILURE') {StatusForDb = 'FAIL'} else {StatusForDb = 'PASS'} - sh "python3 /home/oaicicd/mysql/sql_connect.py ${JOB_NAME} ${params.eNB_MR} ${params.eNB_Branch} ${env.BUILD_ID} ${env.BUILD_URL} ${StatusForDb} ''" + stage ("SQL Collect"){ + agent {label DataBaseHost} + steps { + script { + if (currentBuild.result=='FAILURE') {StatusForDb = 'FAIL'} else {StatusForDb = 'PASS'} + sh "python3 /home/oaicicd/mysql/sql_connect.py ${JOB_NAME} ${params.eNB_MR} ${params.eNB_Branch} ${env.BUILD_ID} ${env.BUILD_URL} ${StatusForDb} ''" + } + } } } } - } - } - - } + } post { always { - node(pythonExecutor){ script { if (params.pipelineZipsConsoleLog != null) { if (params.pipelineZipsConsoleLog) { @@ -314,6 +301,5 @@ pipeline { } } } - } } }