From 75c25667b35d524041c5ceb01b2a794e626a472b Mon Sep 17 00:00:00 2001 From: ZhifengZhang-CN Date: Mon, 25 Nov 2019 22:46:52 +0800 Subject: [PATCH] update ci/scripts/update_ccache.sh --- ci/scripts/update_ccache.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ci/scripts/update_ccache.sh b/ci/scripts/update_ccache.sh index 5f167e4e73..c321aee64f 100644 --- a/ci/scripts/update_ccache.sh +++ b/ci/scripts/update_ccache.sh @@ -3,7 +3,7 @@ OS_NAME="linux" CODE_NAME=$(lsb_release -sc) OS_MD5=$(lsb_release -s | md5sum | cut -d " " -f 1) -BRANCH_NAMES=$(git log --decorate | head -n 1 | sed 's/.*(\(.*\))/\1/' | sed 's=[a-zA-Z]*\/==g' | awk -F", " '{$1=""; print $0}') +BRANCH_NAME=$(git log --decorate | head -n 1 | sed 's/.*(\(.*\))/\1/' | sed 's/.* \(.*\),.*/\1/' | sed 's=[a-zA-Z]*\/==g') ARTIFACTORY_URL="" ARTIFACTORY_USER="" ARTIFACTORY_PASSWORD="" @@ -51,5 +51,17 @@ if [[ -z "${ARTIFACTORY_URL}" || "${ARTIFACTORY_URL}" == "" ]];then exit 1 fi -tar zcf ./ccache.tar.gz -C ${HOME}/.ccache . +PACKAGE_FILE="ccache-${OS_NAME}-${CODE_NAME}-${OS_MD5}.tar.gz" +REMOTE_PACKAGE_PATH="${ARTIFACTORY_URL}/${BRANCH_NAME}" +echo "Updating ccache package file: ${PACKAGE_FILE}" +tar zcf ./${PACKAGE_FILE} -C ${HOME}/.ccache . +echo "Uploading ccache package file ${PACKAGE_FILE} to ${REMOTE_PACKAGE_PATH}" +curl -u${ARTIFACTORY_USER}:${ARTIFACTORY_PASSWORD} -T ${PACKAGE_FILE} ${REMOTE_PACKAGE_PATH} +if [[ $? == 0 ]];then + echo "Uploading ccache package file success !" + exit 0 +else + echo "Uploading ccache package file fault !" + exit 1 +fi