From 348d9aaadeb22db97793b6c48834be92d23eadc8 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Fri, 22 Jun 2018 16:01:08 +0200 Subject: [PATCH 1/3] CI: enhancements -- VM are kept alive to prepare for running tests -- Added destroy script to kill all VM after run -- VM names are now based on jobname and buildid Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 17 +++++-- ci-scripts/buildOnVM.sh | 29 ++++++++++- ci-scripts/destroyAllRunningVM.sh | 81 +++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 6 deletions(-) create mode 100644 ci-scripts/destroyAllRunningVM.sh diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index ad97588d9b..f36bf9023f 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -52,28 +52,28 @@ pipeline { stage ("Analysis with cppcheck") { steps { gitlabCommitStatus(name: "Analysis with cppcheck") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep" } } } stage ("Build eNb-USRP") { steps { gitlabCommitStatus(name: "Build eNb-USRP") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep" } } } stage ("Build basic simulator") { steps { gitlabCommitStatus(name: "Build basic-sim") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep" } } } stage ("Build physical simulators") { steps { gitlabCommitStatus(name: "Build phy-sim") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep" } } } @@ -99,11 +99,18 @@ pipeline { } } } + + stage ("Destroy all Virtual Machines") { + steps { + sh "./ci-scripts/destroyAllRunningVM.sh --job-name ${JOB_NAME} --build-id ${BUILD_ID}" + } + } } post { always { script { - echo "End of 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}" } } success { diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh index c5389c2b50..24f86121f6 100755 --- a/ci-scripts/buildOnVM.sh +++ b/ci-scripts/buildOnVM.sh @@ -15,6 +15,12 @@ function usage { echo "" echo "Options:" echo "--------" + echo " --job-name #### OR -jn ####" + echo " Specify the name of the Jenkins job." + echo "" + echo " --build-id #### OR -id ####" + echo " Specify the build ID of the Jenkins job." + echo "" echo " --workspace #### OR -ws ####" echo " Specify the workspace." echo "" @@ -43,7 +49,7 @@ function variant_usage { echo "" } -if [ $# -lt 1 ] || [ $# -gt 5 ] +if [ $# -lt 1 ] || [ $# -gt 9 ] then echo "Syntax Error: not the correct number of arguments" echo "" @@ -51,6 +57,9 @@ then exit 1 fi +VM_TEMPLATE=ci- +JOB_NAME=XX +BUILD_ID=XX VM_NAME=ci-enb-usrp ARCHIVES_LOC=enb_usrp LOG_PATTERN=.Rel14.txt @@ -68,6 +77,16 @@ case $key in 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 @@ -170,6 +189,14 @@ then 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} diff --git a/ci-scripts/destroyAllRunningVM.sh b/ci-scripts/destroyAllRunningVM.sh new file mode 100644 index 0000000000..c9eb43b4ef --- /dev/null +++ b/ci-scripts/destroyAllRunningVM.sh @@ -0,0 +1,81 @@ +#!/bin/bash + +function usage { + echo "OAI VM Destroy script" + echo " Original Author: Raphael Defosseux" + echo "" + echo "Usage:" + echo "------" + echo " destroyAllRunningVM.sh [OPTIONS]" + echo "" + echo "Options:" + echo "--------" + echo " --job-name #### OR -jn ####" + echo " Specify the name of the Jenkins job." + echo "" + echo " --build-id #### OR -id ####" + echo " Specify the build ID of the Jenkins job." + echo "" + echo " --help OR -h" + echo " Print this help message." + echo "" +} + +if [ $# -gt 4 ] +then + echo "Syntax Error: not the correct number of arguments" + echo "" + usage + exit 1 +fi + +VM_TEMPLATE=ci- +JOB_NAME=XX +BUILD_ID=XX + +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 + ;; + *) + echo "Syntax Error: unknown option: $key" + echo "" + usage + exit 1 +esac +done + +if [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] +then + VM_TEMPLATE=ci- +else + VM_TEMPLATE=${JOB_NAME}-b${BUILD_ID}- +fi + +LIST_CI_VM=`uvt-kvm list | grep $VM_TEMPLATE` + +for CI_VM in $LIST_CI_VM +do + VM_IP_ADDR=`uvt-kvm ip $CI_VM` + echo "VM to destroy: $CI_VM -- IP $VM_IP_ADDR" + uvt-kvm destroy $CI_VM + ssh-keygen -R $VM_IP_ADDR +done + +exit 0 + From c64c5b25fb1ef55210502cf85f1271859b2e4ed1 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Mon, 25 Jun 2018 13:59:58 +0200 Subject: [PATCH 2/3] CI: fix in -k option syntax Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index f36bf9023f..8f2907c996 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -52,28 +52,28 @@ pipeline { stage ("Analysis with cppcheck") { steps { gitlabCommitStatus(name: "Analysis with cppcheck") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } stage ("Build eNb-USRP") { steps { gitlabCommitStatus(name: "Build eNb-USRP") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } stage ("Build basic simulator") { steps { gitlabCommitStatus(name: "Build basic-sim") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } stage ("Build physical simulators") { steps { gitlabCommitStatus(name: "Build phy-sim") { - sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep" + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" } } } @@ -82,7 +82,7 @@ pipeline { always { script { dir ('archives') { - sh "zip -r vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck" + sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck" } if(fileExists('archives/vm_build_logs.zip')) { archiveArtifacts artifacts: 'archives/vm_build_logs.zip' From d8560bba2b7ed93858f55b3fae722935709b65b8 Mon Sep 17 00:00:00 2001 From: Raphael Defosseux Date: Tue, 26 Jun 2018 13:38:33 +0200 Subject: [PATCH 3/3] CI: adding Ethernet-transport variants to build -- fix cmake file for missing header in --noS1 option Signed-off-by: Raphael Defosseux --- ci-scripts/Jenkinsfile-gitlab | 18 ++++++++-- ci-scripts/buildOnVM.sh | 56 +++++++++++++++++++++++++------ ci-scripts/destroyAllRunningVM.sh | 0 ci-scripts/reportBuildLocally.sh | 32 +++++++++++++++++- cmake_targets/CMakeLists.txt | 2 +- 5 files changed, 93 insertions(+), 15 deletions(-) mode change 100644 => 100755 ci-scripts/destroyAllRunningVM.sh diff --git a/ci-scripts/Jenkinsfile-gitlab b/ci-scripts/Jenkinsfile-gitlab index 8f2907c996..f5a0514a1e 100644 --- a/ci-scripts/Jenkinsfile-gitlab +++ b/ci-scripts/Jenkinsfile-gitlab @@ -8,7 +8,7 @@ pipeline { disableConcurrentBuilds() timestamps() gitLabConnection('OAI GitLab') - gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Analysis with cppcheck"]) + gitlabBuilds(builds: ["Build eNb-USRP", "Build basic-sim", "Build phy-sim", "Build eNb-ethernet", "Build UE--ethernet", "Analysis with cppcheck"]) } stages { @@ -77,12 +77,26 @@ pipeline { } } } + stage ("Build eNb-ethernet") { + steps { + gitlabCommitStatus(name: "Build eNb-ethernet") { + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + } + } + } + stage ("Build UE-ethernet") { + steps { + gitlabCommitStatus(name: "Build UE-ethernet") { + sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" + } + } + } } post { always { script { dir ('archives') { - sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck" + sh "zip -r -qq vm_build_logs.zip basic_sim enb_usrp phy_sim cppcheck enb_eth ue_eth" } if(fileExists('archives/vm_build_logs.zip')) { archiveArtifacts artifacts: 'archives/vm_build_logs.zip' diff --git a/ci-scripts/buildOnVM.sh b/ci-scripts/buildOnVM.sh index 24f86121f6..1149525364 100755 --- a/ci-scripts/buildOnVM.sh +++ b/ci-scripts/buildOnVM.sh @@ -24,10 +24,12 @@ 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 enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant enb-ethernet OR -v7" + echo " --variant ue-ethernet OR -v8" echo " Specify the variant to build." echo "" echo " --keep-vm-alive OR -k" @@ -42,10 +44,12 @@ 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 enb-usrp OR -v1" + echo " --variant basic-sim OR -v2" + echo " --variant phy-sim OR -v3" + echo " --variant cppcheck OR -v4" + echo " --variant enb-ethernet OR -v7" + echo " --variant ue-ethernet OR -v8" echo "" } @@ -128,6 +132,22 @@ case $key in BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" shift ;; + -v7) + VM_NAME=ci-enb-ethernet + ARCHIVES_LOC=enb_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--eNB -t ETHERNET --noS1" + shift + ;; + -v8) + VM_NAME=ci-ue-ethernet + ARCHIVES_LOC=ue_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--UE -t ETHERNET --noS1" + shift + ;; --variant) variant="$2" case $variant in @@ -159,6 +179,20 @@ case $key in NB_PATTERN_FILES=1 BUILD_OPTIONS="--enable=warning --force --xml --xml-version=2" ;; + enb-ethernet) + VM_NAME=ci-enb-ethernet + ARCHIVES_LOC=enb_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--eNB -t ETHERNET --noS1" + ;; + ue-ethernet) + VM_NAME=ci-ue-ethernet + ARCHIVES_LOC=ue_eth + LOG_PATTERN=.Rel14.txt + NB_PATTERN_FILES=6 + BUILD_OPTIONS="--UE -t ETHERNET --noS1" + ;; *) echo "" echo "Syntax Error: Invalid Variant option -> $variant" @@ -226,7 +260,7 @@ echo "############################################################" echo "Running install and build script on VM ($VM_NAME)" echo "############################################################" echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS -if [ "$VM_NAME" == "ci-cppcheck" ] +if [[ "$VM_NAME" == *"-cppcheck"* ]] 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 @@ -239,7 +273,7 @@ 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" == "ci-cppcheck" ] +if [[ "$VM_NAME" == *"-cppcheck"* ]] then echo "mkdir cmake_targets/log" >> $VM_CMDS echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS @@ -270,7 +304,7 @@ then fi scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.txt $ARCHIVES_LOC -if [ "$VM_NAME" == "ci-cppcheck" ] +if [[ "$VM_NAME" == *"-cppcheck"* ]] then scp -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR:/home/ubuntu/tmp/cmake_targets/log/*.xml $ARCHIVES_LOC fi diff --git a/ci-scripts/destroyAllRunningVM.sh b/ci-scripts/destroyAllRunningVM.sh old mode 100644 new mode 100755 diff --git a/ci-scripts/reportBuildLocally.sh b/ci-scripts/reportBuildLocally.sh index 3a19bae812..694e92e478 100755 --- a/ci-scripts/reportBuildLocally.sh +++ b/ci-scripts/reportBuildLocally.sh @@ -232,6 +232,10 @@ function sca_summary_table_footer { echo " Total" >> ./build_results.html echo " Unknown" >> ./build_results.html echo " Unknown" >> ./build_results.html + if [ -f ccp_error_cnt.txt ] + then + rm -f ccp_error_cnt.txt + fi fi echo " " >> ./build_results.html echo " " >> ./build_results.html @@ -505,6 +509,24 @@ summary_table_row "UL Simulator - Release 14" ./archives/phy_sim/ulsim.Rel14.txt summary_table_row "Coding - Release 14" ./archives/phy_sim/coding.Rel14.txt "Built target coding" ./phy_sim_row3.html summary_table_footer +summary_table_header "OAI Build eNB -- ETHERNET transport option" +summary_table_row "LTE SoftModem w/o S1 - Release 14" ./archives/enb_eth/lte-softmodem-nos1.Rel14.txt "Built target lte-softmodem" ./enb_eth_row1.html +summary_table_row "Coding - Release 14" ./archives/enb_eth/coding.Rel14.txt "Built target coding" ./enb_eth_row2.html +summary_table_row "OAI ETHERNET transport - Release 14" ./archives/enb_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./enb_eth_row3.html +summary_table_row "Parameters Lib Config - Release 14" ./archives/enb_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_eth_row4.html +summary_table_row "RB Tools - Release 14" ./archives/enb_eth/rb_tool.Rel14.txt "Built target rb_tool" ./enb_eth_row5.html +summary_table_row "NAS Mesh - Release 14" ./archives/enb_eth/nasmesh.Rel14.txt "Built target nasmesh" ./enb_eth_row6.html +summary_table_footer + +summary_table_header "OAI Build UE -- ETHERNET transport option" +summary_table_row "LTE UE SoftModem w/o S1 - Release 14" ./archives/ue_eth/lte-uesoftmodem-nos1.Rel14.txt "Built target lte-uesoftmodem" ./ue_eth_row1.html +summary_table_row "Coding - Release 14" ./archives/ue_eth/coding.Rel14.txt "Built target coding" ./ue_eth_row2.html +summary_table_row "OAI ETHERNET transport - Release 14" ./archives/ue_eth/oai_eth_transpro.Rel14.txt "Built target oai_eth_transpro" ./ue_eth_row3.html +summary_table_row "Parameters Lib Config - Release 14" ./archives/ue_eth/params_libconfig.Rel14.txt "Built target params_libconfig" ./ue_eth_row4.html +summary_table_row "RB Tools - Release 14" ./archives/ue_eth/rb_tool.Rel14.txt "Built target rb_tool" ./ue_eth_row5.html +summary_table_row "NAS Mesh - Release 14" ./archives/ue_eth/nasmesh.Rel14.txt "Built target nasmesh" ./ue_eth_row6.html +summary_table_footer + echo "

Details

" >> ./build_results.html for DETAILS_TABLE in `ls ./enb_usrp_row*.html` @@ -519,7 +541,15 @@ for DETAILS_TABLE in `ls ./phy_sim_row*.html` do cat $DETAILS_TABLE >> ./build_results.html done -rm -f ./enb_usrp_row*.html ./basic_sim_row*.html ./phy_sim_row*.html +for DETAILS_TABLE in `ls ./enb_eth_row*.html` +do + cat $DETAILS_TABLE >> ./build_results.html +done +for DETAILS_TABLE in `ls ./ue_eth_row*.html` +do + cat $DETAILS_TABLE >> ./build_results.html +done +rm -f ./enb_usrp_row*.html ./basic_sim_row*.html ./phy_sim_row*.html ./enb_eth_row*.html ./ue_eth_row*.html echo "" >> ./build_results.html echo "" >> ./build_results.html diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 4f449fbc12..428ab4e0ef 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -2021,7 +2021,7 @@ target_link_libraries (lte-uesoftmodem ${T_LIB}) add_executable(lte-uesoftmodem-nos1 ${rrc_h} ${s1ap_h} -# ${OPENAIR_BIN_DIR}/messages_xml.h + ${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c ${OPENAIR_TARGETS}/RT/USER/lte-ue.c ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c