Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit ebc2ba7

Browse files
committed
Copy target directory using reflinks.
This allows keeping both directories until the deploy is completed, while keeping the fast nature of moving things around. Signed-off-by: David Calavera <david.calavera@gmail.com>
1 parent 4dbcb17 commit ebc2ba7

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

run-build-functions.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ cache_artifacts() {
678678

679679
if [ -f Cargo.toml ] || [ -f Cargo.lock ]
680680
then
681-
cache_cwd_directory "target" "rust compile output"
681+
cache_cwd_directory_fast_copy "target" "rust compile output"
682682
fi
683683

684684
cache_home_directory ".yarn_cache" "yarn cache"
@@ -756,6 +756,17 @@ move_cache() {
756756
fi
757757
}
758758

759+
fast_copy_cache() {
760+
local src=$1
761+
local dst=$2
762+
if [ -d $src ]
763+
then
764+
echo "Started $3"
765+
cp --reflink=always $src $dst
766+
echo "Finished $3"
767+
fi
768+
}
769+
759770
restore_home_cache() {
760771
move_cache "$NETLIFY_CACHE_DIR/$1" "$HOME/$1" "restoring cached $2"
761772
}
@@ -772,6 +783,10 @@ cache_cwd_directory() {
772783
move_cache "$PWD/$1" "$NETLIFY_CACHE_DIR/$1" "saving $2"
773784
}
774785

786+
cache_cwd_directory_fast_copy() {
787+
fast_copy_cache "$PWD/$1" "$NETLIFY_CACHE_DIR/$1" "saving $2"
788+
}
789+
775790
install_missing_commands() {
776791
if [[ $BUILD_COMMAND_PARSER == *"grunt"* ]]
777792
then

0 commit comments

Comments
 (0)