Changeset 26045
- Timestamp:
- 03/08/21 17:00:03 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/jenkins/jenkins.sh ¶
r26044 r26045 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 … … 17 21 18 22 echo "Cleaning up execution directory" 19 rm -rf $ ISSM_DIR/execution/*20 rm -rf $ ISSM_DIR/nightlylog21 mkdir $ ISSM_DIR/nightlylog23 rm -rf ${ISSM_DIR}/execution/* 24 rm -rf ${ISSM_DIR}/nightlylog 25 mkdir ${ISSM_DIR}/nightlylog 22 26 23 27 #Server URI … … 56 60 fi 57 61 58 #Get Operating system (OS) name{{{59 OS=$(uname -s)60 if [[ $OS == CYGWIN* ]]; then61 OS="win";62 fi63 #}}}64 65 62 #Install ISSM 66 63 #Determining installation type depending on svn changes{{{ … … 68 65 echo " Determining Installation type " 69 66 echo "======================================================"; 70 if [ -a $ ISSM_DIR/svn_revision_old ]; then71 SVN_PREVIOUS=$(cat $ ISSM_DIR/svn_revision_old)67 if [ -a ${ISSM_DIR}/svn_revision_old ]; then 68 SVN_PREVIOUS=$(cat ${ISSM_DIR}/svn_revision_old) 72 69 SVN_CURRENT=$SVN_REVISION_1 73 70 echo "Previous revision number: $SVN_PREVIOUS" … … 77 74 # 78 75 79 #svn --non-interactive --no-auth-cache --trust-server-cert diff -r $SVN_PREVIOUS:$SVN_CURRENT --summarize $ ISSM_DIR | awk '{print $NF}' > $ISSM_DIR/TEMP76 #svn --non-interactive --no-auth-cache --trust-server-cert diff -r $SVN_PREVIOUS:$SVN_CURRENT --summarize ${ISSM_DIR} | awk '{print $NF}' > ${ISSM_DIR}/TEMP 80 77 81 78 # Get list of changes from Jenkins itself as svn requires credentials … … 84 81 85 82 # Process html page and get the list of files that has changed (tricky...) 86 #cat changes | grep '="The file was modified"' | sed -e 's/.*<\/td><td><a>\(.*\)<\/a><\/td><td>.*/\1/' > $ ISSM_DIR/TEMP83 #cat changes | grep '="The file was modified"' | sed -e 's/.*<\/td><td><a>\(.*\)<\/a><\/td><td>.*/\1/' > ${ISSM_DIR}/TEMP 87 84 #cat changes | grep 'document_edit' |sed -e 's/document_edit.png/document_edit.png\ 88 #/g' | sed -e 's/.*<\/a><\/td><td>\(.*\)<\/td><\/tr>.*/\1/' | grep -v 'document_edit.png' > $ ISSM_DIR/TEMP89 cat changes | tr " " "\n" | grep trunk | sed -e 's/.*<a>\(.*\)<\/a>.*/\1/' > $ ISSM_DIR/TEMP85 #/g' | sed -e 's/.*<\/a><\/td><td>\(.*\)<\/td><\/tr>.*/\1/' | grep -v 'document_edit.png' > ${ISSM_DIR}/TEMP 86 cat changes | tr " " "\n" | grep trunk | sed -e 's/.*<a>\(.*\)<\/a>.*/\1/' > ${ISSM_DIR}/TEMP 90 87 91 88 # Print list of changed files 92 89 echo " " 93 90 echo "List of updated files" 94 cat $ ISSM_DIR/TEMP91 cat ${ISSM_DIR}/TEMP 95 92 echo " " 96 93 … … 102 99 # If the contents of the externalpackages directory were modified in any 103 100 # way, check for changed external packages 104 if [ ! -z "$(cat $ ISSM_DIR/TEMP | grep externalpackages)" ]; then101 if [ ! -z "$(cat ${ISSM_DIR}/TEMP | grep externalpackages)" ]; then 105 102 echo " -- checking for changed externalpackages... yes" 106 103 ISSM_EXTERNALPACKAGES="yes" … … 112 109 # If the Makefile or m4 diirectory were changed in any way or if certain 113 110 # binary files from a previous compilation do not exist, reconfigure 114 if [ ! -z "$(cat $ ISSM_DIR/TEMP | grep -e "Makefile.am" -e "m4" )" ] ||115 [ ! -f "$ ISSM_DIR/bin/issm.exe" ] && [ ! -f "$ISSM_DIR/bin/issm-bin.js" ] ||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" ] || 116 113 [ "$ISSM_EXTERNALPACKAGES" == "yes" ]; then 117 114 echo " -- checking for reconfiguration... yes" … … 123 120 124 121 # If source files were changed in any way, recompile 125 if [ ! -z "$(cat $ ISSM_DIR/TEMP | grep -e "\.cpp" -e "\.h" )" ] ||122 if [ ! -z "$(cat ${ISSM_DIR}/TEMP | grep -e "\.cpp" -e "\.h" )" ] || 126 123 [ "$ISSM_RECONFIGURE" == "yes" ]; then 127 124 echo " -- checking for recompilation... yes" … … 134 131 # Cleanup 135 132 rm changes 136 rm $ ISSM_DIR/TEMP133 rm ${ISSM_DIR}/TEMP 137 134 else 138 135 echo "Previous revision not found, this must be a fresh install" … … 147 144 echo " " 148 145 echo "Recording current svn version: $SVN_REVISION_1" 149 echo $SVN_REVISION_1 > $ ISSM_DIR/svn_revision_old146 echo $SVN_REVISION_1 > ${ISSM_DIR}/svn_revision_old 150 147 #}}} 151 148 … … 157 154 158 155 #Jenkins XML files for individual packages 159 EXTERNAL_TEST_FILE="$ ISSM_DIR/nightlylog/results/external.xml"160 mkdir -p $ ISSM_DIR/nightlylog/results156 EXTERNAL_TEST_FILE="${ISSM_DIR}/nightlylog/results/external.xml" 157 mkdir -p ${ISSM_DIR}/nightlylog/results 161 158 echo "<testsuite tests=\"$NUMPACKAGES\">" > $EXTERNAL_TEST_FILE 162 159 163 160 # Need a source here for when builds start midway through installation of externalpackages. 164 source $ ISSM_DIR/etc/environment.sh165 166 if [ "$ OS" == "win"]; then161 source ${ISSM_DIR}/etc/environment.sh 162 163 if [ "${OS}" == CYGWIN* ]; then 167 164 echo " == WINDOWS ENVIRONMENT DETECTED ==" 168 source $ ISSM_DIR/externalpackages/windows/windows_environment.sh165 source ${ISSM_DIR}/externalpackages/windows/windows_environment.sh 169 166 fi 170 167 … … 178 175 179 176 #install if requested or if previous install has not been successful 180 if [ "$ ISSM_EXTERNALPACKAGES" == "yes" ]; then # NOTE: Removed check on if 'install' directory exist181 cd $ ISSM_DIR/externalpackages/$PACKAGENAME177 if [ "${ISSM_EXTERNALPACKAGES}" == "yes" ]; then # NOTE: Removed check on if 'install' directory exist 178 cd ${ISSM_DIR}/externalpackages/$PACKAGENAME 182 179 183 180 echo "======================================================"; … … 186 183 187 184 ./$PACKAGEINST $NUMCPUS_INSTALL &> compil.log 188 if [ $? -ne 0 ] && [ "$ PACKAGENAME" != "boost" ]; then185 if [ $? -ne 0 ] && [ "${PACKAGENAME}" != "boost" ]; then 189 186 cat compil.log 190 187 echo "======================================================"; … … 200 197 echo "<testcase classname=\"externalpackages\" name=\"$PACKAGENAME\"/>" >> $EXTERNAL_TEST_FILE 201 198 fi 202 source $ ISSM_DIR/etc/environment.sh199 source ${ISSM_DIR}/etc/environment.sh 203 200 204 201 #If external package is rebuilt, we also need to recompile … … 223 220 224 221 # Source here to include any newly installed externalpackages on the path. 225 source $ ISSM_DIR/etc/environment.sh226 227 if [ "$ OS" == "win"]; then222 source ${ISSM_DIR}/etc/environment.sh 223 224 if [ "${OS}" == CYGWIN* ]; then 228 225 echo " == WINDOWS ENVIRONMENT DETECTED ==" 229 source $ ISSM_DIR/externalpackages/windows/windows_environment.sh226 source ${ISSM_DIR}/externalpackages/windows/windows_environment.sh 230 227 fi 231 228 … … 247 244 #export EMCC_DEBUG=1 # Uncomment to enable debugging 248 245 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 249 source $ ISSM_DIR/externalpackages/emscripten/install/emsdk_env.sh246 source ${ISSM_DIR}/externalpackages/emscripten/install/emsdk_env.sh 250 247 fi 251 248 252 249 #}}} 253 250 #ISSM compilation yes/no (ISSM_COMPILATION) {{{ 254 if [ "$ ISSM_COMPILATION" == "yes" ]; then251 if [ "${ISSM_COMPILATION}" == "yes" ]; then 255 252 cd $ISSM_DIR 256 if [ "$ ISSM_RECONFIGURE" == "yes" ]; then253 if [ "${ISSM_RECONFIGURE}" == "yes" ]; then 257 254 echo "======================================================"; 258 255 echo " Cleaning up and reconfiguring " … … 265 262 exit 1 266 263 fi 267 eval "./configure $ ISSM_CONFIG"264 eval "./configure ${ISSM_CONFIG}" 268 265 if [ $? -ne 0 ]; then 269 266 echo "ISSM configuration failed (see options below)" … … 279 276 echo "======================================================" 280 277 if [ $NUMCPUS_INSTALL -gt 1 ]; then 281 echo "Making with " $NUMCPUS_INSTALL " cpus" 278 echo "Making with ${NUMCPUS_INSTALL} cpus" 279 280 # To debug compilation/linking, add 'V=1' option to the call to make 281 #make -j $NUMCPUS_INSTALL V=1 282 282 make -j $NUMCPUS_INSTALL 283 283 else 284 #make V=1 284 285 make 285 286 fi … … 295 296 fi 296 297 make install 297 elif [ "$ISSM_COMPILATION" == "no" ] 298 then 298 elif [ "${ISSM_COMPILATION}" == "no" ]; then 299 299 echo "Skipping ISSM compilation" 300 300 else … … 314 314 for (( i=1;i<=$NUMCPUS_RUN;i++ )); do 315 315 #Launch matlab and the nightly run script 316 cat > $ ISSM_DIR/nightlylog/matlab_run$i.m << EOF316 cat > ${ISSM_DIR}/nightlylog/matlab_run$i.m << EOF 317 317 warning off %necessary to avoid a log of several Go for parallel runs 318 318 try, 319 $(if [ "$ MATLAB_NROPTIONS" = "" ]; then320 echo "runme('output','nightly','rank',$ i,'numprocs',$NUMCPUS_RUN);"319 $(if [ "${MATLAB_NROPTIONS}" = "" ]; then 320 echo "runme('output','nightly','rank',${i},'numprocs',${NUMCPUS_RUN});" 321 321 else 322 echo "runme($ MATLAB_NROPTIONS,'output','nightly','rank',$i,'numprocs',$NUMCPUS_RUN);"322 echo "runme(${MATLAB_NROPTIONS},'output','nightly','rank',${i},'numprocs',${NUMCPUS_RUN});" 323 323 fi) 324 324 catch me, … … 335 335 EOF 336 336 cd $ISSM_DIR/test/NightlyRun 337 if [ "$OS" = "win"]; then338 $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 &337 if [[ "${OS}" == CYGWIN* || "${OS}" == MINGW* ]]; then 338 $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 & 339 339 else 340 $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 &340 $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 & 341 341 fi 342 342 done 343 343 344 # wait until matlab closes345 if [ "$OS" = "win"]; then344 # Wait for MATLAB to exit 345 if [[ "${OS}" == CYGWIN* ]]; then 346 346 sleep 5; 347 echo "Waiting for matlab on windows"347 echo "Waiting for MATLAB to exit" 348 348 pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}') 349 349 echo '-----------------------------' 350 echo "pid: $ pid"350 echo "pid: ${pid}" 351 351 echo '-----------------------------' 352 while [ -n "$ pid" ]; do352 while [ -n "${pid}" ]; do 353 353 pid=$(ps aux -W | grep MATLAB | awk '{printf("%s\n","MATLAB");}') 354 354 sleep 1; 355 355 done 356 356 echo "DONE!" 357 elif [[ "${OS}" == MINGW* ]]; then 358 # NOTE: The PID query used here may work as well on Cygwin. If so, combine the two conditional blocks. 359 sleep 5; 360 echo "Waiting for MATLAB to exit" 361 pid=$(ps -W | grep MATLAB | awk '{print $1}') 362 echo '-----------------------------' 363 echo "pid: ${pid}" 364 echo '-----------------------------' 365 while [ -n "${pid}" ]; do 366 pid=$(ps -W | grep MATLAB | awk '{print $1}') 367 sleep 1; 368 done 357 369 else 358 370 wait 359 371 fi 360 372 361 #concatenate reports 362 cd $ISSM_DIR/nightlylog/ 363 #echo 'CHECKING NIGHTLYLOG DIRECTORY' 364 #echo '-----------------------------' 365 #ls -la 366 #echo '-----------------------------' 373 # Concatenate logs 374 cd $ISSM_DIR/nightlylog 367 375 368 376 if [ -f matlab_log.log ]; then … … 371 379 372 380 for job in `jobs -p`; do 373 echo "Waiting on: $job"381 #echo "Waiting on: ${job}" # Commented out because it really has nothing to do with MATLAB processes 374 382 wait $job 375 383 done … … 390 398 if [ $PYTHON_TEST -eq 1 ]; then 391 399 #Launch all tests on different cpus 392 export PYTHONPATH="$ ISSM_DIR/src/m/dev"400 export PYTHONPATH="${ISSM_DIR}/src/m/dev" 393 401 export PYTHONSTARTUP="${PYTHONPATH}/devpath.py" 394 402 export PYTHONUNBUFFERED=1 #we don't want python to buffer otherwise issm.exe output is not captured … … 401 409 done 402 410 403 # concatenate reports404 cd $ISSM_DIR/nightlylog /411 # Concatenate logs 412 cd $ISSM_DIR/nightlylog 405 413 if [ -f python_log.log ]; then 406 414 rm python_log.log … … 409 417 for job in `jobs -p` 410 418 do 411 echo "Waiting on: $ job"419 echo "Waiting on: ${job}" 412 420 wait $job 413 421 done … … 432 440 # }}} 433 441 434 # process logs to be junit compatible442 # Process logs to be JUnit compatible 435 443 #{{{ 436 444 cd $ISSM_DIR/nightlylog
Note:
See TracChangeset
for help on using the changeset viewer.