Commit 80d98628 authored by Boris Djalal's avatar Boris Djalal

Retrieving info about the author of the commit.

Signed-off-by: default avatarBoris Djalal <boris.djalal@eurecom.fr>
parent c4de0422
#!/bin/groovy #!/bin/groovy
/* /*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. * this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under * The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file * the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. * except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.openairinterface.org/?page_id=698 * http://www.openairinterface.org/?page_id=698
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*------------------------------------------------------------------------------- *-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance: * For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org * contact@openairinterface.org
*/ */
// Abstraction function to send social media messages: // Abstraction function to send social media messages:
// like on Slack or Mattermost // like on Slack or Mattermost
def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) { def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) {
if (params.pipelineUsesSlack != null) { if (params.pipelineUsesSlack != null) {
if (params.pipelineUsesSlack) { if (params.pipelineUsesSlack) {
slackSend channel: pipeChannel, color: pipeColor, message: pipeMessage slackSend channel: pipeChannel, color: pipeColor, message: pipeMessage
} }
} }
} }
...@@ -51,6 +51,8 @@ def eNB_CommitID ...@@ -51,6 +51,8 @@ def eNB_CommitID
def eNB_AllowMergeRequestProcess = false def eNB_AllowMergeRequestProcess = false
def eNB_TargetBranch def eNB_TargetBranch
def PROJECT_NAME = "test-boris" def PROJECT_NAME = "test-boris"
def author
def email_author
// Global Parameters not to break the main.py command line and code. // Global Parameters not to break the main.py command line and code.
def ADB_IPAddress = "none" def ADB_IPAddress = "none"
def ADB_Username = "none" def ADB_Username = "none"
...@@ -62,273 +64,277 @@ def EPC_Password = "none" ...@@ -62,273 +64,277 @@ def EPC_Password = "none"
pipeline { pipeline {
agent { agent {
label pythonExecutor label pythonExecutor
}
options {
disableConcurrentBuilds()
timestamps()
gitLabConnection('OAI GitLab')
ansiColor('xterm')
}
stages {
stage ('Retrieve latest from branch') {
steps {
script {
checkout([$class: 'GitSCM', branches: [[name: '*/gNB-nrUE-USRP']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://gitlab.eurecom.fr/oai/openairinterface5g.git']]])
sh "git clean -x -d -ff"
sh "git log -n1"
}
} }
options { }
disableConcurrentBuilds() stage ("Print latest commit info") {
timestamps() steps {
gitLabConnection('OAI GitLab') script {
ansiColor('xterm') echo "Building on: "
echo " Repository -- ${GIT_URL}"
echo " Branch -- ${GIT_BRANCH}"
echo " Commit -- ${GIT_COMMIT}"
sh "git log -n1"
//eNB_Repository = ${GIT_URL}
}
} }
stages { }
stage ('Retrieve latest from branch') { stage ("Verify Parameters") {
steps { steps {
script { script {
checkout([$class: 'GitSCM', branches: [[name: '*/gNB-nrUE-USRP']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[url: 'https://gitlab.eurecom.fr/oai/openairinterface5g.git']]]) JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"'
sh "git clean -x -d -ff" JOB_TIMESTAMP = JOB_TIMESTAMP.trim()
sh "git log -n1"
}
}
}
stage ("Print latest commit info") {
steps {
script {
echo "Building on: "
echo " Repository -- ${GIT_URL}"
echo " Branch -- ${GIT_BRANCH}"
echo " Commit -- ${GIT_COMMIT}"
sh "git log -n1"
//eNB_Repository = ${GIT_URL}
}
}
}
stage ("Verify Parameters") {
steps {
script {
JOB_TIMESTAMP = sh returnStdout: true, script: 'date --utc --rfc-3339=seconds | sed -e "s#+00:00##"'
JOB_TIMESTAMP = JOB_TIMESTAMP.trim()
echo '\u2705 \u001B[32mVerify Parameters\u001B[0m' echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
def allParametersPresent = true def allParametersPresent = true
// It is already too late to check it // It is already too late to check it
if (params.pythonExecutor != null) { if (params.pythonExecutor != null) {
echo "eNB CI executor node : ${pythonExecutor}" echo "eNB CI executor node : ${pythonExecutor}"
} }
if (params.eNB_Repository == null) { if (params.eNB_Repository == null) {
eNB_Repository = GIT_URL eNB_Repository = GIT_URL
} else { } else {
eNB_Repository = params.eNB_Repository eNB_Repository = params.eNB_Repository
} }
echo "eNB_Repository = ${eNB_Repository}" echo "eNB_Repository = ${eNB_Repository}"
if (params.eNB_Branch== null) { if (params.eNB_Branch== null) {
eNB_Branch = GIT_BRANCH eNB_Branch = GIT_BRANCH
} else { } else {
eNB_Branch = params.eNB_Branch eNB_Branch = params.eNB_Branch
} }
echo "eNB_Branch = ${eNB_Branch}" echo "eNB_Branch = ${eNB_Branch}"
if (params.eNB_CommitID == null) { if (params.eNB_CommitID == null) {
eNB_CommitID = GIT_COMMIT eNB_CommitID = GIT_COMMIT
} else { } else {
eNB_CommitID = params.eNB_CommitID eNB_CommitID = params.eNB_CommitID
} }
echo "eNB_CommitID = ${eNB_CommitID}" echo "eNB_CommitID = ${eNB_CommitID}"
// If not present picking a default XML file // If not present picking a default XML file
if (params.pythonTestXmlFile == null) { if (params.pythonTestXmlFile == null) {
// picking default // picking default
testXMLFile = 'xml_files/gnb_usrp_build.xml' testXMLFile = 'xml_files/gnb_usrp_build.xml'
echo "Test XML file(default): ${testXMLFile}" echo "Test XML file(default): ${testXMLFile}"
mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " " mainPythonAllXmlFiles += "--XMLTestFile=" + testXMLFile + " "
} else { } else {
String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
for (xmlFile in myXmlTestSuite) { for (xmlFile in myXmlTestSuite) {
if (fileExists("ci-scripts/" + xmlFile)) { if (fileExists("ci-scripts/" + xmlFile)) {
mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " " mainPythonAllXmlFiles += "--XMLTestFile=" + xmlFile + " "
echo "Test XML file : ${xmlFile}" echo "Test XML file : ${xmlFile}"
} }
} }
} }
// If not present picking a default Stage Name // If not present picking a default Stage Name
if (params.pipelineTestStageName == null) { if (params.pipelineTestStageName == null) {
// picking default // picking default
testStageName = 'Template Test Stage' testStageName = 'Template Test Stage'
} }
echo "params.eNB_IPAddress = ${params.eNB_IPAddress}" echo "params.eNB_IPAddress = ${params.eNB_IPAddress}"
if (params.eNB_IPAddress == null) { if (params.eNB_IPAddress == null) {
allParametersPresent = false allParametersPresent = false
} }
echo "params.UE_IPAddress = ${params.UE_IPAddress}" echo "params.UE_IPAddress = ${params.UE_IPAddress}"
if (params.UE_IPAddress == null) { if (params.UE_IPAddress == null) {
allParametersPresent = false allParametersPresent = false
} }
echo "params.eNB_SourceCodePath = ${params.eNB_SourceCodePath}" echo "params.eNB_SourceCodePath = ${params.eNB_SourceCodePath}"
if (params.eNB_SourceCodePath == null) { if (params.eNB_SourceCodePath == null) {
allParametersPresent = false allParametersPresent = false
} }
echo "params.eNB_Credentials = ${params.eNB_Credentials}" echo "params.eNB_Credentials = ${params.eNB_Credentials}"
if (params.eNB_Credentials == null) { if (params.eNB_Credentials == null) {
allParametersPresent = false allParametersPresent = false
} }
echo "params.UE_Credentials = ${params.UE_Credentials}" echo "params.UE_Credentials = ${params.UE_Credentials}"
if (params.UE_Credentials == null) { if (params.UE_Credentials == null) {
allParametersPresent = false allParametersPresent = false
} }
echo "allParametersPresent = ${allParametersPresent}" author = $(git show -s --pretty=%an)
echo "begin if 2" echo "The author of the commit is: ${author}"
if (allParametersPresent) { email_author = $(git show -s --pretty=%ae)
echo "then 2" echo "The email of the author is: ${email_author}"
echo "All parameters are present" echo "allParametersPresent = ${allParametersPresent}"
} else { echo "begin if 2"
echo "else 2" if (allParametersPresent) {
echo "Some parameters are missing" echo "then 2"
sh "./ci-scripts/fail.sh" echo "All parameters are present"
} } else {
echo "end if 2" echo "else 2"
// The following parameters are kept not to break the current main.py command line and code. echo "Some parameters are missing"
// They should be removed in the future. sh "./ci-scripts/fail.sh"
//if (params.ADB_IPAddress == null) { }
// params.ADB_IPAddress = "none" echo "end if 2"
//} // The following parameters are kept not to break the current main.py command line and code.
//echo "params.ADB_IPAddress = ${params.ADB_IPAddress}" // They should be removed in the future.
} //if (params.ADB_IPAddress == null) {
} // params.ADB_IPAddress = "none"
} //}
//echo "params.ADB_IPAddress = ${params.ADB_IPAddress}"
}
}
}
stage ("Build and Test") { stage ("Build and Test") {
steps { steps {
script { script {
dir ('ci-scripts') { dir ('ci-scripts') {
echo "\u2705 \u001B[32m${testStageName}\u001B[0m" echo "\u2705 \u001B[32m${testStageName}\u001B[0m"
echo "params.eNB_Credentials = ${params.eNB_Credentials}" echo "params.eNB_Credentials = ${params.eNB_Credentials}"
echo "params.UE_Credentials = ${params.UE_Credentials}" echo "params.UE_Credentials = ${params.UE_Credentials}"
echo "eNB_Repository = ${eNB_Repository}" echo "eNB_Repository = ${eNB_Repository}"
echo "eNB_Branch= ${eNB_Branch}" echo "eNB_Branch= ${eNB_Branch}"
echo "eNB_CommitID= ${eNB_CommitID}" echo "eNB_CommitID= ${eNB_CommitID}"
echo "eNB_AllowMergeRequestProcess= ${eNB_AllowMergeRequestProcess}" echo "eNB_AllowMergeRequestProcess= ${eNB_AllowMergeRequestProcess}"
echo "params.ADB_IPAddress= ${params.ADB_IPAddress}" echo "params.ADB_IPAddress= ${params.ADB_IPAddress}"
echo "ADB_IPAddress= ${ADB_IPAddress}" echo "ADB_IPAddress= ${ADB_IPAddress}"
echo "ADB_Username = ${ADB_Username}" echo "ADB_Username = ${ADB_Username}"
echo "ADB_Password = ${ADB_Password}" echo "ADB_Password = ${ADB_Password}"
echo "params.eNB_IPAddress = ${params.eNB_IPAddress}" echo "params.eNB_IPAddress = ${params.eNB_IPAddress}"
echo "params.eNB_SourceCodePath = ${params.eNB_SourceCodePath}" echo "params.eNB_SourceCodePath = ${params.eNB_SourceCodePath}"
echo "ADB_IPAddress = ${ADB_IPAddress}" echo "ADB_IPAddress = ${ADB_IPAddress}"
echo "EPC_IPAddress = ${EPC_IPAddress}" echo "EPC_IPAddress = ${EPC_IPAddress}"
echo "buildStageStatus = ${buildStageStatus}" echo "buildStageStatus = ${buildStageStatus}"
withCredentials([ withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'], [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'],
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password'] [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.UE_Credentials}", usernameVariable: 'UE_Username', passwordVariable: 'UE_Password']
]) { ]) {
sh "python3 main.py --mode=InitiateHtml --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --ADBIPAddress=${ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --eNBIPAddress=127.0.0.1 --eNBUserName=carabe --eNBPassword=${eNB_Password} ${mainPythonAllXmlFiles}" sh "python3 main.py --mode=InitiateHtml --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --ADBIPAddress=${ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --eNBIPAddress=127.0.0.1 --eNBUserName=carabe --eNBPassword=${eNB_Password} ${mainPythonAllXmlFiles}"
String[] myXmlTestSuite = testXMLFile.split("\\r?\\n") String[] myXmlTestSuite = testXMLFile.split("\\r?\\n")
for (xmlFile in myXmlTestSuite) { for (xmlFile in myXmlTestSuite) {
if (fileExists(xmlFile)) { if (fileExists(xmlFile)) {
try { try {
echo "The test will be executed here. The command would be:" echo "The test will be executed here. The command would be:"
echo "sh \"python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${params.eNB_Password} --eNBBranch=${eNB_Branch} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNBRepository=${eNB_Repository} --eNBCommitID=${eNB_CommitID} --ADBIPAddress=${ADB_IPAddress} --EPCIPAddress=${EPC_IPAddress} --XMLTestFile=${xmlFile}\"" echo "sh \"python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${params.eNB_Password} --eNBBranch=${eNB_Branch} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNBRepository=${eNB_Repository} --eNBCommitID=${eNB_CommitID} --ADBIPAddress=${ADB_IPAddress} --EPCIPAddress=${EPC_IPAddress} --XMLTestFile=${xmlFile}\""
//sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${params.eNB_Password} --eNBBranch=${eNB_Branch} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNBRepository=${eNB_Repository} --eNBCommitID=${eNB_CommitID} --ADBIPAddress=${ADB_IPAddress} --EPCIPAddress=${EPC_IPAddress} --XMLTestFile=${xmlFile}" //sh "python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${params.eNB_Password} --eNBBranch=${eNB_Branch} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNBRepository=${eNB_Repository} --eNBCommitID=${eNB_CommitID} --ADBIPAddress=${ADB_IPAddress} --EPCIPAddress=${EPC_IPAddress} --XMLTestFile=${xmlFile}"
} catch (Exception e) { } catch (Exception e) {
currentBuild.result = 'FAILURE' currentBuild.result = 'FAILURE'
buildStageStatus = false buildStageStatus = false
} }
} }
} }
sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}" sh "python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
} }
} }
} }
} }
} }
stage ("Terminate") { stage ("Terminate") {
parallel { parallel {
stage('Terminate NR UE') { stage('Terminate NR UE') {
steps { steps {
echo '\u2705 \u001B[32mTerminate UE\u001B[0m' echo '\u2705 \u001B[32mTerminate UE\u001B[0m'
} }
post { post {
success { success {
script { script {
termStatusArray[termUE] = true termStatusArray[termUE] = true
} }
} }
} }
} }
stage('Terminate NR eNB') { stage('Terminate NR eNB') {
steps { steps {
echo '\u2705 \u001B[32mTerminate eNB\u001B[0m' echo '\u2705 \u001B[32mTerminate eNB\u001B[0m'
} }
post { post {
success { success {
script { script {
termStatusArray[termENB] = true termStatusArray[termENB] = true
} }
} }
} }
} }
} }
} }
stage('Log Collection') { stage('Log Collection') {
parallel { parallel {
stage('Log Collection (gNB and NR UE - Build)') { stage('Log Collection (gNB and NR UE - Build)') {
steps { steps {
withCredentials([ withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password']
]) { ]) {
echo '\u2705 \u001B[32mLog Collection (gNB and NR UE - Build)\u001B[0m' echo '\u2705 \u001B[32mLog Collection (gNB and NR UE - Build)\u001B[0m'
sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" sh "python3 ci-scripts/main.py --mode=LogCollectBuild --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}"
echo '\u2705 \u001B[32mLog Transfer (gNB and NR UE - Build)\u001B[0m' echo '\u2705 \u001B[32mLog Transfer (gNB and NR UE - Build)\u001B[0m'
sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true" sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/build.log.zip ./build.log.${env.BUILD_ID}.zip || true"
} }
script { script {
if(fileExists("build.log.${env.BUILD_ID}.zip")) { if(fileExists("build.log.${env.BUILD_ID}.zip")) {
archiveArtifacts "build.log.${env.BUILD_ID}.zip" archiveArtifacts "build.log.${env.BUILD_ID}.zip"
} }
} }
} }
} }
stage('Log Collection (gNB - Run)') { stage('Log Collection (gNB - Run)') {
steps { steps {
withCredentials([ withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password']
]) { ]) {
echo '\u2705 \u001B[32mLog Collection (gNB - Run)\u001B[0m' echo '\u2705 \u001B[32mLog Collection (gNB - Run)\u001B[0m'
sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}"
echo '\u2705 \u001B[32mLog Transfer (gNB - Run)\u001B[0m' echo '\u2705 \u001B[32mLog Transfer (gNB - Run)\u001B[0m'
sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/gnb.log.zip ./gnb.log.${env.BUILD_ID}.zip || true" sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/gnb.log.zip ./gnb.log.${env.BUILD_ID}.zip || true"
} }
script { script {
if(fileExists("gnb.log.${env.BUILD_ID}.zip")) { if(fileExists("gnb.log.${env.BUILD_ID}.zip")) {
archiveArtifacts "gnb.log.${env.BUILD_ID}.zip" archiveArtifacts "gnb.log.${env.BUILD_ID}.zip"
} }
if(fileExists("ci-scripts/test_results.html")) { if(fileExists("ci-scripts/test_results.html")) {
sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html" sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html"
sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html"
archiveArtifacts "test_results-${JOB_NAME}.html" archiveArtifacts "test_results-${JOB_NAME}.html"
} }
} }
} }
} }
stage('Log Collection (NR UE - Run)') { stage('Log Collection (NR UE - Run)') {
steps { steps {
withCredentials([ withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password'] [$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.eNB_Credentials}", usernameVariable: 'eNB_Username', passwordVariable: 'eNB_Password']
]) { ]) {
echo '\u2705 \u001B[32mLog Collection (gNB - Run)\u001B[0m' echo '\u2705 \u001B[32mLog Collection (gNB - Run)\u001B[0m'
sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}" sh "python3 ci-scripts/main.py --mode=LogCollecteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath}"
echo '\u2705 \u001B[32mLog Transfer (gNB - Run)\u001B[0m' echo '\u2705 \u001B[32mLog Transfer (gNB - Run)\u001B[0m'
sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/nr-ue.log.zip ./nr-ue.log.${env.BUILD_ID}.zip || true" sh "sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/nr-ue.log.zip ./nr-ue.log.${env.BUILD_ID}.zip || true"
} }
script { script {
if(fileExists("nr-ue.log.${env.BUILD_ID}.zip")) { if(fileExists("nr-ue.log.${env.BUILD_ID}.zip")) {
archiveArtifacts "nr-ue.log.${env.BUILD_ID}.zip" archiveArtifacts "nr-ue.log.${env.BUILD_ID}.zip"
} }
if(fileExists("ci-scripts/test_results.html")) { if(fileExists("ci-scripts/test_results.html")) {
sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html" sh "mv ci-scripts/test_results.html test_results-${JOB_NAME}.html"
sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html" sh "sed -i -e 's#TEMPLATE_JOB_NAME#${JOB_NAME}#' -e 's@build #TEMPLATE_BUILD_ID@build #${BUILD_ID}@' -e 's#Build-ID: TEMPLATE_BUILD_ID#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_STAGE_NAME#${testStageName}#' test_results-${JOB_NAME}.html"
archiveArtifacts "test_results-${JOB_NAME}.html" archiveArtifacts "test_results-${JOB_NAME}.html"
} }
} }
} }
} }
}
}
} }
post { }
}
post {
always { always {
script { script {
// Stage destroy may not be run if error in previous stage // Stage destroy may not be run if error in previous stage
......
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