From: Thanh Ha Date: Sat, 27 May 2017 14:49:49 +0000 (-0400) Subject: Enable archive pattern support X-Git-Tag: v0.3.0~18 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=07b824c8f9cbfad2bdcf8c4de02cbe0a2583d6f5;p=releng%2Fglobal-jjb.git Enable archive pattern support lftools deploy supports archiving using patterns via the -p argument. Pass in this argument if the env variable ARCHIVE_ARTIFACTS is defined. If variable is not defined or blank then a blank string gets passed in which still works. Change-Id: I4d096ea9ad1b0c93864d37c6188f02f7e32f6228 Signed-off-by: Thanh Ha --- diff --git a/README.md b/README.md index 3bad6b0f..4c21ec69 100644 --- a/README.md +++ b/README.md @@ -132,3 +132,18 @@ Optional parameters: **branch**: is the git branch to build from. **jjb-version**: is the version of JJB to install in the build minion. + +## Archiving logs in Jobs + +There are 2 ways supported for archiving log information: + +1) Job creates $WORKSPACE/archives directory and places logs there + +In this method the entire archives directory will be pushed to the log server +in the same structure as configured in the archives directory. + +2) Via job variable ARCHIVE_ARTIFACTS using globstar patterns. + +In this method a job can define a globstar for example ``**/*.log`` which then +causes the archive script to do a globstar search for that pattern and archives +any files it finds matching. diff --git a/shell/logs-deploy.sh b/shell/logs-deploy.sh index fa31f2bc..6dc80285 100644 --- a/shell/logs-deploy.sh +++ b/shell/logs-deploy.sh @@ -15,6 +15,7 @@ set -eu -o pipefail set -x # Trace commands for this script to make debugging easier. +ARCHIVE_ARTIFACTS="${ARCHIVE_ARTIFACTS:-}" LOGS_SERVER="${LOGS_SERVER:-None}" if [ "${LOGS_SERVER}" == 'None' ] @@ -27,7 +28,7 @@ else NEXUS_PATH="${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}" BUILD_URL="${BUILD_URL}" - lftools deploy archives "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE" + lftools deploy archives -p "$ARCHIVE_ARTIFACTS" "$NEXUS_URL" "$NEXUS_PATH" "$WORKSPACE" lftools deploy logs "$NEXUS_URL" "$NEXUS_PATH" "$BUILD_URL" set +x # Disable trace since we no longer need it.