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
d044813f
Commit
d044813f
authored
Oct 04, 2022
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete old, unused Jenkinsfiles
parent
3c5ad796
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
1429 deletions
+0
-1429
ci-scripts/Jenkinsfile-inria-r2lab
ci-scripts/Jenkinsfile-inria-r2lab
+0
-457
ci-scripts/Jenkinsfile-poll-gNB-UE
ci-scripts/Jenkinsfile-poll-gNB-UE
+0
-379
ci-scripts/Jenkinsfile-tmp-multi-enb-benetel
ci-scripts/Jenkinsfile-tmp-multi-enb-benetel
+0
-291
ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long
ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long
+0
-302
No files found.
ci-scripts/Jenkinsfile-inria-r2lab
deleted
100644 → 0
View file @
3c5ad796
#
!
/bin/
groovy
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
// Abstraction function to send social media messages:
// like on Slack or Mattermost
def
sendSocialMediaMessage
(
pipeChannel
,
pipeColor
,
pipeMessage
)
{
if
(
params
.
pipelineUsesSlack
!=
null
)
{
if
(
params
.
pipelineUsesSlack
)
{
slackSend
channel:
pipeChannel
,
color:
pipeColor
,
message:
pipeMessage
}
}
}
// Location of the test XML file to be run
def
testXMLFile
=
params
.
pythonTestXmlFile
def
mainPythonAllXmlFiles
=
""
def
buildStageStatus
=
true
// Name of the test stage
def
testStageName
=
params
.
pipelineTestStageName
// Name of the branch to work on
def
ranRepoBranch
=
params
.
pythonWorkingBranch
// Lease booking parameters
def
r2labStartTime
=
params
.
R2LAB_LeaseBookStartTime
def
r2labDuration
=
params
.
R2LAB_LeaseBookDuration
// Fixed deployment
def
r2labBaseIpAddr
=
'192.168.3.'
def
r2labPythonExeIdx
=
'14'
def
r2labPythonExe
=
'fit'
+
r2labPythonExeIdx
def
r2labENB0Idx
=
'23'
def
r2labENB0
=
'fit'
+
r2labENB0Idx
def
r2labENB0IpAddr
=
r2labBaseIpAddr
+
r2labENB0Idx
def
r2labEPC0Idx
=
'17'
def
r2labEPC0
=
'fit'
+
r2labEPC0Idx
def
r2labEPC0IpAddr
=
r2labBaseIpAddr
+
r2labEPC0Idx
def
r2labUE0Idx
=
'6'
def
r2labUE0
=
'fit0'
+
r2labUE0Idx
def
r2labUE0IpAddr
=
r2labBaseIpAddr
+
r2labUE0Idx
def
r2labENB1Idx
=
'16'
def
r2labENB1
=
'fit'
+
r2labENB1Idx
def
r2labENB1IpAddr
=
r2labBaseIpAddr
+
r2labENB1Idx
def
r2labDoAllOff
=
true
pipeline
{
agent
{
label
'master'
}
options
{
disableConcurrentBuilds
()
timestamps
()
ansiColor
(
'xterm'
)
}
stages
{
stage
(
"Book session"
)
{
steps
{
script
{
echo
'\u2705 \u001B[32mVerify Parameters\u001B[0m'
def
allParametersPresent
=
true
if
(
params
.
R2LAB_Credentials
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
R2LAB_FitNode_Credentials
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
R2LAB_LeaseBookStartTime
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
R2LAB_LeaseBookDuration
==
null
)
{
allParametersPresent
=
false
}
// If not present picking a default Stage Name
if
(
params
.
pipelineTestStageName
==
null
)
{
// picking default
testStageName
=
'Tests at Inria R2LAB'
}
// If not present picking a default branch name
if
(
params
.
pythonWorkingBranch
==
null
)
{
ranRepoBranch
=
'develop'
}
if
(
params
.
pythonTestXmlFile
==
null
)
{
// picking default
testXMLFile
=
'xml_files/inria/enb_usrp210_band7_build.xml'
echo
"Test XML file(default): ${testXMLFile}"
mainPythonAllXmlFiles
+=
"--XMLTestFile="
+
testXMLFile
+
" "
}
else
{
String
[]
myXmlTestSuite
=
testXMLFile
.
split
(
"\\r?\\n"
)
for
(
xmlFile
in
myXmlTestSuite
)
{
mainPythonAllXmlFiles
+=
"--XMLTestFile="
+
xmlFile
+
" "
echo
"Test XML file : ${xmlFile}"
}
}
if
(!
allParametersPresent
)
{
currentBuild
.
result
=
'ABORTED'
error
(
'Stopping early because no R2LAB credentials'
)
}
JOB_TIMESTAMP
=
sh
returnStdout:
true
,
script:
'date --rfc-3339=seconds | sed -e "s#+00:00##"'
JOB_TIMESTAMP
=
JOB_TIMESTAMP
.
trim
()
echo
'\u2705 \u001B[32mBook a Session\u001B[0m'
BOOK_TIMESTAMP
=
sh
returnStdout:
true
,
script:
'date --rfc-3339=date'
BOOK_TIMESTAMP
=
BOOK_TIMESTAMP
.
trim
()
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_Credentials}"
,
usernameVariable:
'r2labuser'
,
passwordVariable:
'r2labpassword'
]
])
{
sh
"python3 /home/eurecom/inria-scripts/booking-lease.py --book-lease --from ${BOOK_TIMESTAMP}T${r2labStartTime} --duration ${r2labDuration} --slice inria_oaici ${r2labuser} ${r2labpassword}"
sh
"python3 /home/eurecom/inria-scripts/booking-lease.py --get-leases ${r2labuser} ${r2labpassword} | grep -v nightly"
}
// Adding a tempo after booking leases
sh
"sleep 10"
LEASE_STATUS
=
sh
returnStdout:
true
,
script:
"ssh -t inria_oaici@faraday.inria.fr 'rleases --check'"
LEASE_STATUS
=
LEASE_STATUS
.
trim
()
if
(
LEASE_STATUS
==~
/.*Access currently denied to inria_oaici.*/
)
{
r2labDoAllOff
=
false
currentBuild
.
result
=
'ABORTED'
error
(
'Stopping early because R2LAB not available'
)
}
}
}
}
stage
(
"Load Images"
)
{
steps
{
script
{
sh
"ssh -t inria_oaici@faraday.inria.fr 'all-off'"
sh
"sleep 10"
echo
'\u2705 \u001B[32mLoad Image for Python Executor\u001B[0m'
try
{
sh
"ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labPythonExeIdx} > /dev/null 2>&1'"
}
catch
(
Exception
e
)
{
echo
"Why is it wrong?"
}
try
{
//sh "ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labPythonExeIdx}'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'rwait ${r2labPythonExeIdx}'"
}
catch
(
Exception
e
)
{
echo
"Why is it wrong?"
}
echo
'\u2705 \u001B[32mLoad Image for two (2) eNBs\u001B[0m'
try
{
sh
"ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labENB0Idx},${r2labENB1Idx} > /dev/null 2>&1'"
}
catch
(
Exception
e
)
{
echo
"Why is it wrong?"
}
try
{
sh
"ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labENB0Idx},${r2labENB1Idx}'"
}
catch
(
Exception
e
)
{
echo
"Why is it wrong?"
}
sh
"ssh -t inria_oaici@faraday.inria.fr 'uon ${r2labENB0Idx},${r2labENB1Idx}'"
sh
"sleep 5"
sh
"ssh -t inria_oaici@faraday.inria.fr 'uon ${r2labENB0Idx},${r2labENB1Idx}'"
echo
'\u2705 \u001B[32mLoad Image for one OAI UE\u001B[0m'
sh
"ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-enb-ue ${r2labUE0Idx} > /dev/null 2>&1'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labUE0Idx}'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'uon ${r2labUE0Idx}'"
sh
"sleep 5"
sh
"ssh -t inria_oaici@faraday.inria.fr 'uon ${r2labUE0Idx}'"
echo
'\u2705 \u001B[32mLoad Image for one EPC\u001B[0m'
sh
"ssh -t inria_oaici@faraday.inria.fr 'rload -i oai-ci-cd-u18-lowlatency-epc ${r2labEPC0Idx} > /dev/null 2>&1'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'rwait --silent ${r2labEPC0Idx}'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'nodes ${r2labUE0Idx},${r2labPythonExeIdx},${r2labEPC0Idx},${r2labENB0Idx},${r2labENB1Idx} && st'"
}
}
}
stage
(
"Prepare Python Executor"
)
{
steps
{
script
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g && git fetch --all --prune --quiet\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g && git checkout --quiet ${ranRepoBranch}\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g && git pull --quiet origin ${ranRepoBranch}\"'"
GIT_COMMIT_TO_RUN
=
sh
returnStdout:
true
,
script:
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g && git log -n1 --pretty=format:%H\"' | grep -v fit"
GIT_COMMIT_TO_RUN
=
GIT_COMMIT_TO_RUN
.
trim
()
echo
"Latest commit to use is ${GIT_COMMIT_TO_RUN}"
// Putting the adaptation parameters for the OAI UE
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp /home/inria_oaici/for-ci/adapt_usim_parameters_${r2labUE0}.sed ${fituser}@${r2labUE0}:/tmp/adapt_usim_parameters.sed'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp /home/inria_oaici/for-ci/phones_list.txt ${fituser}@${r2labEPC0}:/tmp'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S cp /tmp/phones_list.txt /etc/ci\"'"
// Out of rload, the sub-network-interfaces are not up
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:m11 172.16.1.102 up\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:m10 192.168.10.110 up\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:sxu 172.55.55.102 up\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:sxc 172.55.55.101 up\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:s5c 172.58.58.102 up\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:p5c 172.58.58.101 up\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ifconfig control:s11 172.16.1.104 up\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"ifconfig\"'"
// Adding routes on the EPC
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ip route add default via 192.168.3.100 dev control table lte\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ip rule add from 12.0.0.0/8 table lte\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labEPC0} \"echo ${fitpasswd} | sudo -S ip rule add from 12.1.1.0/8 table lte\"'"
// For the moment, simple way to route traffic from python executor to any UEs
sh
"ssh -t inria_oaici@faraday.inria.fr 'ssh -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"echo ${fitpasswd} | sudo -S ip route add 12.1.1.0/24 via ${r2labEPC0IpAddr} dev control\"'"
}
}
}
}
stage
(
"Build and Test"
)
{
steps
{
script
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=InitiateHtml --ranRepository=https://gitlab.eurecom.fr/oai/openairinterface5g --ranBranch=${ranRepoBranch} --ranCommitID=${GIT_COMMIT_TO_RUN} --ranAllowMerge=false --ADBIPAddress=${r2labEPC0IpAddr} --ADBUserName=${fituser} --ADBPassword=${fitpasswd} --ADBType=distributed ${mainPythonAllXmlFiles}\"'"
String
[]
myXmlTestSuite
=
testXMLFile
.
split
(
"\\r?\\n"
)
for
(
xmlFile
in
myXmlTestSuite
)
{
try
{
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=TesteNB --ranRepository=https://gitlab.eurecom.fr/oai/openairinterface5g --ranBranch=${ranRepoBranch} --ranCommitID=${GIT_COMMIT_TO_RUN} --ranAllowMerge=false --eNBIPAddress=${r2labENB0IpAddr} --eNBUserName=${fituser} --eNBPassword=${fitpasswd} --eNBSourceCodePath=/home/${fituser}/openairinterface5g --eNB1IPAddress=${r2labENB1IpAddr} --eNB1UserName=${fituser} --eNB1Password=${fitpasswd} --eNB1SourceCodePath=/home/${fituser}/openairinterface5g --UEIPAddress=${r2labUE0IpAddr} --UEUserName=${fituser} --UEPassword=${fitpasswd} --UESourceCodePath=/home/${fituser}/openairinterface5g --EPCIPAddress=${r2labEPC0IpAddr} --EPCType=OAI-Rel14-CUPS --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --ADBIPAddress=${r2labEPC0IpAddr} --ADBUserName=${fituser} --ADBPassword=${fitpasswd} --ADBType=distributed --XMLTestFile=${xmlFile}\"'"
}
catch
(
Exception
e
)
{
currentBuild
.
result
=
'FAILURE'
buildStageStatus
=
false
}
}
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${r2labENB0IpAddr} --eNBUserName=${fituser} --eNBPassword=${fitpasswd}\"'"
}
}
}
}
stage
(
"Prepare Log Collection"
)
{
steps
{
sh
"ssh -t inria_oaici@faraday.inria.fr 'mkdir -p /home/inria_oaici/archives'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'touch /home/inria_oaici/archives/no_error.txt'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'rm -f /home/inria_oaici/archives/*.*'"
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labPythonExe}:/home/${fituser}/openairinterface5g/ci-scripts/test_results.html /home/inria_oaici/archives'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/test_results.html ."
script
{
if
(
fileExists
(
"./test_results.html"
))
{
sh
"mv ./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}#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_results-${JOB_NAME}.html"
archiveArtifacts
"test_results-${JOB_NAME}.html"
}
}
}
}
stage
(
"Log Collection"
)
{
parallel
{
stage
(
'Log Collection (OAI eNB - Build)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (OAI eNB - Build)\u001B[0m'
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectBuild --eNBIPAddress=${r2labENB0IpAddr} --eNBUserName=${fituser} --eNBPassword=${fitpasswd} --eNBSourceCodePath=/home/${fituser}/openairinterface5g\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labENB0}:/home/${fituser}/openairinterface5g/cmake_targets/build.log.zip /home/inria_oaici/archives/enb.build.log.zip'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/enb.build.log.zip enb.build.log.${env.BUILD_ID}.zip"
script
{
if
(
fileExists
(
"enb.build.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"enb.build.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (OAI UE - Build)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (OAI UE - Build)\u001B[0m'
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectBuild --UEIPAddress=${r2labUE0IpAddr} --UEUserName=${fituser} --UEPassword=${fitpasswd} --UESourceCodePath=/home/${fituser}/openairinterface5g\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labUE0}:/home/${fituser}/openairinterface5g/cmake_targets/build.log.zip /home/inria_oaici/archives/ue.build.log.zip'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/ue.build.log.zip ue.build.log.${env.BUILD_ID}.zip"
script
{
if
(
fileExists
(
"ue.build.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"ue.build.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (OAI eNB - Runs)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (OAI eNB - Runs)\u001B[0m'
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollecteNB --eNBIPAddress=${r2labENB0IpAddr} --eNBUserName=${fituser} --eNBPassword=${fitpasswd} --eNBSourceCodePath=/home/${fituser}/openairinterface5g\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labENB0}:/home/${fituser}/openairinterface5g/cmake_targets/enb.log.zip /home/inria_oaici/archives/enb.run.log.zip'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/enb.run.log.zip enb.run.log.${env.BUILD_ID}.zip"
script
{
if
(
fileExists
(
"enb.run.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"enb.run.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (OAI UE - Runs)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (OAI UE - Runs)\u001B[0m'
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectOAIUE --UEIPAddress=${r2labUE0IpAddr} --UEUserName=${fituser} --UEPassword=${fitpasswd} --UESourceCodePath=/home/${fituser}/openairinterface5g\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labUE0}:/home/${fituser}/openairinterface5g/cmake_targets/ue.log.zip /home/inria_oaici/archives/ue.run.log.zip'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/ue.run.log.zip ue.run.log.${env.BUILD_ID}.zip"
script
{
if
(
fileExists
(
"ue.run.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"ue.run.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (MME)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (MME)\u001B[0m'
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectMME --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/mme.log.zip /home/inria_oaici/archives/mme.log.zip'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/mme.log.zip mme.log.${env.BUILD_ID}.zip"
script
{
if
(
fileExists
(
"mme.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"mme.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (HSS)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (HSS)\u001B[0m'
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectHSS --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/hss.log.zip /home/inria_oaici/archives/hss.log.zip'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/hss.log.zip hss.log.${env.BUILD_ID}.zip"
script
{
if
(
fileExists
(
"hss.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"hss.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (SPGW)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (SPGW)\u001B[0m'
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectSPGW --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/spgw.log.zip /home/inria_oaici/archives/spgw.log.zip'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/spgw.log.zip spgw.log.${env.BUILD_ID}.zip"
script
{
if
(
fileExists
(
"spgw.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"spgw.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (Ping)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (Ping)\u001B[0m'
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectPing --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/ping.log.zip /home/inria_oaici/archives/ping.log.zip'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/ping.log.zip ping.log.${env.BUILD_ID}.zip"
script
{
if
(
fileExists
(
"ping.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"ping.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (Iperf)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.R2LAB_FitNode_Credentials}"
,
usernameVariable:
'fituser'
,
passwordVariable:
'fitpasswd'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (Iperf)\u001B[0m'
sh
"ssh -t -t inria_oaici@faraday.inria.fr 'ssh -t -t -b 192.168.3.100 ${fituser}@${r2labPythonExe} \"cd openairinterface5g/ci-scripts && python3 main.py --mode=LogCollectIperf --EPCIPAddress=${r2labEPC0IpAddr} --EPCUserName=${fituser} --EPCPassword=${fitpasswd} --EPCSourceCodePath=/home/${fituser}/openair-cn --EPCType=OAI-Rel14-CUPS\"'"
sh
"ssh -t inria_oaici@faraday.inria.fr 'scp ${fituser}@${r2labEPC0}:/home/${fituser}/openair-cn/scripts/iperf.log.zip /home/inria_oaici/archives/iperf.log.zip'"
}
sh
"scp inria_oaici@faraday.inria.fr:/home/inria_oaici/archives/iperf.log.zip iperf.log.${env.BUILD_ID}.zip"
script
{
if
(
fileExists
(
"iperf.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"iperf.log.${env.BUILD_ID}.zip"
}
}
}
}
}
}
stage
(
"Clean-up Log Collection"
)
{
steps
{
sh
"ssh -t inria_oaici@faraday.inria.fr 'rm -Rf /home/inria_oaici/archives'"
}
}
}
post
{
always
{
script
{
if
(
r2labDoAllOff
)
{
echo
'\u2705 \u001B[32mShutdown every node\u001B[0m'
sh
'ssh -t inria_oaici@faraday.inria.fr "all-off"'
sh
'ssh -t inria_oaici@faraday.inria.fr "all-off"'
}
}
}
}
}
ci-scripts/Jenkinsfile-poll-gNB-UE
deleted
100644 → 0
View file @
3c5ad796
#
!
/bin/
groovy
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
// Abstraction function to send social media messages:
// like on Slack or Mattermost
def
sendSocialMediaMessage
(
pipeChannel
,
pipeColor
,
pipeMessage
)
{
if
(
params
.
pipelineUsesSlack
!=
null
)
{
if
(
params
.
pipelineUsesSlack
)
{
slackSend
channel:
pipeChannel
,
color:
pipeColor
,
message:
pipeMessage
}
}
}
// Location of the test XML file to be run
def
testXMLFile
=
params
.
pythonTestXmlFile
def
mainPythonAllXmlFiles
=
""
def
buildStageStatus
=
true
// Name of the resource
def
lockResources
=
[]
if
(
params
.
LockResources
!=
null
&&
params
.
LockResources
.
trim
().
length
()
>
0
)
params
.
LockResources
.
trim
().
split
(
","
).
each
{
lockResources
+=
[
resource:
it
.
trim
()]}
// Terminate Status
def
termUE
=
0
def
termENB
=
1
def
termStatusArray
=
new
Boolean
[
2
]
termStatusArray
[
termUE
]
=
false
termStatusArray
[
termENB
]
=
false
// Global Parameters.
def
eNB_Repository
def
eNB_Branch
def
eNB_CommitID
def
eNB_AllowMergeRequestProcess
=
false
def
eNB_TargetBranch
=
"develop-nr"
def
GIT_COMMIT_AUTHOR
def
GIT_COMMIT_EMAIL
def
testStageName
// Global Parameters not to break the main.py command line and code.
def
ADB_IPAddress
=
"none"
def
ADB_Username
=
"none"
def
ADB_Password
=
"none"
def
EPC_IPAddress
=
"none"
def
EPC_Username
=
"none"
def
EPC_Password
=
"none"
pipeline
{
agent
{
label
pythonExecutor
}
options
{
disableConcurrentBuilds
()
gitLabConnection
(
'OAI GitLab'
)
ansiColor
(
'xterm'
)
lock
(
extra:
lockResources
)
}
stages
{
stage
(
'Retrieve latest from branch'
)
{
steps
{
script
{
checkout
([
$class
:
'GitSCM'
,
branches:
[[
name:
"${params.Branch}"
]],
doGenerateSubmoduleConfigurations:
false
,
extensions:
[],
submoduleCfg:
[],
userRemoteConfigs:
[[
url:
'https://gitlab.eurecom.fr/oai/openairinterface5g.git'
]]])
sh
"git clean -x -d -ff"
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}"
}
}
}
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'
def
allParametersPresent
=
true
// It is already too late to check it
if
(
params
.
pythonExecutor
!=
null
)
{
echo
"eNB CI executor node : ${pythonExecutor}"
}
if
(
params
.
eNB_Repository
==
null
)
{
eNB_Repository
=
GIT_URL
}
else
{
eNB_Repository
=
params
.
eNB_Repository
}
echo
"eNB_Repository = ${eNB_Repository}"
if
(
params
.
eNB_Branch
==
null
)
{
eNB_Branch
=
GIT_BRANCH
}
else
{
eNB_Branch
=
params
.
eNB_Branch
}
echo
"eNB_Branch = ${eNB_Branch}"
if
(
params
.
eNB_CommitID
==
null
)
{
eNB_CommitID
=
GIT_COMMIT
}
else
{
eNB_CommitID
=
params
.
eNB_CommitID
}
echo
"eNB_CommitID = ${eNB_CommitID}"
// If not present picking a default Stage Name
if
(
params
.
pipelineTestStageName
==
null
)
{
// picking default
testStageName
=
'Template Test Stage'
}
else
{
testStageName
=
params
.
pipelineTestStageName
}
if
(
params
.
LockResources
==
null
)
{
echo
"no LockResources given"
allParametersPresent
=
false
}
if
(
params
.
eNB_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
UE_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB_SourceCodePath
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB_Credentials
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
UE_Credentials
==
null
)
{
allParametersPresent
=
false
}
GIT_COMMIT_AUTHOR
=
sh
(
script:
'git show -s --pretty=%an'
,
returnStdout:
true
).
trim
()
echo
"The author of the commit is: ${GIT_COMMIT_AUTHOR}"
GIT_COMMIT_EMAIL
=
sh
(
script:
'git show -s --pretty=%ae'
,
returnStdout:
true
).
trim
()
echo
"The email of the author is: ${GIT_COMMIT_EMAIL}"
if
(
allParametersPresent
)
{
echo
"All parameters are present"
}
else
{
echo
"Some parameters are missing"
sh
"./ci-scripts/fail.sh"
}
}
}
}
stage
(
"Build and Test"
)
{
steps
{
script
{
dir
(
'ci-scripts'
)
{
// If not present picking a default XML file
if
(
params
.
pythonTestXmlFile
==
null
)
{
// picking default
testXMLFile
=
'xml_files/gnb_usrp_build.xml'
echo
"Test XML file(default): ${testXMLFile}"
mainPythonAllXmlFiles
+=
"--XMLTestFile="
+
testXMLFile
+
" "
}
else
{
String
[]
myXmlTestSuite
=
testXMLFile
.
split
(
"\\r?\\n"
)
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
fileExists
(
xmlFile
))
{
mainPythonAllXmlFiles
+=
"--XMLTestFile="
+
xmlFile
+
" "
echo
"Test XML file : ${xmlFile}"
}
}
}
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_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} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} ${mainPythonAllXmlFiles}"
String
[]
myXmlTestSuite
=
testXMLFile
.
split
(
"\\r?\\n"
)
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
fileExists
(
xmlFile
))
{
try
{
sh
"python3 main.py --mode=TesteNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --UEIPAddress=${params.eNB_IPAddress} --UEUserName=${eNB_Username} --UEPassword=${eNB_Password} --UESourceCodePath=${params.eNB_SourceCodePath} --eNBRepository=${eNB_Repository} --eNBBranch=${eNB_Branch} --eNBCommitID=${eNB_CommitID} --eNB_AllowMerge=${eNB_AllowMergeRequestProcess} --eNBTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --EPCIPAddress=${EPC_IPAddress} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=/tmp/${EPC_Username} --EPCType=ltebox --XMLTestFile=${xmlFile}"
}
catch
(
Exception
e
)
{
currentBuild
.
result
=
'FAILURE'
buildStageStatus
=
false
}
}
}
sh
"python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
}
}
}
}
}
stage
(
"Terminate"
)
{
parallel
{
stage
(
'Terminate NR UE'
)
{
steps
{
echo
'\u2705 \u001B[32mTerminate NR UE\u001B[0m'
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'UE_Username'
,
passwordVariable:
'UE_Password'
]
])
{
sh
"python3 ci-scripts/main.py --mode=TerminateOAIUE --UEIPAddress=${params.eNB_IPAddress} --UEUserName=${UE_Username} --UEPassword=${UE_Password}"
}
}
post
{
success
{
script
{
termStatusArray
[
termUE
]
=
true
}
}
}
}
stage
(
'Terminate NR eNB'
)
{
steps
{
echo
'\u2705 \u001B[32mTerminate NR eNB\u001B[0m'
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
]
])
{
sh
"python3 ci-scripts/main.py --mode=TerminateeNB --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
}
}
post
{
success
{
script
{
termStatusArray
[
termENB
]
=
true
}
}
}
}
}
}
stage
(
'Log Collection'
)
{
parallel
{
stage
(
'Log Collection (gNB and NR UE - Build)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
]
])
{
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}"
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"
}
script
{
if
(
fileExists
(
"build.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"build.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (gNB - Run)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
]
])
{
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}"
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/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true"
}
script
{
if
(
fileExists
(
"enb.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"enb.log.${env.BUILD_ID}.zip"
}
if
(
fileExists
(
"ci-scripts/test_results.html"
))
{
sh
"mv ci-scripts/test_results.html test_results-${JOB_NAME}.html"
sh
"sed -i -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' -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"
}
}
}
}
stage
(
'Log Collection (NR UE - Run)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (gNB - Run)\u001B[0m'
sh
"python3 ci-scripts/main.py --mode=LogCollectOAIUE --UEIPAddress=${params.eNB_IPAddress} --UEUserName=${eNB_Username} --UEPassword=${eNB_Password} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --UESourceCodePath=${params.eNB_SourceCodePath}"
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/ue.log.zip ./ue.log.${env.BUILD_ID}.zip || true"
}
script
{
if
(
fileExists
(
"ue.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"ue.log.${env.BUILD_ID}.zip"
}
}
}
}
}
}
}
post
{
always
{
script
{
if
(
"MERGE"
.
equals
(
env
.
gitlabActionType
))
{
echo
"This is a MERGE event"
}
else
{
gitlabCommitStatus
(
name:
"Test-gNB-nrUE"
)
{
if
((
currentBuild
.
result
==
null
)
||
(
currentBuild
.
result
==
'SUCCESS'
))
{
echo
"Setting the gitlab commit status to pass"
}
else
{
sh
"./ci-scripts/fail.sh"
}
}
}
emailext
attachmentsPattern:
'*results*.html'
,
body:
'''Hi,
Here are attached HTML report files for $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
Regards,
OAI CI Team'''
,
replyTo:
'no-reply@openairinterface.org'
,
subject:
'$PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
,
to:
GIT_COMMIT_EMAIL
}
}
success
{
script
{
def
message
=
"OAI "
+
JOB_NAME
+
" build ("
+
BUILD_ID
+
"): passed ("
+
BUILD_URL
+
")"
if
(
"MERGE"
.
equals
(
env
.
gitlabActionType
))
{
echo
"This is a MERGE event"
//addGitLabMRComment comment: message
def
message2
=
"OAI "
+
JOB_NAME
+
" build ("
+
BUILD_ID
+
"): passed ("
+
BUILD_URL
+
") -- MergeRequest #"
+
env
.
gitlabMergeRequestIid
+
" ("
+
env
.
gitlabMergeRequestTitle
+
")"
sendSocialMediaMessage
(
'ci-test'
,
'good'
,
message2
)
}
else
{
sendSocialMediaMessage
(
'ci-test'
,
'good'
,
message
)
}
}
}
failure
{
script
{
def
message
=
"OAI "
+
JOB_NAME
+
" build ("
+
BUILD_ID
+
"): failed ("
+
BUILD_URL
+
")"
if
(
"MERGE"
.
equals
(
env
.
gitlabActionType
))
{
echo
"This is a MERGE event"
//addGitLabMRComment comment: message
def
message2
=
"OAI "
+
JOB_NAME
+
" build ("
+
BUILD_ID
+
"): failed ("
+
BUILD_URL
+
") -- MergeRequest #"
+
env
.
gitlabMergeRequestIid
+
" ("
+
env
.
gitlabMergeRequestTitle
+
")"
sendSocialMediaMessage
(
'ci-test'
,
'danger'
,
message2
)
}
else
{
sendSocialMediaMessage
(
'ci-test'
,
'danger'
,
message
)
}
}
}
}
}
ci-scripts/Jenkinsfile-tmp-multi-enb-benetel
deleted
100644 → 0
View file @
3c5ad796
#
!
/bin/
groovy
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
// Template Jenkins Declarative Pipeline script to run Test w/ RF HW
// Location of the python executor node shall be in the same subnet as the others servers
def
pythonExecutor
=
params
.
pythonExecutor
// Location of the test XML file to be run
def
testXMLFile
=
params
.
pythonTestXmlFile
def
mainPythonAllXmlFiles
=
""
def
buildStageStatus
=
true
// Name of the test stage
def
testStageName
=
params
.
pipelineTestStageName
def
lockResources
=
[]
if
(
params
.
LockResources
!=
null
&&
params
.
LockResources
.
trim
().
length
()
>
0
)
params
.
LockResources
.
trim
().
split
(
","
).
each
{
lockResources
+=
[
resource:
it
.
trim
()]}
// Global Parameters. Normally they should be populated when the master job
// triggers the slave job with parameters
def
eNB_Repository
def
eNB_Branch
def
eNB_CommitID
def
eNB_AllowMergeRequestProcess
def
eNB_TargetBranch
pipeline
{
agent
{
label
pythonExecutor
}
options
{
disableConcurrentBuilds
()
ansiColor
(
'xterm'
)
lock
(
extra:
lockResources
)
}
stages
{
stage
(
"Build Init"
)
{
steps
{
// update the build name and description
buildName
"${params.eNB_MR}"
buildDescription
"Branch : ${params.eNB_Branch}"
}
}
stage
(
"Verify Parameters"
)
{
steps
{
script
{
echo
'\u2705 \u001B[32mVerify Parameters\u001B[0m'
def
allParametersPresent
=
true
// It is already to late to check it
if
(
params
.
pythonExecutor
!=
null
)
{
echo
"eNB CI executor node : ${pythonExecutor}"
}
// If not present picking a default Stage Name
if
(
params
.
pipelineTestStageName
==
null
)
{
// picking default
testStageName
=
'Template Test Stage'
}
if
(
params
.
LockResources
==
null
)
{
echo
"no LockResources given"
allParametersPresent
=
false
}
// 1st eNB parameters
if
(
params
.
eNB_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB_SourceCodePath
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB_Credentials
==
null
)
{
allParametersPresent
=
false
}
// 2nd eNB parameters
if
(
params
.
eNB1_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB1_SourceCodePath
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB1_Credentials
==
null
)
{
allParametersPresent
=
false
}
// 3rd eNB parameters
if
(
params
.
eNB2_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB2_SourceCodePath
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB2_Credentials
==
null
)
{
allParametersPresent
=
false
}
// the following 4 parameters should be pushed by the master trigger
// if not present, take the job GIT variables (used for developing)
if
(
params
.
eNB_Repository
==
null
)
{
eNB_Repository
=
env
.
GIT_URL
}
else
{
eNB_Repository
=
params
.
eNB_Repository
}
echo
"eNB_Repository : ${eNB_Repository}"
if
(
params
.
eNB_Branch
==
null
)
{
eNB_Branch
=
env
.
GIT_BRANCH
}
else
{
eNB_Branch
=
params
.
eNB_Branch
}
echo
"eNB_Branch : ${eNB_Branch}"
if
(
params
.
eNB_CommitID
==
null
)
{
eNB_CommitID
=
env
.
GIT_COMMIT
}
else
{
eNB_CommitID
=
params
.
eNB_CommitID
}
echo
"eNB_CommitID : ${eNB_CommitID}"
if
(
params
.
eNB_mergeRequest
!=
null
)
{
eNB_AllowMergeRequestProcess
=
params
.
eNB_mergeRequest
if
(
eNB_AllowMergeRequestProcess
)
{
if
(
params
.
eNB_TargetBranch
!=
null
)
{
eNB_TargetBranch
=
params
.
eNB_TargetBranch
}
else
{
eNB_TargetBranch
=
'develop'
}
echo
"eNB_TargetBranch : ${eNB_TargetBranch}"
}
}
if
(
params
.
EPC_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
EPC_Type
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
EPC_SourceCodePath
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
EPC_Credentials
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
ADB_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
ADB_Credentials
==
null
)
{
allParametersPresent
=
false
}
if
(
allParametersPresent
)
{
echo
"All parameters are present"
if
(
eNB_AllowMergeRequestProcess
)
{
sh
"git fetch"
sh
"./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest"
}
else
{
sh
"git fetch"
sh
"git checkout -f ${eNB_CommitID}"
}
}
else
{
echo
"Some parameters are missing"
sh
"./ci-scripts/fail.sh"
}
}
}
}
stage
(
"Build and Test"
)
{
steps
{
script
{
dir
(
'ci-scripts'
)
{
echo
"\u2705 \u001B[32m${testStageName}\u001B[0m"
// If not present picking a default XML file
if
(
params
.
pythonTestXmlFile
==
null
)
{
// picking default
testXMLFile
=
'xml_files/enb_usrpB210_band7_50PRB.xml'
echo
"Test XML file(default): ${testXMLFile}"
mainPythonAllXmlFiles
+=
"--XMLTestFile="
+
testXMLFile
+
" "
}
else
{
String
[]
myXmlTestSuite
=
testXMLFile
.
split
(
"\\r?\\n"
)
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
fileExists
(
xmlFile
))
{
mainPythonAllXmlFiles
+=
"--XMLTestFile="
+
xmlFile
+
" "
echo
"Test XML file : ${xmlFile}"
}
}
}
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
],
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB1_Credentials}"
,
usernameVariable:
'eNB1_Username'
,
passwordVariable:
'eNB1_Password'
],
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB2_Credentials}"
,
usernameVariable:
'eNB2_Username'
,
passwordVariable:
'eNB2_Password'
],
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.EPC_Credentials}"
,
usernameVariable:
'EPC_Username'
,
passwordVariable:
'EPC_Password'
],
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.ADB_Credentials}"
,
usernameVariable:
'ADB_Username'
,
passwordVariable:
'ADB_Password'
]
])
{
sh
"python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}"
String
[]
myXmlTestSuite
=
testXMLFile
.
split
(
"\\r?\\n"
)
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
fileExists
(
xmlFile
))
{
try
{
sh
"python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}"
}
catch
(
Exception
e
)
{
currentBuild
.
result
=
'FAILURE'
buildStageStatus
=
false
}
}
}
sh
"python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
}
}
}
}
}
stage
(
'Log Collection'
)
{
parallel
{
stage
(
'Log Collection (eNB - Build)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (eNB - 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}"
echo
'\u2705 \u001B[32mLog Transfer (eNB - 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"
}
script
{
if
(
fileExists
(
"build.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"build.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (eNB - Run)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (eNB - 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}"
echo
'\u2705 \u001B[32mLog Transfer (eNB - Run)\u001B[0m'
sh
"sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true"
}
script
{
if
(
fileExists
(
"enb.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"enb.log.${env.BUILD_ID}.zip"
}
if
(
fileExists
(
"ci-scripts/test_results.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"
archiveArtifacts
"test_results-${JOB_NAME}.html"
}
}
}
}
}
}
}
post
{
always
{
script
{
if
(
params
.
pipelineZipsConsoleLog
!=
null
)
{
if
(
params
.
pipelineZipsConsoleLog
)
{
echo
"Archiving Jenkins console log"
sh
"wget --no-check-certificate --no-proxy ${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}/consoleText -O consoleText.log || true"
sh
"zip -m consoleText.log.${env.BUILD_ID}.zip consoleText.log || true"
if
(
fileExists
(
"consoleText.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"consoleText.log.${env.BUILD_ID}.zip"
}
}
}
}
}
}
}
ci-scripts/Jenkinsfile-tmp-multi-enb-benetel-long
deleted
100644 → 0
View file @
3c5ad796
#
!
/bin/
groovy
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* 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
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
// Template Jenkins Declarative Pipeline script to run Test w/ RF HW
// Location of the python executor node shall be in the same subnet as the others servers
def
pythonExecutor
=
params
.
pythonExecutor
// Location of the test XML file to be run
def
testXMLFile
=
params
.
pythonTestXmlFile
def
mainPythonAllXmlFiles
=
""
def
buildStageStatus
=
true
// Name of the test stage
def
testStageName
=
params
.
pipelineTestStageName
def
lockResources
=
[]
if
(
params
.
LockResources
!=
null
&&
params
.
LockResources
.
trim
().
length
()
>
0
)
params
.
LockResources
.
trim
().
split
(
","
).
each
{
lockResources
+=
[
resource:
it
.
trim
()]}
// Global Parameters. Populated when the master job
// triggers the slave job with parameters
def
eNB_Repository
=
"https://gitlab.eurecom.fr/oai/openairinterface5g.git"
def
eNB_Branch
=
"develop"
def
eNB_CommitID
def
eNB_AllowMergeRequestProcess
=
false
def
eNB_TargetBranch
=
"develop"
def
eNB_MR
=
"develop"
pipeline
{
agent
{
label
pythonExecutor
}
options
{
disableConcurrentBuilds
()
ansiColor
(
'xterm'
)
lock
(
extra:
lockResources
)
}
stages
{
stage
(
"Build Init"
)
{
steps
{
script
{
//retrieve latest commit ID from branch
latest_commit_from_branch
=
sh
returnStdout:
true
,
script:
'git log -1 origin/${eNB_Branch} | grep commit'
echo
"Branch ${eNB_Branch}"
echo
"${latest_commit_from_branch}"
tmp
=
latest_commit_from_branch
.
split
()
echo
"${tmp}"
eNB_CommitID
=
tmp
[
1
]
echo
"eNB_CommitID ${eNB_CommitID}"
// update the build name and description
buildName
"${params.eNB_MR}"
buildDescription
"Commit : ${eNB_CommitID}"
}
}
}
stage
(
"Verify Parameters"
)
{
steps
{
script
{
echo
'\u2705 \u001B[32mVerify Parameters\u001B[0m'
def
allParametersPresent
=
true
// It is already to late to check it
if
(
params
.
pythonExecutor
!=
null
)
{
echo
"eNB CI executor node : ${pythonExecutor}"
}
// If not present picking a default Stage Name
if
(
params
.
pipelineTestStageName
==
null
)
{
// picking default
testStageName
=
'Template Test Stage'
}
if
(
params
.
LockResources
==
null
)
{
echo
"no LockResources given"
allParametersPresent
=
false
}
// 1st eNB parameters
if
(
params
.
eNB_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB_SourceCodePath
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB_Credentials
==
null
)
{
allParametersPresent
=
false
}
// 2nd eNB parameters
if
(
params
.
eNB1_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB1_SourceCodePath
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB1_Credentials
==
null
)
{
allParametersPresent
=
false
}
// 3rd eNB parameters
if
(
params
.
eNB2_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB2_SourceCodePath
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
eNB2_Credentials
==
null
)
{
allParametersPresent
=
false
}
// the following 4 parameters should be pushed by the master trigger
// if not present, take the job GIT variables (used for developing)
if
(
params
.
eNB_Repository
==
null
)
{
eNB_Repository
=
env
.
GIT_URL
}
else
{
eNB_Repository
=
params
.
eNB_Repository
}
echo
"eNB_Repository : ${eNB_Repository}"
if
(
params
.
eNB_Branch
==
null
)
{
eNB_Branch
=
env
.
GIT_BRANCH
}
else
{
eNB_Branch
=
params
.
eNB_Branch
}
echo
"eNB_Branch : ${eNB_Branch}"
//if (params.eNB_CommitID == null) {
// eNB_CommitID = env.GIT_COMMIT
//} else {
// eNB_CommitID = params.eNB_CommitID
//}
echo
"eNB_CommitID : ${eNB_CommitID}"
if
(
params
.
eNB_mergeRequest
!=
null
)
{
eNB_AllowMergeRequestProcess
=
params
.
eNB_mergeRequest
if
(
eNB_AllowMergeRequestProcess
)
{
if
(
params
.
eNB_TargetBranch
!=
null
)
{
eNB_TargetBranch
=
params
.
eNB_TargetBranch
}
else
{
eNB_TargetBranch
=
'develop'
}
echo
"eNB_TargetBranch : ${eNB_TargetBranch}"
}
}
if
(
params
.
EPC_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
EPC_Type
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
EPC_SourceCodePath
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
EPC_Credentials
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
ADB_IPAddress
==
null
)
{
allParametersPresent
=
false
}
if
(
params
.
ADB_Credentials
==
null
)
{
allParametersPresent
=
false
}
if
(
allParametersPresent
)
{
echo
"All parameters are present"
if
(
eNB_AllowMergeRequestProcess
)
{
sh
"git fetch"
sh
"./ci-scripts/doGitLabMerge.sh --src-branch ${eNB_Branch} --src-commit ${eNB_CommitID} --target-branch ${eNB_TargetBranch} --target-commit latest"
}
else
{
sh
"git fetch"
sh
"git checkout -f ${eNB_CommitID}"
}
}
else
{
echo
"Some parameters are missing"
sh
"./ci-scripts/fail.sh"
}
}
}
}
stage
(
"Build and Test"
)
{
steps
{
script
{
dir
(
'ci-scripts'
)
{
echo
"\u2705 \u001B[32m${testStageName}\u001B[0m"
// If not present picking a default XML file
if
(
params
.
pythonTestXmlFile
==
null
)
{
// picking default
testXMLFile
=
'xml_files/enb_usrpB210_band7_50PRB.xml'
echo
"Test XML file(default): ${testXMLFile}"
mainPythonAllXmlFiles
+=
"--XMLTestFile="
+
testXMLFile
+
" "
}
else
{
String
[]
myXmlTestSuite
=
testXMLFile
.
split
(
"\\r?\\n"
)
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
fileExists
(
xmlFile
))
{
mainPythonAllXmlFiles
+=
"--XMLTestFile="
+
xmlFile
+
" "
echo
"Test XML file : ${xmlFile}"
}
}
}
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
],
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB1_Credentials}"
,
usernameVariable:
'eNB1_Username'
,
passwordVariable:
'eNB1_Password'
],
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB2_Credentials}"
,
usernameVariable:
'eNB2_Username'
,
passwordVariable:
'eNB2_Password'
],
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.EPC_Credentials}"
,
usernameVariable:
'EPC_Username'
,
passwordVariable:
'EPC_Password'
],
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.ADB_Credentials}"
,
usernameVariable:
'ADB_Username'
,
passwordVariable:
'ADB_Password'
]
])
{
sh
"python3 main.py --mode=InitiateHtml --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} ${mainPythonAllXmlFiles}"
String
[]
myXmlTestSuite
=
testXMLFile
.
split
(
"\\r?\\n"
)
for
(
xmlFile
in
myXmlTestSuite
)
{
if
(
fileExists
(
xmlFile
))
{
try
{
sh
"python3 main.py --mode=TesteNB --ranRepository=${eNB_Repository} --ranBranch=${eNB_Branch} --ranCommitID=${eNB_CommitID} --ranAllowMerge=${eNB_AllowMergeRequestProcess} --ranTargetBranch=${eNB_TargetBranch} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password} --eNBSourceCodePath=${params.eNB_SourceCodePath} --eNB1IPAddress=${params.eNB1_IPAddress} --eNB1UserName=${eNB1_Username} --eNB1Password=${eNB1_Password} --eNB1SourceCodePath=${params.eNB1_SourceCodePath} --eNB2IPAddress=${params.eNB2_IPAddress} --eNB2UserName=${eNB2_Username} --eNB2Password=${eNB2_Password} --eNB2SourceCodePath=${params.eNB2_SourceCodePath} --EPCIPAddress=${params.EPC_IPAddress} --EPCType=${params.EPC_Type} --EPCUserName=${EPC_Username} --EPCPassword=${EPC_Password} --EPCSourceCodePath=${params.EPC_SourceCodePath} --ADBIPAddress=${params.ADB_IPAddress} --ADBUserName=${ADB_Username} --ADBPassword=${ADB_Password} --XMLTestFile=${xmlFile}"
}
catch
(
Exception
e
)
{
currentBuild
.
result
=
'FAILURE'
buildStageStatus
=
false
}
}
}
sh
"python3 main.py --mode=FinalizeHtml --finalStatus=${buildStageStatus} --eNBIPAddress=${params.eNB_IPAddress} --eNBUserName=${eNB_Username} --eNBPassword=${eNB_Password}"
}
}
}
}
}
stage
(
'Log Collection'
)
{
parallel
{
stage
(
'Log Collection (eNB - Build)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (eNB - 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}"
echo
'\u2705 \u001B[32mLog Transfer (eNB - 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"
}
script
{
if
(
fileExists
(
"build.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"build.log.${env.BUILD_ID}.zip"
}
}
}
}
stage
(
'Log Collection (eNB - Run)'
)
{
steps
{
withCredentials
([
[
$class
:
'UsernamePasswordMultiBinding'
,
credentialsId:
"${params.eNB_Credentials}"
,
usernameVariable:
'eNB_Username'
,
passwordVariable:
'eNB_Password'
]
])
{
echo
'\u2705 \u001B[32mLog Collection (eNB - 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}"
echo
'\u2705 \u001B[32mLog Transfer (eNB - Run)\u001B[0m'
sh
"sshpass -p \'${eNB_Password}\' scp -o 'StrictHostKeyChecking no' -o 'ConnectTimeout 10' ${eNB_Username}@${params.eNB_IPAddress}:${eNB_SourceCodePath}/cmake_targets/enb.log.zip ./enb.log.${env.BUILD_ID}.zip || true"
}
script
{
if
(
fileExists
(
"enb.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"enb.log.${env.BUILD_ID}.zip"
}
if
(
fileExists
(
"ci-scripts/test_results.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"
archiveArtifacts
"test_results-${JOB_NAME}.html"
}
}
}
}
}
}
}
post
{
always
{
script
{
if
(
params
.
pipelineZipsConsoleLog
!=
null
)
{
if
(
params
.
pipelineZipsConsoleLog
)
{
echo
"Archiving Jenkins console log"
sh
"wget --no-check-certificate --no-proxy ${env.JENKINS_URL}/job/${env.JOB_NAME}/${env.BUILD_ID}/consoleText -O consoleText.log || true"
sh
"zip -m consoleText.log.${env.BUILD_ID}.zip consoleText.log || true"
if
(
fileExists
(
"consoleText.log.${env.BUILD_ID}.zip"
))
{
archiveArtifacts
"consoleText.log.${env.BUILD_ID}.zip"
}
}
}
}
}
}
}
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