Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
oai
openairinterface5G
Commits
44fe00d0
Commit
44fe00d0
authored
Nov 07, 2018
by
Raphael Defosseux
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CI: unified VM scripting for option management
Signed-off-by:
Raphael Defosseux
<
raphael.defosseux@eurecom.fr
>
parent
bf85f180
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
1926 additions
and
2477 deletions
+1926
-2477
ci-scripts/Jenkinsfile-gitlab
ci-scripts/Jenkinsfile-gitlab
+24
-24
ci-scripts/buildOnVM.sh
ci-scripts/buildOnVM.sh
+101
-400
ci-scripts/createVM.sh
ci-scripts/createVM.sh
+21
-165
ci-scripts/destroyAllRunningVM.sh
ci-scripts/destroyAllRunningVM.sh
+24
-62
ci-scripts/oai-ci-vm-tool
ci-scripts/oai-ci-vm-tool
+573
-0
ci-scripts/reportBuildLocally.sh
ci-scripts/reportBuildLocally.sh
+239
-376
ci-scripts/reportTestLocally.sh
ci-scripts/reportTestLocally.sh
+325
-461
ci-scripts/runTestOnVM.sh
ci-scripts/runTestOnVM.sh
+524
-658
ci-scripts/waitBuildOnVM.sh
ci-scripts/waitBuildOnVM.sh
+95
-331
No files found.
ci-scripts/Jenkinsfile-gitlab
View file @
44fe00d0
...
...
@@ -118,7 +118,7 @@ pipeline {
stage
(
"Start VM -- basic-sim"
)
{
steps
{
timeout
(
time:
5
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
buildOnVM.sh
--workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
sh
"./ci-scripts/
oai-ci-vm-tool build
--workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
...
...
@@ -126,7 +126,7 @@ pipeline {
stage
(
"Start VM -- gnb-usrp"
)
{
steps
{
timeout
(
time:
5
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
buildOnVM.sh
--workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
sh
"./ci-scripts/
oai-ci-vm-tool build
--workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
...
...
@@ -134,7 +134,7 @@ pipeline {
stage
(
"Start VM -- nu-ue-usrp"
)
{
steps
{
timeout
(
time:
5
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
buildOnVM.sh
--workspace $WORKSPACE --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
sh
"./ci-scripts/
oai-ci-vm-tool build
--workspace $WORKSPACE --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
...
...
@@ -142,7 +142,7 @@ pipeline {
stage
(
"Start VM -- enb-usrp"
)
{
steps
{
timeout
(
time:
5
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
buildOnVM.sh
--workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
sh
"./ci-scripts/
oai-ci-vm-tool build
--workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
...
...
@@ -150,7 +150,7 @@ pipeline {
stage
(
"Start VM -- enb-ethernet"
)
{
steps
{
timeout
(
time:
5
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
buildOnVM.sh
--workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
sh
"./ci-scripts/
oai-ci-vm-tool build
--workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
...
...
@@ -158,7 +158,7 @@ pipeline {
stage
(
"Start VM -- ue-ethernet"
)
{
steps
{
timeout
(
time:
5
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
buildOnVM.sh
--workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
sh
"./ci-scripts/
oai-ci-vm-tool build
--workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
...
...
@@ -166,7 +166,7 @@ pipeline {
stage
(
"Start VM -- phy-sim"
)
{
steps
{
timeout
(
time:
5
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
buildOnVM.sh
--workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
sh
"./ci-scripts/
oai-ci-vm-tool build
--workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
...
...
@@ -174,7 +174,7 @@ pipeline {
stage
(
"Start VM -- cppcheck"
)
{
steps
{
timeout
(
time:
5
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
buildOnVM.sh
--workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
sh
"./ci-scripts/
oai-ci-vm-tool build
--workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
}
}
}
...
...
@@ -185,7 +185,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Analysis with cppcheck"
)
{
timeout
(
time:
20
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
waitBuildOnVM.sh
--workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
sh
"./ci-scripts/
oai-ci-vm-tool wait
--workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
...
...
@@ -194,7 +194,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Build eNb-USRP"
)
{
timeout
(
time:
20
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
waitBuildOnVM.sh
--workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
sh
"./ci-scripts/
oai-ci-vm-tool wait
--workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
...
...
@@ -203,7 +203,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Build basic-sim"
)
{
timeout
(
time:
20
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
waitBuildOnVM.sh
--workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
sh
"./ci-scripts/
oai-ci-vm-tool wait
--workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
...
...
@@ -212,7 +212,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Build eNb-ethernet"
)
{
timeout
(
time:
20
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
waitBuildOnVM.sh
--workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
sh
"./ci-scripts/
oai-ci-vm-tool wait
--workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
...
...
@@ -221,7 +221,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Build UE-ethernet"
)
{
timeout
(
time:
20
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
waitBuildOnVM.sh
--workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
sh
"./ci-scripts/
oai-ci-vm-tool wait
--workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
...
...
@@ -230,7 +230,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Build gNb-usrp"
)
{
timeout
(
time:
20
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
waitBuildOnVM.sh
--workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
sh
"./ci-scripts/
oai-ci-vm-tool wait
--workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
...
...
@@ -239,7 +239,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Build nr-UE-usrp"
)
{
timeout
(
time:
20
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
waitBuildOnVM.sh
--workspace $WORKSPACE --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
sh
"./ci-scripts/
oai-ci-vm-tool wait
--workspace $WORKSPACE --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
...
...
@@ -248,7 +248,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Build phy-sim"
)
{
timeout
(
time:
20
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
waitBuildOnVM.sh
--workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
sh
"./ci-scripts/
oai-ci-vm-tool wait
--workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
}
}
}
...
...
@@ -286,7 +286,7 @@ pipeline {
archiveArtifacts
artifacts:
'archives/vm_build_logs.zip'
}
if
(
"MERGE"
.
equals
(
env
.
gitlabActionType
))
{
sh
"./ci-scripts/report
B
uild
Locally.sh
--git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
sh
"./ci-scripts/
oai-ci-vm-tool
report
-b
uild
--workspace $WORKSPACE
--git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
sh
"./ci-scripts/checkAddedWarnings.sh --src-branch ${env.gitlabSourceBranch} --target-branch ${env.gitlabTargetBranch}"
def
res
=
readFile
(
'./oai_warning_files.txt'
).
trim
();
if
(
"0"
.
equals
(
res
))
{
...
...
@@ -297,7 +297,7 @@ pipeline {
addGitLabMRComment
comment:
message
}
}
else
{
sh
"./ci-scripts/report
B
uild
Locally.sh
--git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
sh
"./ci-scripts/
oai-ci-vm-tool
report
-b
uild
--workspace $WORKSPACE
--git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
}
if
(
fileExists
(
'build_results.html'
))
{
sh
"sed -i -e 's#Build-ID: ${BUILD_ID}#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' build_results.html"
...
...
@@ -314,7 +314,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Test phy-sim"
)
{
timeout
(
time:
45
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
runTestOnVM.sh
--workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
sh
"./ci-scripts/
oai-ci-vm-tool test
--workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
...
...
@@ -323,7 +323,7 @@ pipeline {
steps
{
gitlabCommitStatus
(
name:
"Test basic-sim"
)
{
timeout
(
time:
20
,
unit:
'MINUTES'
)
{
sh
"./ci-scripts/
runTestOnVM.sh
--workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}
--keep-vm-alive
"
sh
"./ci-scripts/
oai-ci-vm-tool test
--workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
...
...
@@ -518,9 +518,9 @@ pipeline {
if
(
fileExists
(
'archives/vm_tests_logs.zip'
))
{
archiveArtifacts
artifacts:
'archives/vm_tests_logs.zip'
if
(
"MERGE"
.
equals
(
env
.
gitlabActionType
))
{
sh
"./ci-scripts/report
T
est
Locally.sh
--git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
sh
"./ci-scripts/
oai-ci-vm-tool
report
-t
est
--workspace $WORKSPACE
--git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger merge-request --src-branch ${env.gitlabSourceBranch} --src-commit ${env.gitlabMergeRequestLastCommit} --target-branch ${env.gitlabTargetBranch} --target-commit ${GIT_COMMIT}"
}
else
{
sh
"./ci-scripts/report
T
est
Locally.sh
--git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
sh
"./ci-scripts/
oai-ci-vm-tool
report
-t
est
--workspace $WORKSPACE
--git-url ${GIT_URL} --job-name ${JOB_NAME} --build-id ${BUILD_ID} --trigger push --branch ${GIT_BRANCH} --commit ${GIT_COMMIT}"
}
if
(
fileExists
(
'test_simulator_results.html'
))
{
sh
"sed -i -e 's#Build-ID: ${BUILD_ID}#Build-ID: <a href=\"${BUILD_URL}\">${BUILD_ID}</a>#' -e 's#TEMPLATE_BUILD_TIME#${JOB_TIMESTAMP}#' test_simulator_results.html"
...
...
@@ -533,7 +533,7 @@ pipeline {
}
stage
(
"Destroy all Virtual Machines"
)
{
steps
{
sh
"./ci-scripts/
destroyAllRunningVM.sh
--job-name ${JOB_NAME} --build-id ${BUILD_ID}"
sh
"./ci-scripts/
oai-ci-vm-tool destroy
--job-name ${JOB_NAME} --build-id ${BUILD_ID}"
}
}
}
...
...
@@ -541,7 +541,7 @@ pipeline {
always
{
script
{
// Stage destroy may not be run if error in previous stage
sh
"./ci-scripts/
destroyAllRunningVM.sh
--job-name ${JOB_NAME} --build-id ${BUILD_ID}"
sh
"./ci-scripts/
oai-ci-vm-tool destroy
--job-name ${JOB_NAME} --build-id ${BUILD_ID}"
emailext
attachmentsPattern:
'*results*.html'
,
body:
'''Hi,
Here are attached HTML report files for $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!
...
...
ci-scripts/buildOnVM.sh
View file @
44fe00d0
...
...
@@ -20,8 +20,8 @@
# * contact@openairinterface.org
# */
function
usage
{
echo
"OAI
VM Build Check
script"
function
build_
usage
{
echo
"OAI
CI VM
script"
echo
" Original Author: Raphael Defosseux"
echo
" Requirements:"
echo
" -- uvtool uvtool-libvirt apt-cacher"
...
...
@@ -31,9 +31,9 @@ function usage {
echo
""
echo
"Usage:"
echo
"------"
echo
"
buildOnVM.sh
[OPTIONS]"
echo
"
oai-ci-vm-tool build
[OPTIONS]"
echo
""
echo
"Options:"
echo
"
Mandatory
Options:"
echo
"--------"
echo
" --job-name #### OR -jn ####"
echo
" Specify the name of the Jenkins job."
...
...
@@ -44,14 +44,9 @@ function usage {
echo
" --workspace #### OR -ws ####"
echo
" Specify the workspace."
echo
""
echo
" --variant enb-usrp OR -v1"
echo
" --variant basic-sim OR -v2"
echo
" --variant phy-sim OR -v3"
echo
" --variant cppcheck OR -v4"
echo
" --variant gnb-usrp OR -v5"
echo
" --variant nu-ue-usrp OR -v6"
echo
" --variant enb-ethernet OR -v7"
echo
" --variant ue-ethernet OR -v8"
echo
"Options:"
echo
"--------"
variant_usage
echo
" Specify the variant to build."
echo
""
echo
" --keep-vm-alive OR -k"
...
...
@@ -65,414 +60,120 @@ function usage {
echo
""
}
function
variant_usage
{
echo
"OAI VM Build Check script"
echo
" Original Author: Raphael Defosseux"
echo
""
echo
" --variant enb-usrp OR -v1"
echo
" --variant basic-sim OR -v2"
echo
" --variant phy-sim OR -v3"
echo
" --variant cppcheck OR -v4"
echo
" --variant gnb-usrp OR -v5"
echo
" --variant nu-ue-usrp OR -v6"
echo
" --variant enb-ethernet OR -v7"
echo
" --variant ue-ethernet OR -v8"
echo
""
}
if
[
$#
-lt
1
]
||
[
$#
-gt
9
]
then
echo
"Syntax Error: not the correct number of arguments"
echo
""
usage
exit
1
fi
VM_TEMPLATE
=
ci-
JOB_NAME
=
XX
BUILD_ID
=
XX
VM_NAME
=
ci-enb-usrp
VM_MEMORY
=
2048
VM_CPU
=
4
ARCHIVES_LOC
=
enb_usrp
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
4
BUILD_OPTIONS
=
"--eNB -w USRP"
KEEP_VM_ALIVE
=
0
DAEMON
=
0
while
[[
$#
-gt
0
]]
do
key
=
"
$1
"
case
$key
in
-h
|
--help
)
shift
usage
exit
0
;;
-jn
|
--job-name
)
JOB_NAME
=
"
$2
"
shift
shift
;;
-id
|
--build-id
)
BUILD_ID
=
"
$2
"
shift
shift
;;
-ws
|
--workspace
)
JENKINS_WKSP
=
"
$2
"
shift
shift
;;
-k
|
--keep-vm-alive
)
KEEP_VM_ALIVE
=
1
shift
;;
-D
|
--daemon
)
DAEMON
=
1
shift
;;
-v1
)
VM_NAME
=
ci-enb-usrp
ARCHIVES_LOC
=
enb_usrp
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
4
BUILD_OPTIONS
=
"--eNB -w USRP --mu"
shift
;;
-v2
)
VM_NAME
=
ci-basic-sim
ARCHIVES_LOC
=
basic_sim
LOG_PATTERN
=
basic_simulator
NB_PATTERN_FILES
=
2
BUILD_OPTIONS
=
"--basic-simulator"
VM_MEMORY
=
8192
VM_CPU
=
4
shift
;;
-v3
)
VM_NAME
=
ci-phy-sim
ARCHIVES_LOC
=
phy_sim
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
6
BUILD_OPTIONS
=
"--phy_simulators"
shift
;;
-v4
)
VM_NAME
=
ci-cppcheck
VM_MEMORY
=
8192
ARCHIVES_LOC
=
cppcheck
LOG_PATTERN
=
cppcheck.xml
NB_PATTERN_FILES
=
1
BUILD_OPTIONS
=
"--enable=warning --force --xml --xml-version=2 -i openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c"
shift
;;
-v5
)
VM_NAME
=
ci-gnb-usrp
ARCHIVES_LOC
=
gnb_usrp
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
4
BUILD_OPTIONS
=
"--gNB -w USRP"
shift
;;
-v6
)
VM_NAME
=
ci-ue-nr-usrp
ARCHIVES_LOC
=
nrue_usrp
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
4
BUILD_OPTIONS
=
"--nrUE -w USRP"
shift
;;
-v7
)
VM_NAME
=
ci-enb-ethernet
ARCHIVES_LOC
=
enb_eth
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
6
BUILD_OPTIONS
=
"--eNB -t ETHERNET --noS1"
shift
;;
-v8
)
VM_NAME
=
ci-ue-ethernet
ARCHIVES_LOC
=
ue_eth
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
6
BUILD_OPTIONS
=
"--UE -t ETHERNET --noS1"
shift
;;
--variant
)
variant
=
"
$2
"
case
$variant
in
enb-usrp
)
VM_NAME
=
ci-enb-usrp
ARCHIVES_LOC
=
enb_usrp
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
4
BUILD_OPTIONS
=
"--eNB -w USRP --mu"
;;
basic-sim
)
VM_NAME
=
ci-basic-sim
ARCHIVES_LOC
=
basic_sim
LOG_PATTERN
=
basic_simulator
NB_PATTERN_FILES
=
2
BUILD_OPTIONS
=
"--basic-simulator"
VM_MEMORY
=
8192
VM_CPU
=
4
;;
phy-sim
)
VM_NAME
=
ci-phy-sim
ARCHIVES_LOC
=
phy_sim
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
6
BUILD_OPTIONS
=
"--phy_simulators"
;;
cppcheck
)
VM_NAME
=
ci-cppcheck
VM_MEMORY
=
8192
ARCHIVES_LOC
=
cppcheck
LOG_PATTERN
=
cppcheck.xml
NB_PATTERN_FILES
=
1
BUILD_OPTIONS
=
"--enable=warning --force --xml --xml-version=2 -i openair1/PHY/CODING/nrLDPC_decoder/nrLDPC_decoder.c"
;;
gnb-usrp
)
VM_NAME
=
ci-gnb-usrp
ARCHIVES_LOC
=
gnb_usrp
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
4
BUILD_OPTIONS
=
"--gNB -w USRP"
;;
nu-ue-usrp
)
VM_NAME
=
ci-ue-nr-usrp
ARCHIVES_LOC
=
nrue_usrp
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
4
BUILD_OPTIONS
=
"--nrUE -w USRP"
;;
enb-ethernet
)
VM_NAME
=
ci-enb-ethernet
ARCHIVES_LOC
=
enb_eth
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
6
BUILD_OPTIONS
=
"--eNB -t ETHERNET --noS1"
;;
ue-ethernet
)
VM_NAME
=
ci-ue-ethernet
ARCHIVES_LOC
=
ue_eth
LOG_PATTERN
=
.Rel15.txt
NB_PATTERN_FILES
=
6
BUILD_OPTIONS
=
"--UE -t ETHERNET --noS1"
;;
*
)
echo
""
echo
"Syntax Error: Invalid Variant option ->
$variant
"
echo
""
variant_usage
exit
1
esac
shift
shift
;;
*
)
echo
"Syntax Error: unknown option:
$key
"
echo
""
usage
exit
1
esac
done
if
[
!
-f
$JENKINS_WKSP
/localZip.zip
]
then
echo
"Missing localZip.zip file!"
exit
1
fi
if
[
!
-f
/etc/apt/apt.conf.d/01proxy
]
then
echo
"Missing /etc/apt/apt.conf.d/01proxy file!"
echo
"Is apt-cacher installed and configured?"
exit
1
fi
if
[
"
$JOB_NAME
"
==
"XX"
]
||
[
"
$BUILD_ID
"
==
"XX"
]
then
VM_TEMPLATE
=
ci-
else
VM_TEMPLATE
=
${
JOB_NAME
}
-b
${
BUILD_ID
}
-
fi
VM_NAME
=
`
echo
$VM_NAME
|
sed
-e
"s#ci-#
$VM_TEMPLATE
#"
`
VM_CMDS
=
${
VM_NAME
}
_cmds.txt
ARCHIVES_LOC
=
${
JENKINS_WKSP
}
/archives/
${
ARCHIVES_LOC
}
echo
"VM_NAME =
$VM_NAME
"
echo
"VM_CMD_FILE =
$VM_CMDS
"
echo
"JENKINS_WKSP =
$JENKINS_WKSP
"
echo
"ARCHIVES_LOC =
$ARCHIVES_LOC
"
echo
"BUILD_OPTIONS =
$BUILD_OPTIONS
"
IS_VM_ALIVE
=
`
uvt-kvm list |
grep
-c
$VM_NAME
`
function
build_on_vm
{
if
[
!
-f
$JENKINS_WKSP
/localZip.zip
]
then
echo
"Missing localZip.zip file!"
STATUS
=
1
return
fi
if
[
!
-f
/etc/apt/apt.conf.d/01proxy
]
then
echo
"Missing /etc/apt/apt.conf.d/01proxy file!"
echo
"Is apt-cacher installed and configured?"
STATUS
=
1
return
fi
if
[
$IS_VM_ALIVE
-eq
0
]
then
echo
"############################################################"
echo
"
Creating VM (
$VM_NAME
) on Ubuntu Cloud Image base
"
echo
"
OAI CI VM script
"
echo
"############################################################"
uvt-kvm create
$VM_NAME
release
=
xenial
--memory
$VM_MEMORY
--cpu
$VM_CPU
--unsafe-caching
--template
ci-scripts/template-host.xml
fi
echo
"Waiting for VM to be started"
uvt-kvm
wait
$VM_NAME
--insecure
VM_IP_ADDR
=
`
uvt-kvm ip
$VM_NAME
`
echo
"
$VM_NAME
has for IP addr =
$VM_IP_ADDR
"
echo
"VM_NAME =
$VM_NAME
"
echo
"VM_CMD_FILE =
$VM_CMDS
"
echo
"JENKINS_WKSP =
$JENKINS_WKSP
"
echo
"ARCHIVES_LOC =
$ARCHIVES_LOC
"
echo
"BUILD_OPTIONS =
$BUILD_OPTIONS
"
echo
"############################################################"
echo
"Copying GIT repo into VM (
$VM_NAME
)"
echo
"############################################################"
scp
-o
StrictHostKeyChecking
=
no localZip.zip ubuntu@
$VM_IP_ADDR
:/home/ubuntu
scp
-o
StrictHostKeyChecking
=
no /etc/apt/apt.conf.d/01proxy ubuntu@
$VM_IP_ADDR
:/home/ubuntu
IS_VM_ALIVE
=
`
uvt-kvm list |
grep
-c
$VM_NAME
`
echo
"############################################################"
echo
"Running install and build script on VM (
$VM_NAME
)"
echo
"############################################################"
echo
"sudo cp 01proxy /etc/apt/apt.conf.d/"
>
$VM_CMDS
echo
"touch /home/ubuntu/.hushlogin"
>>
$VM_CMDS
if
[[
"
$VM_NAME
"
==
*
"-cppcheck"
*
]]
then
if
[
$DAEMON
-eq
0
]
then
echo
"echo
\"
sudo apt-get --yes --quiet install zip cppcheck
\"
"
>>
$VM_CMDS
echo
"sudo apt-get update > zip-install.txt 2>&1"
>>
$VM_CMDS
echo
"sudo apt-get --yes install zip cppcheck >> zip-install.txt 2>&1"
>>
$VM_CMDS
else
echo
"echo
\"
sudo apt-get --yes --quiet install zip daemon cppcheck
\"
"
>>
$VM_CMDS
echo
"sudo apt-get update > zip-install.txt 2>&1"
>>
$VM_CMDS
echo
"sudo apt-get --yes install zip daemon cppcheck >> zip-install.txt 2>&1"
>>
$VM_CMDS
fi
else
if
[
$DAEMON
-eq
0
]
if
[
$IS_VM_ALIVE
-eq
0
]
then
echo
"echo
\"
sudo apt-get --yes --quiet install zip subversion libboost-dev
\"
"
>>
$VM_CMDS
echo
"sudo apt-get update > zip-install.txt 2>&1"
>>
$VM_CMDS
echo
"sudo apt-get --yes install zip subversion libboost-dev >> zip-install.txt 2>&1"
>>
$VM_CMDS
else
echo
"echo
\"
sudo apt-get --yes --quiet install zip daemon subversion libboost-dev
\"
"
>>
$VM_CMDS
echo
"sudo apt-get update > zip-install.txt 2>&1"
>>
$VM_CMDS
echo
"sudo apt-get --yes install zip daemon subversion libboost-dev >> zip-install.txt 2>&1"
>>
$VM_CMDS
fi
fi
echo
"mkdir tmp"
>>
$VM_CMDS
echo
"cd tmp"
>>
$VM_CMDS
echo
"echo
\"
unzip -qq -DD ../localZip.zip
\"
"
>>
$VM_CMDS
echo
"unzip -qq -DD ../localZip.zip"
>>
$VM_CMDS
if
[[
"
$VM_NAME
"
==
*
"-cppcheck"
*
]]
then
echo
"mkdir cmake_targets/log"
>>
$VM_CMDS
echo
"chmod 777 cmake_targets/log"
>>
$VM_CMDS
echo
"cp /home/ubuntu/zip-install.txt cmake_targets/log"
>>
$VM_CMDS
echo
"echo
\"
cppcheck
$BUILD_OPTIONS
.
\"
"
>>
$VM_CMDS
if
[
$DAEMON
-eq
0
]
then
echo
"cppcheck
$BUILD_OPTIONS
. 2> cmake_targets/log/cppcheck.xml 1> cmake_targets/log/cppcheck_build.txt"
>>
$VM_CMDS
else
echo
"echo
\"
cppcheck
$BUILD_OPTIONS
.
\"
> ./my-vm-build.sh"
>>
$VM_CMDS
echo
"chmod 775 ./my-vm-build.sh "
>>
$VM_CMDS
echo
"sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp -O /home/ubuntu/tmp/cmake_targets/log/cppcheck_build.txt -E /home/ubuntu/tmp/cmake_targets/log/cppcheck.xml ./my-vm-build.sh"
>>
$VM_CMDS
fi
else
echo
"echo
\"
source oaienv
\"
"
>>
$VM_CMDS
echo
"source oaienv"
>>
$VM_CMDS
echo
"cd cmake_targets/"
>>
$VM_CMDS
echo
"mkdir log"
>>
$VM_CMDS
echo
"chmod 777 log"
>>
$VM_CMDS
echo
"cp /home/ubuntu/zip-install.txt log"
>>
$VM_CMDS
if
[
$DAEMON
-eq
0
]
then
echo
"echo
\"
./build_oai -I
$BUILD_OPTIONS
\"
"
>>
$VM_CMDS
echo
"./build_oai -I
$BUILD_OPTIONS
> log/install-build.txt 2>&1"
>>
$VM_CMDS
else
echo
"echo
\"
./build_oai -I
$BUILD_OPTIONS
\"
> ./my-vm-build.sh"
>>
$VM_CMDS
echo
"chmod 775 ./my-vm-build.sh "
>>
$VM_CMDS
echo
"echo
\"
sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh
\"
"
>>
$VM_CMDS
echo
"sudo -E daemon --inherit --unsafe --name=build_daemon --chdir=/home/ubuntu/tmp/cmake_targets -o /home/ubuntu/tmp/cmake_targets/log/install-build.txt ./my-vm-build.sh"
>>
$VM_CMDS
echo
"VM_MEMORY =
$VM_MEMORY
MBytes"
echo
"VM_CPU =
$VM_CPU
"
echo
"############################################################"
echo
"Creating VM (
$VM_NAME
) on Ubuntu Cloud Image base"
echo
"############################################################"
uvt-kvm create
$VM_NAME
release
=
xenial
--memory
$VM_MEMORY
--cpu
$VM_CPU
--unsafe-caching
--template
ci-scripts/template-host.xml
fi
fi
ssh
-o
StrictHostKeyChecking
=
no ubuntu@
$VM_IP_ADDR
<
$VM_CMDS
if
[
$DAEMON
-eq
1
]
then
rm
-f
$VM_CMDS
echo
"STATUS is OK"
exit
0
fi
echo
"############################################################"
echo
"Creating a tmp folder to store results and artifacts"
echo
"############################################################"
if
[
!
-d
$JENKINS_WKSP
/archives
]
then
mkdir
$JENKINS_WKSP
/archives
fi
if
[
!
-d
$ARCHIVES_LOC
]
then
mkdir
$ARCHIVES_LOC
fi
echo
"Waiting for VM to be started"
uvt-kvm
wait
$VM_NAME
--insecure
scp
-o
StrictHostKeyChecking
=
no ubuntu@
$VM_IP_ADDR
:/home/ubuntu/tmp/cmake_targets/log/
*
.txt
$ARCHIVES_LOC
if
[[
"
$VM_NAME
"
==
*
"-cppcheck"
*
]]
then
scp
-o
StrictHostKeyChecking
=
no ubuntu@
$VM_IP_ADDR
:/home/ubuntu/tmp/cmake_targets/log/
*
.xml
$ARCHIVES_LOC
fi
VM_IP_ADDR
=
`
uvt-kvm ip
$VM_NAME
`
echo
"
$VM_NAME
has for IP addr =
$VM_IP_ADDR
"
if
[
$KEEP_VM_ALIVE
-eq
0
]