diff --git a/ci/scripts/update_ccache.sh b/ci/scripts/update_ccache.sh index 5f167e4e733a8b1b45eb9deb2632f28e08b55940..c321aee64f34684244426f64877877062ddc1e4c 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