Changeset 26034 for issm/trunk-jpl/jenkins/jenkins.sh
- Timestamp:
- 02/26/21 10:56:08 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/jenkins/jenkins.sh
r25979 r26034 7 7 # members of the ISSM development team. 8 8 # 9 # NOTE: 10 # - Variable OS is set in environment by running 11 # `source $ISSM_DIR/etc/environment.sh`. 12 # 9 13 # TODO: 10 14 # - Rename TEMP to something more descriptive (ensure first that other parts of … … 14 18 15 19 echo "Cleaning up execution directory" 16 rm -rf $ ISSM_DIR/execution/*17 rm -rf $ ISSM_DIR/nightlylog18 mkdir $ ISSM_DIR/nightlylog20 rm -rf ${ISSM_DIR}/execution/* 21 rm -rf ${ISSM_DIR}/nightlylog 22 mkdir ${ISSM_DIR}/nightlylog 19 23 20 24 #Server URI … … 53 57 fi 54 58 55 #Get Operating system (OS) name{{{56 OS=$(uname -s)57 if [[ $OS == CYGWIN* ]]; then58 OS="win";59 fi60 #}}}61 62 59 #Install ISSM 63 60 #Determining installation type depending on svn changes{{{ … … 65 62 echo " Determining Installation type " 66 63 echo "======================================================"; 67 if [ -a $ ISSM_DIR/svn_revision_old ]; then68 SVN_PREVIOUS=$(cat $ ISSM_DIR/svn_revision_old)64 if [ -a ${ISSM_DIR}/svn_revision_old ]; then 65 SVN_PREVIOUS=$(cat ${ISSM_DIR}/svn_revision_old) 69 66 SVN_CURRENT=$SVN_REVISION_1 70 67 echo "Previous revision number: $SVN_PREVIOUS" … … 74 71 # 75 72 76 #svn --non-interactive --no-auth-cache --trust-server-cert diff -r $SVN_PREVIOUS:$SVN_CURRENT --summarize $ ISSM_DIR | awk '{print $NF}' > $ISSM_DIR/TEMP73 #svn --non-interactive --no-auth-cache --trust-server-cert diff -r $SVN_PREVIOUS:$SVN_CURRENT --summarize ${ISSM_DIR} | awk '{print $NF}' > ${ISSM_DIR}/TEMP 77 74 78 75 # Get list of changes from Jenkins itself as svn requires credentials … … 81 78 82 79 # Process html page and get the list of files that has changed (tricky...) 83 #cat changes | grep '="The file was modified"' | sed -e 's/.*<\/td><td><a>\(.*\)<\/a><\/td><td>.*/\1/' > $ ISSM_DIR/TEMP80 #cat changes | grep '="The file was modified"' | sed -e 's/.*<\/td><td><a>\(.*\)<\/a><\/td><td>.*/\1/' > ${ISSM_DIR}/TEMP 84 81 #cat changes | grep 'document_edit' |sed -e 's/document_edit.png/document_edit.png\ 85 #/g' | sed -e 's/.*<\/a><\/td><td>\(.*\)<\/td><\/tr>.*/\1/' | grep -v 'document_edit.png' > $ ISSM_DIR/TEMP86 cat changes | tr " " "\n" | grep trunk | sed -e 's/.*<a>\(.*\)<\/a>.*/\1/' > $ ISSM_DIR/TEMP82 #/g' | sed -e 's/.*<\/a><\/td><td>\(.*\)<\/td><\/tr>.*/\1/' | grep -v 'document_edit.png' > ${ISSM_DIR}/TEMP 83 cat changes | tr " " "\n" | grep trunk | sed -e 's/.*<a>\(.*\)<\/a>.*/\1/' > ${ISSM_DIR}/TEMP 87 84 88 85 # Print list of changed files 89 86 echo " " 90 87 echo "List of updated files" 91 cat $ ISSM_DIR/TEMP88 cat ${ISSM_DIR}/TEMP 92 89 echo " " 93 90 … … 99 96 # If the contents of the externalpackages directory were modified in any 100 97 # way, check for changed external packages 101 if [ ! -z "$(cat $ ISSM_DIR/TEMP | grep externalpackages)" ]; then98 if [ ! -z "$(cat ${ISSM_DIR}/TEMP | grep externalpackages)" ]; then 102 99 echo " -- checking for changed externalpackages... yes" 103 100 ISSM_EXTERNALPACKAGES="yes" … … 109 106 # If the Makefile or m4 diirectory were changed in any way or if certain 110 107 # binary files from a previous compilation do not exist, reconfigure 111 if [ ! -z "$(cat $ ISSM_DIR/TEMP | grep -e "Makefile.am" -e "m4" )" ] ||112 [ ! -f "$ ISSM_DIR/bin/issm.exe" ] && [ ! -f "$ISSM_DIR/bin/issm-bin.js" ] ||108 if [ ! -z "$(cat ${ISSM_DIR}/TEMP | grep -e "Makefile.am" -e "m4" )" ] || 109 [ ! -f "${ISSM_DIR}/bin/issm.exe" ] && [ ! -f "${ISSM_DIR}/bin/issm-bin.js" ] || 113 110 [ "$ISSM_EXTERNALPACKAGES" == "yes" ]; then 114 111 echo " -- checking for reconfiguration... yes" … … 120 117 121 118 # If source files were changed in any way, recompile 122 if [ ! -z "$(cat $ ISSM_DIR/TEMP | grep -e "\.cpp" -e "\.h" )" ] ||119 if [ ! -z "$(cat ${ISSM_DIR}/TEMP | grep -e "\.cpp" -e "\.h" )" ] || 123 120 [ "$ISSM_RECONFIGURE" == "yes" ]; then 124 121 echo " -- checking for recompilation... yes" … … 131 128 # Cleanup 132 129 rm changes 133 rm $ ISSM_DIR/TEMP130 rm ${ISSM_DIR}/TEMP 134 131 else 135 132 echo "Previous revision not found, this must be a fresh install" … … 144 141 echo " " 145 142 echo "Recording current svn version: $SVN_REVISION_1" 146 echo $SVN_REVISION_1 > $ ISSM_DIR/svn_revision_old143 echo $SVN_REVISION_1 > ${ISSM_DIR}/svn_revision_old 147 144 #}}} 148 145 … … 154 151 155 152 #Jenkins XML files for individual packages 156 EXTERNAL_TEST_FILE="$ ISSM_DIR/nightlylog/results/external.xml"157 mkdir -p $ ISSM_DIR/nightlylog/results153 EXTERNAL_TEST_FILE="${ISSM_DIR}/nightlylog/results/external.xml" 154 mkdir -p ${ISSM_DIR}/nightlylog/results 158 155 echo "<testsuite tests=\"$NUMPACKAGES\">" > $EXTERNAL_TEST_FILE 159 156 160 157 # Need a source here for when builds start midway through installation of externalpackages. 161 source $ ISSM_DIR/etc/environment.sh162 163 if [ "$ OS" == "win"]; then158 source ${ISSM_DIR}/etc/environment.sh 159 160 if [ "${OS}" == CYGWIN* ]; then 164 161 echo " == WINDOWS ENVIRONMENT DETECTED ==" 165 source $ ISSM_DIR/externalpackages/windows/windows_environment.sh162 source ${ISSM_DIR}/externalpackages/windows/windows_environment.sh 166 163 fi 167 164 … … 175 172 176 173 #install if requested or if previous install has not been successful 177 if [ "$ ISSM_EXTERNALPACKAGES" == "yes" ]; then # NOTE: Removed check on if 'install' directory exist178 cd $ ISSM_DIR/externalpackages/$PACKAGENAME174 if [ "${ISSM_EXTERNALPACKAGES}" == "yes" ]; then # NOTE: Removed check on if 'install' directory exist 175 cd ${ISSM_DIR}/externalpackages/$PACKAGENAME 179 176 180 177 echo "======================================================"; … … 183 180 184 181 ./$PACKAGEINST $NUMCPUS_INSTALL &> compil.log 185 if [ $? -ne 0 ] && [ "$ PACKAGENAME" != "boost" ]; then182 if [ $? -ne 0 ] && [ "${PACKAGENAME}" != "boost" ]; then 186 183 cat compil.log 187 184 echo "======================================================"; … … 197 194 echo "<testcase classname=\"externalpackages\" name=\"$PACKAGENAME\"/>" >> $EXTERNAL_TEST_FILE 198 195 fi 199 source $ ISSM_DIR/etc/environment.sh196 source ${ISSM_DIR}/etc/environment.sh 200 197 201 198 #If external package is rebuilt, we also need to recompile … … 220 217 221 218 # Source here to include any newly installed externalpackages on the path. 222 source $ ISSM_DIR/etc/environment.sh223 224 if [ "$ OS" == "win"]; then219 source ${ISSM_DIR}/etc/environment.sh 220 221 if [ "${OS}" == CYGWIN* ]; then 225 222 echo " == WINDOWS ENVIRONMENT DETECTED ==" 226 source $ ISSM_DIR/externalpackages/windows/windows_environment.sh223 source ${ISSM_DIR}/externalpackages/windows/windows_environment.sh 227 224 fi 228 225 … … 244 241 #export EMCC_DEBUG=1 # Uncomment to enable debugging 245 242 export EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0" # Required after v1.38.14 to avoid undefined symbol warnings from our Fortran object files being treated as errors 246 source $ ISSM_DIR/externalpackages/emscripten/install/emsdk_env.sh243 source ${ISSM_DIR}/externalpackages/emscripten/install/emsdk_env.sh 247 244 fi 248 245 249 246 #}}} 250 247 #ISSM compilation yes/no (ISSM_COMPILATION) {{{ 251 if [ "$ ISSM_COMPILATION" == "yes" ]; then248 if [ "${ISSM_COMPILATION}" == "yes" ]; then 252 249 cd $ISSM_DIR 253 if [ "$ ISSM_RECONFIGURE" == "yes" ]; then250 if [ "${ISSM_RECONFIGURE}" == "yes" ]; then 254 251 echo "======================================================"; 255 252 echo " Cleaning up and reconfiguring " … … 262 259 exit 1 263 260 fi 264 eval "./configure $ ISSM_CONFIG"261 eval "./configure ${ISSM_CONFIG}" 265 262 if [ $? -ne 0 ]; then 266 263 echo "ISSM configuration failed (see options below)" … … 276 273 echo "======================================================" 277 274 if [ $NUMCPUS_INSTALL -gt 1 ]; then 278 echo "Making with " $NUMCPUS_INSTALL " cpus" 275 echo "Making with ${NUMCPUS_INSTALL} cpus" 276 277 # To debug compilation/linking, add 'V=1' option to the call to make 278 #make -j $NUMCPUS_INSTALL V=1 279 279 make -j $NUMCPUS_INSTALL 280 280 else 281 #make V=1 281 282 make 282 283 fi … … 292 293 fi 293 294 make install 294 elif [ "$ISSM_COMPILATION" == "no" ] 295 then 295 elif [ "${ISSM_COMPILATION}" == "no" ]; then 296 296 echo "Skipping ISSM compilation" 297 297 else … … 311 311 for (( i=1;i<=$NUMCPUS_RUN;i++ )); do 312 312 #Launch matlab and the nightly run script 313 cat > $ ISSM_DIR/nightlylog/matlab_run$i.m << EOF313 cat > ${ISSM_DIR}/nightlylog/matlab_run$i.m << EOF 314 314 warning off %necessary to avoid a log of several Go for parallel runs 315 315 try, 316 $(if [ "$ MATLAB_NROPTIONS" = "" ]; then317 echo "runme('output','nightly','rank',$ i,'numprocs',$NUMCPUS_RUN);"316 $(if [ "${MATLAB_NROPTIONS}" = "" ]; then 317 echo "runme('output','nightly','rank',${i},'numprocs',${NUMCPUS_RUN});" 318 318 else 319 echo "runme($ MATLAB_NROPTIONS,'output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"319 echo "runme(${MATLAB_NROPTIONS},'output','nightly','rank',${i},'numprocs',${NUMCPUS_RUN});" 320 320 fi) 321 321 catch me, … … 332 332 EOF 333 333 cd $ISSM_DIR/test/NightlyRun 334 if [ "$OS" = "win"]; then335 $MATLAB_PATH/bin/matlab -nod isplay -nosplash -r "addpath $ISSM_DIR_WIN/src/m/dev; devpath; addpath $ISSM_DIR_WIN/nightlylog/; matlab_run$i" -logfile $ISSM_DIR_WIN/nightlylog/matlab_log$i.log &334 if [[ "${OS}" == CYGWIN* || "${OS}" == MINGW* ]]; then 335 $MATLAB_PATH/bin/matlab -nodesktop -nosplash -nojvm -r "addpath ${ISSM_DIR_WIN}/src/m/dev; devpath; addpath ${ISSM_DIR_WIN}/nightlylog; matlab_run$i" -logfile ${ISSM_DIR_WIN}/nightlylog/matlab_log$i.log & 336 336 else 337 $MATLAB_PATH/bin/matlab -nodisplay -nosplash -r "addpath $ ISSM_DIR/src/m/dev; devpath; addpath $ISSM_DIR/nightlylog/; matlab_run$i" -logfile $ISSM_DIR/nightlylog/matlab_log$i.log &337 $MATLAB_PATH/bin/matlab -nodisplay -nosplash -r "addpath ${ISSM_DIR}/src/m/dev; devpath; addpath ${ISSM_DIR}/nightlylog; matlab_run$i" -logfile ${ISSM_DIR}/nightlylog/matlab_log$i.log & 338 338 fi 339 339 done 340 340 341 # wait until matlab closes342 if [ "$OS" = "win"]; then341 # Wait for MATLAB to exit 342 if [[ "${OS}" == CYGWIN* ]]; then 343 343 sleep 5; 344 echo "Waiting for matlab on windows"344 echo "Waiting for MATLAB to exit" 345 345 pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}') 346 346 echo '-----------------------------' 347 echo "pid: $ pid"347 echo "pid: ${pid}" 348 348 echo '-----------------------------' 349 while [ -n "$ pid" ]; do349 while [ -n "${pid}" ]; do 350 350 pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}') 351 351 sleep 1; 352 352 done 353 353 echo "DONE!" 354 elif [[ "${OS}" == MINGW* ]]; then 355 # NOTE: The PID query used here may work as well on Cygwin. If so, combine the two conditional blocks. 356 sleep 5; 357 echo "Waiting for MATLAB to exit" 358 pid=$(ps -W | grep MATLAB | awk '{print $1}') 359 echo '-----------------------------' 360 echo "pid: ${pid}" 361 echo '-----------------------------' 362 while [ -n "${pid}" ]; do 363 pid=$(ps -W | grep MATLAB | awk '{print $1}') 364 sleep 1; 365 done 354 366 else 355 367 wait 356 368 fi 357 369 358 #concatenate reports 359 cd $ISSM_DIR/nightlylog/ 360 #echo 'CHECKING NIGHTLYLOG DIRECTORY' 361 #echo '-----------------------------' 362 #ls -la 363 #echo '-----------------------------' 370 # Concatenate logs 371 cd $ISSM_DIR/nightlylog 364 372 365 373 if [ -f matlab_log.log ]; then … … 368 376 369 377 for job in `jobs -p`; do 370 echo "Waiting on: $job"378 #echo "Waiting on: ${job}" # Commented out because it really has nothing to do with MATLAB processes 371 379 wait $job 372 380 done … … 387 395 if [ $PYTHON_TEST -eq 1 ]; then 388 396 #Launch all tests on different cpus 389 export PYTHONPATH="$ ISSM_DIR/src/m/dev"397 export PYTHONPATH="${ISSM_DIR}/src/m/dev" 390 398 export PYTHONSTARTUP="${PYTHONPATH}/devpath.py" 391 399 export PYTHONUNBUFFERED=1 #we don't want python to buffer otherwise issm.exe output is not captured … … 398 406 done 399 407 400 # concatenate reports401 cd $ISSM_DIR/nightlylog /408 # Concatenate logs 409 cd $ISSM_DIR/nightlylog 402 410 if [ -f python_log.log ]; then 403 411 rm python_log.log … … 406 414 for job in `jobs -p` 407 415 do 408 echo "Waiting on: $ job"416 echo "Waiting on: ${job}" 409 417 wait $job 410 418 done … … 429 437 # }}} 430 438 431 # process logs to be junit compatible439 # Process logs to be JUnit compatible 432 440 #{{{ 433 441 cd $ISSM_DIR/nightlylog
Note:
See TracChangeset
for help on using the changeset viewer.