Commit d354eded authored by Raphael Defosseux's avatar Raphael Defosseux

CI: optimization to build incrementally in time

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent a3c76449
...@@ -115,34 +115,34 @@ pipeline { ...@@ -115,34 +115,34 @@ pipeline {
} }
} }
stage ("Start VM -- cppcheck") { stage ("Start VM -- basic-sim") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
stage ("Start VM -- enb-usrp") { stage ("Start VM -- gnb-usrp") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
stage ("Start VM -- basic-sim") { stage ("Start VM -- nu-ue-usrp") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
stage ("Start VM -- phy-sim") { stage ("Start VM -- enb-usrp") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
...@@ -150,7 +150,7 @@ pipeline { ...@@ -150,7 +150,7 @@ pipeline {
stage ("Start VM -- enb-ethernet") { stage ("Start VM -- enb-ethernet") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
...@@ -158,23 +158,23 @@ pipeline { ...@@ -158,23 +158,23 @@ pipeline {
stage ("Start VM -- ue-ethernet") { stage ("Start VM -- ue-ethernet") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
stage ("Start VM -- gnb-usrp") { stage ("Start VM -- phy-sim") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
stage ("Start VM -- nu-ue-usrp") { stage ("Start VM -- cppcheck") {
steps { steps {
timeout (time: 5, unit: 'MINUTES') { timeout (time: 5, unit: 'MINUTES') {
sh "./ci-scripts/createVM.sh --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID} --daemon"
} }
} }
} }
...@@ -185,7 +185,7 @@ pipeline { ...@@ -185,7 +185,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Analysis with cppcheck") { gitlabCommitStatus(name: "Analysis with cppcheck") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant cppcheck --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
...@@ -194,7 +194,7 @@ pipeline { ...@@ -194,7 +194,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build eNb-USRP") { gitlabCommitStatus(name: "Build eNb-USRP") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant enb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
...@@ -203,7 +203,7 @@ pipeline { ...@@ -203,7 +203,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build basic-sim") { gitlabCommitStatus(name: "Build basic-sim") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant basic-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
} }
} }
} }
...@@ -212,7 +212,7 @@ pipeline { ...@@ -212,7 +212,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build eNb-ethernet") { gitlabCommitStatus(name: "Build eNb-ethernet") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant enb-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
} }
} }
} }
...@@ -221,17 +221,16 @@ pipeline { ...@@ -221,17 +221,16 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build UE-ethernet") { gitlabCommitStatus(name: "Build UE-ethernet") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant ue-ethernet --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
} }
} }
} }
} }
stage ("Build 5G gNB-USRP") { stage ("Build 5G gNB-USRP") {
steps { steps {
gitlabCommitStatus(name: "Build gNb-usrp") { gitlabCommitStatus(name: "Build gNb-usrp") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant gnb-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
...@@ -240,7 +239,7 @@ pipeline { ...@@ -240,7 +239,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build nr-UE-usrp") { gitlabCommitStatus(name: "Build nr-UE-usrp") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant nu-ue-usrp --job-name ${JOB_NAME} --build-id ${BUILD_ID}"
} }
} }
} }
...@@ -249,7 +248,7 @@ pipeline { ...@@ -249,7 +248,7 @@ pipeline {
steps { steps {
gitlabCommitStatus(name: "Build phy-sim") { gitlabCommitStatus(name: "Build phy-sim") {
timeout (time: 20, unit: 'MINUTES') { timeout (time: 20, unit: 'MINUTES') {
sh "./ci-scripts/buildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive" sh "./ci-scripts/waitBuildOnVM.sh --workspace $WORKSPACE --variant phy-sim --job-name ${JOB_NAME} --build-id ${BUILD_ID} --keep-vm-alive"
} }
} }
} }
...@@ -329,6 +328,7 @@ pipeline { ...@@ -329,6 +328,7 @@ pipeline {
} }
} }
} }
/* Disabled for the moment: main.py is pulled over from develop branch for the moment.. problem of location
stage ("Test on CI bench #1") { stage ("Test on CI bench #1") {
stages { stages {
stage ("Test FDD - Band 7 - B210") { stage ("Test FDD - Band 7 - B210") {
...@@ -529,6 +529,7 @@ pipeline { ...@@ -529,6 +529,7 @@ pipeline {
} }
} }
} }
*/
} }
post { post {
always { always {
......
...@@ -57,6 +57,9 @@ function usage { ...@@ -57,6 +57,9 @@ function usage {
echo " --keep-vm-alive OR -k" echo " --keep-vm-alive OR -k"
echo " Keep the VM alive after the build." echo " Keep the VM alive after the build."
echo "" echo ""
echo " --daemon OR -D"
echo " Run as daemon"
echo ""
echo " --help OR -h" echo " --help OR -h"
echo " Print this help message." echo " Print this help message."
echo "" echo ""
...@@ -96,6 +99,7 @@ LOG_PATTERN=.Rel15.txt ...@@ -96,6 +99,7 @@ LOG_PATTERN=.Rel15.txt
NB_PATTERN_FILES=4 NB_PATTERN_FILES=4
BUILD_OPTIONS="--eNB -w USRP" BUILD_OPTIONS="--eNB -w USRP"
KEEP_VM_ALIVE=0 KEEP_VM_ALIVE=0
DAEMON=0
while [[ $# -gt 0 ]] while [[ $# -gt 0 ]]
do do
...@@ -126,6 +130,10 @@ case $key in ...@@ -126,6 +130,10 @@ case $key in
KEEP_VM_ALIVE=1 KEEP_VM_ALIVE=1
shift shift
;; ;;
-D|--daemon)
DAEMON=1
shift
;;
-v1) -v1)
VM_NAME=ci-enb-usrp VM_NAME=ci-enb-usrp
ARCHIVES_LOC=enb_usrp ARCHIVES_LOC=enb_usrp
...@@ -331,13 +339,27 @@ echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS ...@@ -331,13 +339,27 @@ echo "sudo cp 01proxy /etc/apt/apt.conf.d/" > $VM_CMDS
echo "touch /home/ubuntu/.hushlogin" >> $VM_CMDS echo "touch /home/ubuntu/.hushlogin" >> $VM_CMDS
if [[ "$VM_NAME" == *"-cppcheck"* ]] if [[ "$VM_NAME" == *"-cppcheck"* ]]
then then
if [ $DAEMON -eq 0 ]
then
echo "echo \"sudo apt-get --yes --quiet install zip cppcheck \"" >> $VM_CMDS 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 update > zip-install.txt 2>&1" >> $VM_CMDS
echo "sudo apt-get --yes install zip cppcheck >> 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 else
if [ $DAEMON -eq 0 ]
then
echo "echo \"sudo apt-get --yes --quiet install zip subversion libboost-dev \"" >> $VM_CMDS 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 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 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 fi
echo "mkdir tmp" >> $VM_CMDS echo "mkdir tmp" >> $VM_CMDS
echo "cd tmp" >> $VM_CMDS echo "cd tmp" >> $VM_CMDS
...@@ -348,17 +370,38 @@ then ...@@ -348,17 +370,38 @@ then
echo "mkdir cmake_targets/log" >> $VM_CMDS echo "mkdir cmake_targets/log" >> $VM_CMDS
echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS echo "cp /home/ubuntu/zip-install.txt cmake_targets/log" >> $VM_CMDS
echo "echo \"cppcheck $BUILD_OPTIONS . \"" >> $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 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 else
echo "echo \"source oaienv\"" >> $VM_CMDS echo "echo \"source oaienv\"" >> $VM_CMDS
echo "source oaienv" >> $VM_CMDS echo "source oaienv" >> $VM_CMDS
echo "cd cmake_targets/" >> $VM_CMDS echo "cd cmake_targets/" >> $VM_CMDS
echo "mkdir log" >> $VM_CMDS echo "mkdir log" >> $VM_CMDS
echo "cp /home/ubuntu/zip-install.txt 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 "echo \"./build_oai -I $BUILD_OPTIONS \"" >> $VM_CMDS
echo "./build_oai -I $BUILD_OPTIONS > log/install-build.txt 2>&1" >> $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
fi
fi fi
ssh -o StrictHostKeyChecking=no ubuntu@$VM_IP_ADDR < $VM_CMDS 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 "############################################################"
echo "Creating a tmp folder to store results and artifacts" echo "Creating a tmp folder to store results and artifacts"
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment