Remove shell scripts in favour of internal cli calls to remote-cli

pull/310/head
Frostebite 2021-12-24 00:49:52 +00:00
parent bedaf1f580
commit c21ae5d424
5 changed files with 141 additions and 103 deletions

View File

@ -1,87 +0,0 @@
#!/bin/sh
cacheFolderFull=$1
libraryFolderFull=$2
gitLFSDestinationFolder=$3
purgeCloudRunnerCache=$4
cacheFolderWithBranch="$cacheFolderFull"
lfsCacheFolder="$cacheFolderFull/lfs"
libraryCacheFolder="$cacheFolderFull/lib"
mkdir -p "$lfsCacheFolder"
mkdir -p "$libraryCacheFolder"
echo 'Library Caching'
# if the unity git project has included the library delete it and echo a warning
if [ -d "$libraryFolderFull" ]; then
rm -r "$libraryFolderFull"
echo "!Warning!: The Unity library was included in the git repository (this isn't usually a good practice)"
fi
# Restore library cache
ls -lh "$libraryCacheFolder"
latestLibraryCacheFile=$(ls -t "$libraryCacheFolder" | grep .zip$ | head -1)
echo "Checking if Library cache $libraryCacheFolder/$latestLibraryCacheFile exists"
cd $libraryCacheFolder
if [ -f "$latestLibraryCacheFile" ]; then
echo "Library cache exists"
unzip -q "$libraryCacheFolder/$latestLibraryCacheFile" -d "$projectPathFull"
tree "$libraryFolderFull"
fi
echo ' '
echo 'Large File Caching'
echo "Checking large file cache exists ($lfsCacheFolder/$LFS_ASSETS_HASH.zip)"
cd $lfsCacheFolder
if [ -f "$LFS_ASSETS_HASH.zip" ]; then
echo "Match found: using large file hash match $LFS_ASSETS_HASH.zip"
latestLFSCacheFile="$LFS_ASSETS_HASH"
else
latestLFSCacheFile=$(ls -t "$lfsCacheFolder" | grep .zip$ | head -1)
echo "Match not found: using latest large file cache $latestLFSCacheFile"
fi
if [ ! -f "$latestLFSCacheFile" ]; then
echo "LFS cache exists from build $latestLFSCacheFile from $branch"
rm -r "$gitLFSDestinationFolder"
unzip -q "$lfsCacheFolder/$latestLFSCacheFile" -d "$repoPathFull/.git"
echo "git LFS folder, (should not contain $latestLFSCacheFile)"
ls -lh "$gitLFSDestinationFolder/"
fi
echo ' '
echo "LFS cache for $branch"
du -sch "$lfsCacheFolder/"
echo '**'
echo "Library cache for $branch"
du -sch "$libraryCacheFolder/"
echo '**'
echo "Branch: $branch"
du -sch "$cacheFolderWithBranch/"
echo '**'
echo 'Full cache'
du -sch "$cacheFolderFull/"
echo ' '
cd "$repoPathFull"
git lfs pull
echo 'pulled latest LFS files'
cd "$gitLFSDestinationFolder/.."
zip -q -r "$LFS_ASSETS_HASH.zip" "./lfs"
cp "$LFS_ASSETS_HASH.zip" "$lfsCacheFolder"
echo "copied $LFS_ASSETS_HASH to $lfsCacheFolder"
# purge cache
if [ -z "$purgeCloudRunnerCache" ]; then
echo ' '
echo "purging $purgeCloudRunnerCache"
rm -r "$purgeCloudRunnerCache"
echo ' '
fi

View File

@ -1,13 +0,0 @@
echo ' '
echo "LFS cache for $branch"
du -sch "$lfsCacheFolder"
echo ' '
echo "Library cache for $branch"
du -sch "$libraryCacheFolder"
echo ' '
echo "Branch: $branch"
du -sch "$cacheFolderWithBranch"
echo ' '
echo 'Full cache'
du -sch "$cacheFolderFull"
echo ' '

71
dist/index.js vendored
View File

@ -2051,7 +2051,76 @@ class DownloadRepository {
yield run_cli_1.RunCli.RunCli(`
tree ${cloud_runner_state_1.CloudRunnerState.builderPathFull}
echo 'Starting checks of cache for the Unity project Library and git LFS files'
${cloud_runner_state_1.CloudRunnerState.getHandleCachingCommand}
cacheFolderFull=${cloud_runner_state_1.CloudRunnerState.cacheFolderFull}
libraryFolderFull=${cloud_runner_state_1.CloudRunnerState.libraryFolderFull}
gitLFSDestinationFolder=${cloud_runner_state_1.CloudRunnerState.lfsDirectory}
purgeCloudRunnerCache=${cloud_runner_state_1.CloudRunnerState.purgeRemoteCaching}
cacheFolderWithBranch="$cacheFolderFull"
lfsCacheFolder="$cacheFolderFull/lfs"
libraryCacheFolder="$cacheFolderFull/lib"
mkdir -p "$lfsCacheFolder"
mkdir -p "$libraryCacheFolder"
echo 'Library Caching'
# if the unity git project has included the library delete it and echo a warning
if [ -d "$libraryFolderFull" ]; then
rm -r "$libraryFolderFull"
echo "!Warning!: The Unity library was included in the git repository (this isn't usually a good practice)"
fi
# Restore library cache
ls -lh "$libraryCacheFolder"
latestLibraryCacheFile=$(ls -t "$libraryCacheFolder" | grep .zip$ | head -1)
echo "Checking if Library cache $libraryCacheFolder/$latestLibraryCacheFile exists"
cd $libraryCacheFolder
if [ -f "$latestLibraryCacheFile" ]; then
echo "Library cache exists"
unzip -q "$libraryCacheFolder/$latestLibraryCacheFile" -d "$projectPathFull"
tree "$libraryFolderFull"
fi
echo ' '
echo 'Large File Caching'
echo "Checking large file cache exists ($lfsCacheFolder/$LFS_ASSETS_HASH.zip)"
cd $lfsCacheFolder
if [ -f "$LFS_ASSETS_HASH.zip" ]; then
echo "Match found: using large file hash match $LFS_ASSETS_HASH.zip"
latestLFSCacheFile="$LFS_ASSETS_HASH"
else
latestLFSCacheFile=$(ls -t "$lfsCacheFolder" | grep .zip$ | head -1)
echo "Match not found: using latest large file cache $latestLFSCacheFile"
fi
if [ ! -f "$latestLFSCacheFile" ]; then
echo "LFS cache exists from build $latestLFSCacheFile from $branch"
rm -r "$gitLFSDestinationFolder"
unzip -q "$lfsCacheFolder/$latestLFSCacheFile" -d "$repoPathFull/.git"
echo "git LFS folder, (should not contain $latestLFSCacheFile)"
ls -lh "$gitLFSDestinationFolder/"
fi
echo ' '
echo "LFS cache for $branch"
du -sch "$lfsCacheFolder/"
echo '**'
echo "Library cache for $branch"
du -sch "$libraryCacheFolder/"
echo '**'
echo "Branch: $branch"
du -sch "$cacheFolderWithBranch/"
echo '**'
echo 'Full cache'
du -sch "$cacheFolderFull/"
echo ' '
cd "$repoPathFull"
git lfs pull
echo 'pulled latest LFS files'
cd "$gitLFSDestinationFolder/.."
zip -q -r "$LFS_ASSETS_HASH.zip" "./lfs"
cp "$LFS_ASSETS_HASH.zip" "$lfsCacheFolder"
echo "copied $LFS_ASSETS_HASH to $lfsCacheFolder"
# purge cache
if [ -z "$purgeCloudRunnerCache" ]; then
echo ' '
echo "purging $purgeCloudRunnerCache"
rm -r "$purgeCloudRunnerCache"
echo ' '
fi
`);
});
}

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -46,7 +46,76 @@ export class DownloadRepository {
await RunCli.RunCli(`
tree ${CloudRunnerState.builderPathFull}
echo 'Starting checks of cache for the Unity project Library and git LFS files'
${CloudRunnerState.getHandleCachingCommand}
cacheFolderFull=${CloudRunnerState.cacheFolderFull}
libraryFolderFull=${CloudRunnerState.libraryFolderFull}
gitLFSDestinationFolder=${CloudRunnerState.lfsDirectory}
purgeCloudRunnerCache=${CloudRunnerState.purgeRemoteCaching}
cacheFolderWithBranch="$cacheFolderFull"
lfsCacheFolder="$cacheFolderFull/lfs"
libraryCacheFolder="$cacheFolderFull/lib"
mkdir -p "$lfsCacheFolder"
mkdir -p "$libraryCacheFolder"
echo 'Library Caching'
# if the unity git project has included the library delete it and echo a warning
if [ -d "$libraryFolderFull" ]; then
rm -r "$libraryFolderFull"
echo "!Warning!: The Unity library was included in the git repository (this isn't usually a good practice)"
fi
# Restore library cache
ls -lh "$libraryCacheFolder"
latestLibraryCacheFile=$(ls -t "$libraryCacheFolder" | grep .zip$ | head -1)
echo "Checking if Library cache $libraryCacheFolder/$latestLibraryCacheFile exists"
cd $libraryCacheFolder
if [ -f "$latestLibraryCacheFile" ]; then
echo "Library cache exists"
unzip -q "$libraryCacheFolder/$latestLibraryCacheFile" -d "$projectPathFull"
tree "$libraryFolderFull"
fi
echo ' '
echo 'Large File Caching'
echo "Checking large file cache exists ($lfsCacheFolder/$LFS_ASSETS_HASH.zip)"
cd $lfsCacheFolder
if [ -f "$LFS_ASSETS_HASH.zip" ]; then
echo "Match found: using large file hash match $LFS_ASSETS_HASH.zip"
latestLFSCacheFile="$LFS_ASSETS_HASH"
else
latestLFSCacheFile=$(ls -t "$lfsCacheFolder" | grep .zip$ | head -1)
echo "Match not found: using latest large file cache $latestLFSCacheFile"
fi
if [ ! -f "$latestLFSCacheFile" ]; then
echo "LFS cache exists from build $latestLFSCacheFile from $branch"
rm -r "$gitLFSDestinationFolder"
unzip -q "$lfsCacheFolder/$latestLFSCacheFile" -d "$repoPathFull/.git"
echo "git LFS folder, (should not contain $latestLFSCacheFile)"
ls -lh "$gitLFSDestinationFolder/"
fi
echo ' '
echo "LFS cache for $branch"
du -sch "$lfsCacheFolder/"
echo '**'
echo "Library cache for $branch"
du -sch "$libraryCacheFolder/"
echo '**'
echo "Branch: $branch"
du -sch "$cacheFolderWithBranch/"
echo '**'
echo 'Full cache'
du -sch "$cacheFolderFull/"
echo ' '
cd "$repoPathFull"
git lfs pull
echo 'pulled latest LFS files'
cd "$gitLFSDestinationFolder/.."
zip -q -r "$LFS_ASSETS_HASH.zip" "./lfs"
cp "$LFS_ASSETS_HASH.zip" "$lfsCacheFolder"
echo "copied $LFS_ASSETS_HASH to $lfsCacheFolder"
# purge cache
if [ -z "$purgeCloudRunnerCache" ]; then
echo ' '
echo "purging $purgeCloudRunnerCache"
rm -r "$purgeCloudRunnerCache"
echo ' '
fi
`);
}
}