X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Finclude-raw-deploy-archives.sh;h=53d2991a54f02308ff1581b09ba1af72cde8722c;hb=1c5bc5dd108afea15e4172da8a27a97a4198e74e;hp=f5d96bd22b0c49d46fecd36c97d6b9ff5a33b0ab;hpb=4ce44f46d53a850d29fb5a101737084b519209ca;p=releng%2Fbuilder.git diff --git a/jjb/include-raw-deploy-archives.sh b/jjb/include-raw-deploy-archives.sh index f5d96bd22..53d2991a5 100644 --- a/jjb/include-raw-deploy-archives.sh +++ b/jjb/include-raw-deploy-archives.sh @@ -1,6 +1,27 @@ #!/bin/bash + +set +e # Do not affect the build result if some part of archiving fails. + +# Print out git status at the end of the build before we archive if $WORKSPACE +# is a git repo. +if [ -d $WORKSPACE/.git ]; then + echo "" + echo "----------> Git Status Report" + git status +fi + +echo "" +echo "----------> Archiving build to logs server" +# Configure wget to not print download status when we download logs or when +# Jenkins is installing Maven (To be clear this is the Jenkins Maven plugin +# using a shell script itself that we are unable to modify directly to affect +# wget). +echo "verbose=off" > ~/.wgetrc + ARCHIVES_DIR="$JENKINS_HOSTNAME/$JOB_NAME/$BUILD_NUMBER" -LOGS_SERVER="https://logs.opendaylight.org" +[ "$LOGS_SERVER" ] || LOGS_SERVER="https://logs.opendaylight.org" +[ "$LOGS_REPO_URL" ] || LOGS_REPO_URL="https://nexus.opendaylight.org/service/local/repositories/logs" + echo "Build logs: $LOGS_SERVER/$SILO/$ARCHIVES_DIR" mkdir .archives @@ -37,7 +58,7 @@ cat > deploy-archives.xml < opendaylight-log-archives - https://nexus.opendaylight.org/service/local/repositories/logs/content-compressed + $LOGS_REPO_URL/content-compressed archives.zip $SILO @@ -63,16 +84,31 @@ if [ ! -z "${{ARCHIVE_ARTIFACTS}}" ]; then shopt -u globstar # Disable globstar once archives are copied popd fi + + # Ignore logging if archives doesn't exist mv $WORKSPACE/archives/ $ARCHIVES_DIR > /dev/null 2>&1 touch $ARCHIVES_DIR/_build-details.txt echo "build-url: ${{BUILD_URL}}" >> $ARCHIVES_DIR/_build-details.txt -env > $ARCHIVES_DIR/_build-enviroment-variables.txt +env | grep -v PASSWORD > $ARCHIVES_DIR/_build-enviroment-variables.txt + +# capture system info +touch $ARCHIVES_DIR/_sys-info.txt +{{ + echo -e "uname -a:\n `uname -a` \n" + echo -e "df -h:\n `df -h` \n" + echo -e "free -m:\n `free -m` \n" + echo -e "nproc:\n `nproc` \n" + echo -e "lscpu:\n `lscpu` \n" + echo -e "ip addr:\n `/sbin/ip addr` \n" +}} 2>&1 | tee -a $ARCHIVES_DIR/_sys-info.txt # Magic string used to trim console logs at the appropriate level during wget echo "-----END_OF_BUILD-----" -wget -O $ARCHIVES_DIR/_console-output.log ${{BUILD_URL}}consoleText -sed -i '/^-----END_OF_BUILD-----$/,$d' $ARCHIVES_DIR/_console-output.log +wget -O $ARCHIVES_DIR/console.log ${{BUILD_URL}}consoleText +wget -O $ARCHIVES_DIR/console-timestamp.log "${{BUILD_URL}}/timestamps?time=HH:mm:ss&appendLog" +sed -i '/^-----END_OF_BUILD-----$/,$d' $ARCHIVES_DIR/console.log +sed -i '/^.*-----END_OF_BUILD-----$/,$d' $ARCHIVES_DIR/console-timestamp.log gzip $ARCHIVES_DIR/*.txt $ARCHIVES_DIR/*.log # find and gzip any 'text' files @@ -82,5 +118,5 @@ find $ARCHIVES_DIR -type f -print0 \ | cut -d: -f1 \ | xargs -d'\n' -r gzip -zip -r archives.zip $JENKINS_HOSTNAME/ +zip -r archives.zip $JENKINS_HOSTNAME/ > $ARCHIVES_DIR/_archives-zip.log du -sh archives.zip