Commit f04dcbd1 authored by Raphael Defosseux's avatar Raphael Defosseux

CI:

  Adding a build stage on CentOS (only one variant : -w USRP --eNB)
  Should not trigger a fail for the moment
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent e5634431
...@@ -30,6 +30,8 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) { ...@@ -30,6 +30,8 @@ def sendSocialMediaMessage(pipeChannel, pipeColor, pipeMessage) {
} }
} }
def doRedHatBuild = false
pipeline { pipeline {
agent { agent {
label 'bellatrix' label 'bellatrix'
...@@ -42,6 +44,30 @@ pipeline { ...@@ -42,6 +44,30 @@ pipeline {
} }
stages { stages {
stage ("Verify Parameters") {
steps {
script {
echo '\u2705 \u001B[32mVerify Parameters\u001B[0m'
def allParametersPresent = true
if (params.RedHatRemoteServer == null) {
allParametersPresent = false
}
if (params.RedHatRemoteCredentials == null) {
allParametersPresent = false
}
if (params.RedHatWorkingPath == null) {
allParametersPresent = false
}
if (allParametersPresent) {
echo "Performing Red Hat Build"
doRedHatBuild = true
} else {
doRedHatBuild = false
}
}
}
}
stage ("Verify Guidelines") { stage ("Verify Guidelines") {
steps { steps {
echo "Git URL is ${GIT_URL}" echo "Git URL is ${GIT_URL}"
...@@ -165,6 +191,24 @@ pipeline { ...@@ -165,6 +191,24 @@ pipeline {
} }
} }
} }
stage ("Build eNb-USRP on Red Hat") {
when {
expression {doRedHatBuild}
}
steps {
script {
try {
withCredentials([
[$class: 'UsernamePasswordMultiBinding', credentialsId: "${params.RedHatRemoteCredentials}", usernameVariable: 'RH_Username', passwordVariable: 'RH_Password']
]) {
sh "./ci-scripts/buildOnRH.sh --workspace $WORKSPACE --job-name ${JOB_NAME} --build-id ${BUILD_ID} --remote-host ${params.RedHatRemoteServer} --remote-path ${params.RedHatWorkingPath} --remote-user-name ${RH_Username} --remote-password ${RH_Password}"
}
} catch (Exception e) {
echo "Red Hat build failed not an error now"
}
}
}
}
} }
post { post {
always { always {
......
#!/bin/bash
#/*
# * 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
# */
function usage {
echo "OAI RedHat Build Check script"
echo " Original Author: Raphael Defosseux"
echo ""
echo "Usage:"
echo "------"
echo " buildOnRH.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 " --workspace #### OR -ws ####"
echo " Specify the workspace."
echo ""
echo " --remote-host #### OR -rh ####"
echo " Specify the RedHat remote server."
echo ""
echo " --remote-user-name #### OR -ru ####"
echo " Specify the RedHat remote server username."
echo ""
echo " --remote-password #### OR -rp ####"
echo " Specify the RedHat remote server password."
echo ""
echo " --remote-path #### OR -ra ####"
echo " Specify the RedHat remote server path to work on."
echo ""
}
if [ $# -lt 1 ] || [ $# -gt 14 ]
then
echo "Syntax Error: not the correct number of arguments"
echo ""
usage
exit 1
fi
RH_HOST=XX
RH_USER=XX
RH_PASSWD=XX
RH_PATH=XX
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
;;
-ws|--workspace)
JENKINS_WKSP="$2"
shift
shift
;;
-rh|--remote-host)
RH_HOST="$2"
shift
shift
;;
-ru|--remote-user-name)
RH_USER="$2"
shift
shift
;;
-rp|--remote-password)
RH_PASSWD="$2"
shift
shift
;;
-ra|--remote-path)
RH_PATH="$2"
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 [ "$JOB_NAME" == "XX" ] || [ "$BUILD_ID" == "XX" ] || [ "$RH_HOST" == "XX" ] || [ "$RH_USER" == "XX" ] || [ "$RH_PASSWD" == "XX" ] || [ "$RH_PATH" == "XX" ]
then
echo "Missing options"
usage
exit 1
fi
echo "############################################################"
echo "Copying GIT repo into RedHat Server"
echo "############################################################"
echo "rm -Rf ${RH_PATH}" >> rh-cmd.txt
echo "mkdir -p ${RH_PATH}" >> rh-cmd.txt
sshpass -p ${RH_PASSWD} ssh -o 'StrictHostKeyChecking no' ${RH_USER}@${RH_HOST} < rh-cmd.txt
rm -f rh-cmd.txt
echo "############################################################"
echo "Running install and build script on RedHat Server"
echo "############################################################"
sshpass -p ${RH_PASSWD} scp -o 'StrictHostKeyChecking no' $JENKINS_WKSP/localZip.zip ${RH_USER}@${RH_HOST}:${RH_PATH}
echo "cd ${RH_PATH}" > rh-cmd.txt
echo "unzip -qq localZip.zip" >> rh-cmd.txt
echo "source oaienv" >> rh-cmd.txt
echo "cd cmake_targets" >> rh-cmd.txt
echo "mkdir -p log" >> rh-cmd.txt
echo "./build_oai -I -w USRP --eNB > log/install-build.txt 2>&1" >> rh-cmd.txt
sshpass -p ${RH_PASSWD} ssh -o 'StrictHostKeyChecking no' ${RH_USER}@${RH_HOST} < rh-cmd.txt
rm -f rh-cmd.txt
echo "############################################################"
echo "Creating a tmp folder to store results and artifacts"
echo "############################################################"
if [ ! -d $JENKINS_WKSP/archives ]
then
mkdir -p $JENKINS_WKSP/archives
fi
ARCHIVES_LOC=$JENKINS_WKSP/archives/red_hat
if [ ! -d $ARCHIVES_LOC ]
then
mkdir -p $ARCHIVES_LOC
fi
sshpass -p ${RH_PASSWD} scp -o 'StrictHostKeyChecking no' ${RH_USER}@${RH_HOST}:${RH_PATH}/cmake_targets/log/*.txt $ARCHIVES_LOC
echo "############################################################"
echo "Checking build status"
echo "############################################################"
LOG_PATTERN=.Rel14.txt
NB_PATTERN_FILES=4
LOG_FILES=`ls $ARCHIVES_LOC/*.txt`
STATUS=0
NB_FOUND_FILES=0
for FULLFILE in $LOG_FILES
do
if [[ $FULLFILE == *"$LOG_PATTERN"* ]]
then
filename=$(basename -- "$FULLFILE")
PASS_PATTERN=`echo $filename | sed -e "s#$LOG_PATTERN##"`
LOCAL_STAT=`egrep -c "Built target $PASS_PATTERN" $FULLFILE`
if [ $LOCAL_STAT -eq 0 ]; then STATUS=-1; fi
NB_FOUND_FILES=$((NB_FOUND_FILES + 1))
fi
done
if [ $NB_PATTERN_FILES -ne $NB_FOUND_FILES ]; then STATUS=-1; fi
if [ $STATUS -eq 0 ]
then
echo "STATUS seems OK"
else
echo "STATUS failed?"
fi
exit $STATUS
...@@ -498,6 +498,8 @@ then ...@@ -498,6 +498,8 @@ then
echo " </table>" >> ./build_results.html echo " </table>" >> ./build_results.html
fi fi
echo " <h2>Ubuntu 16.04 LTS -- Summary</h2>" >> ./build_results.html
sca_summary_table_header "OAI Static Code Analysis with CPPCHECK" sca_summary_table_header "OAI Static Code Analysis with CPPCHECK"
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized variable" uninitvar
sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember sca_summary_table_row ./archives/cppcheck/cppcheck.xml "Uninitialized struct member" uninitStructMember
...@@ -547,6 +549,15 @@ summary_table_row "RB Tools - Release 14" ./archives/ue_eth/rb_tool.Rel14.txt "B ...@@ -547,6 +549,15 @@ summary_table_row "RB Tools - Release 14" ./archives/ue_eth/rb_tool.Rel14.txt "B
summary_table_row "NAS Mesh - Release 14" ./archives/ue_eth/nasmesh.Rel14.txt "Built target nasmesh" ./ue_eth_row6.html summary_table_row "NAS Mesh - Release 14" ./archives/ue_eth/nasmesh.Rel14.txt "Built target nasmesh" ./ue_eth_row6.html
summary_table_footer summary_table_footer
echo " <h2>Red Hat (CentOS Linux release 7.4.1708) -- Summary</h2>" >> ./build_results.html
summary_table_header "Red Hat -- OAI Build eNB -- USRP option"
summary_table_row "LTE SoftModem - Release 14" ./archives/red_hat/lte-softmodem.Rel14.txt "Built target lte-softmodem" ./enb_usrp_rh_row1.html
summary_table_row "Coding - Release 14" ./archives/red_hat/coding.Rel14.txt "Built target coding" ./enb_usrp_rh_row2.html
summary_table_row "OAI USRP device if - Release 14" ./archives/red_hat/oai_usrpdevif.Rel14.txt "Built target oai_usrpdevif" ./enb_usrp_rh_row3.html
summary_table_row "Parameters Lib Config - Release 14" ./archives/red_hat/params_libconfig.Rel14.txt "Built target params_libconfig" ./enb_usrp_rh_row4.html
summary_table_footer
echo " <h3>Details</h3>" >> ./build_results.html echo " <h3>Details</h3>" >> ./build_results.html
for DETAILS_TABLE in `ls ./enb_usrp_row*.html` for DETAILS_TABLE in `ls ./enb_usrp_row*.html`
...@@ -569,7 +580,11 @@ for DETAILS_TABLE in `ls ./ue_eth_row*.html` ...@@ -569,7 +580,11 @@ for DETAILS_TABLE in `ls ./ue_eth_row*.html`
do do
cat $DETAILS_TABLE >> ./build_results.html cat $DETAILS_TABLE >> ./build_results.html
done done
rm -f ./enb_usrp_row*.html ./basic_sim_row*.html ./phy_sim_row*.html ./enb_eth_row*.html ./ue_eth_row*.html for DETAILS_TABLE in `ls ./enb_usrp_rh_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 ./enb_usrp_rh_row*.html
echo "</body>" >> ./build_results.html echo "</body>" >> ./build_results.html
echo "</html>" >> ./build_results.html echo "</html>" >> ./build_results.html
......
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