Skip to content

Commit

Permalink
fix #72 ignore corrupted save-cache (#73)
Browse files Browse the repository at this point in the history
Co-authored-by: Eshed Gal-Or <eshed.gal-or@salto.io>
  • Loading branch information
eshedg and eshedg-salto committed May 25, 2024
1 parent 21ca1b4 commit bb703b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/backends/s3.bash
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ function restore() {
# Check if prefere local is true and if tar file exists in tmp dir
if [ "${BK_CACHE_SAVE_CACHE}" == "true" ] && [ -f "${BK_CACHE_LOCAL_PATH}/${TAR_FILE}" ]; then
echo -e "${BK_LOG_PREFIX}:file_cabinet: Using previously downloaded file ${BK_CACHE_LOCAL_PATH}/${TAR_FILE} since local is prefered."
tar ${BK_TAR_EXTRACT_ARGS} "${BK_CACHE_LOCAL_PATH}/${TAR_FILE}" -C .
return
if tar ${BK_TAR_EXTRACT_ARGS} "${BK_CACHE_LOCAL_PATH}/${TAR_FILE}" -C . ; then
return
fi
echo -e "${BK_LOG_PREFIX}:file_cabinet: Ignoring corrupted previously downloaded file ${BK_CACHE_LOCAL_PATH}/${TAR_FILE}."
fi

aws s3api head-object --bucket "${BUILDKITE_PLUGIN_CACHE_S3_BUCKET}" --key "${TKEY}/${TAR_FILE}" ${BK_DEFAULT_AWS_ARGS} || no_head=true
Expand Down

0 comments on commit bb703b7

Please sign in to comment.