Rename log file (#14389)

Signed-off-by: Jenny Li <jing.li@zilliz.com>
pull/14458/head
Jenny Li 2021-12-28 19:00:29 +08:00 committed by GitHub
parent c76ae203ec
commit b767b9844a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 5 deletions

View File

@ -77,17 +77,30 @@ Use \"$0 --help\" for more information about a given command.
esac esac
done done
LOG_DIR=${LOG_DIR:-/ci-logs/}
RELEASE_NAME=${RELEASE_NAME:-milvus-testing}
RELEASE_LOG_DIR=/${RELEASE_NAME}
if [[ ! -d ${RELEASE_LOG_DIR} ]] ;then
mkdir -p ${RELEASE_LOG_DIR}
fi
# try to found logs file from mount disk /volume1/ci-logs # try to found logs file from mount disk /volume1/ci-logs
find ${LOG_DIR:-/ci-logs/} -type f -name "*${RELEASE_NAME:-milvus-testing}*" \ log_files=$(find ${LOG_DIR} -type f -name "*${RELEASE_NAME}*" )
| xargs tar -zcvf ${ARTIFACTS_NAME:-artifacts}.tar.gz -P --remove-files || true for log_file in ${log_files}
do
file_name=$(basename ${log_file})
mv ${log_file} ${RELEASE_LOG_DIR}/`echo ${file_name} | sed 's/jenkins.var.log.containers.//g' `
done
remain_log_files=$(find ${LOG_DIR:-/ci-logs/} -type f -name "*${RELEASE_NAME:-milvus-testing}*") tar -zcvf ${ARTIFACTS_NAME:-artifacts}.tar.gz ${RELEASE_LOG_DIR}/*
rm -rf ${RELEASE_LOG_DIR}
remain_log_files=$(find ${LOG_DIR} -type f -name "*${RELEASE_NAME}*")
if [ -z "${remain_log_files:-}" ]; then if [ -z "${remain_log_files:-}" ]; then
echo "No remain log files" echo "No remain log files"
else else
echo "Still have log files & Remove again" echo "Still have log files & Remove again"
find ${LOG_DIR:-/ci-logs/} -type f -name "*${RELEASE_NAME:-milvus-testing}*" -exec rm -rf {} + find ${LOG_DIR} -type f -name "*${RELEASE_NAME}*" -exec rm -rf {} +
echo "Check if any remain log files after using rm to delete again " echo "Check if any remain log files after using rm to delete again "
find ${LOG_DIR:-/ci-logs/} -type f -name "*${RELEASE_NAME:-milvus-testing}*" find ${LOG_DIR} -type f -name "*${RELEASE_NAME}*"
fi fi