skip cache push where contents is 0
parent
7dea2c8655
commit
40078f987c
|
|
@ -3859,10 +3859,14 @@ class Caching {
|
||||||
if (cloud_runner_1.default.buildParameters.cloudRunnerIntegrationTests) {
|
if (cloud_runner_1.default.buildParameters.cloudRunnerIntegrationTests) {
|
||||||
cloud_runner_logger_1.default.log(`Hashed cache folder ${yield lfs_hashing_1.LfsHashing.hashAllFiles(sourceFolder)} ${sourceFolder} ${path_1.default.basename(sourceFolder)}`);
|
cloud_runner_logger_1.default.log(`Hashed cache folder ${yield lfs_hashing_1.LfsHashing.hashAllFiles(sourceFolder)} ${sourceFolder} ${path_1.default.basename(sourceFolder)}`);
|
||||||
}
|
}
|
||||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`tar -cf ${cacheArtifactName}.tar.lz4 ${path_1.default.basename(sourceFolder)}`);
|
|
||||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`du ${cacheArtifactName}.tar.lz4`);
|
|
||||||
const contents = yield fs_1.default.promises.readdir(path_1.default.basename(sourceFolder));
|
const contents = yield fs_1.default.promises.readdir(path_1.default.basename(sourceFolder));
|
||||||
cloud_runner_logger_1.default.log(`There is ${contents.length} files/dir in the source folder ${path_1.default.basename(sourceFolder)}`);
|
cloud_runner_logger_1.default.log(`There is ${contents.length} files/dir in the source folder ${path_1.default.basename(sourceFolder)}`);
|
||||||
|
if (contents.length === 0) {
|
||||||
|
process.chdir(`${startPath}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
yield cloud_runner_system_1.CloudRunnerSystem.Run(`tar -cf ${cacheArtifactName}.tar.lz4 ${path_1.default.basename(sourceFolder)}`);
|
||||||
|
yield cloud_runner_system_1.CloudRunnerSystem.Run(`du ${cacheArtifactName}.tar.lz4`);
|
||||||
console_1.assert(yield fileExists(`${cacheArtifactName}.tar.lz4`), 'cache archive exists');
|
console_1.assert(yield fileExists(`${cacheArtifactName}.tar.lz4`), 'cache archive exists');
|
||||||
console_1.assert(yield fileExists(path_1.default.basename(sourceFolder)), 'source folder exists');
|
console_1.assert(yield fileExists(path_1.default.basename(sourceFolder)), 'source folder exists');
|
||||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`mv ${cacheArtifactName}.tar.lz4 ${cacheFolder}`);
|
yield cloud_runner_system_1.CloudRunnerSystem.Run(`mv ${cacheArtifactName}.tar.lz4 ${cacheFolder}`);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -59,12 +59,19 @@ export class Caching {
|
||||||
)}`,
|
)}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await CloudRunnerSystem.Run(`tar -cf ${cacheArtifactName}.tar.lz4 ${path.basename(sourceFolder)}`);
|
|
||||||
await CloudRunnerSystem.Run(`du ${cacheArtifactName}.tar.lz4`);
|
|
||||||
const contents = await fs.promises.readdir(path.basename(sourceFolder));
|
const contents = await fs.promises.readdir(path.basename(sourceFolder));
|
||||||
CloudRunnerLogger.log(
|
CloudRunnerLogger.log(
|
||||||
`There is ${contents.length} files/dir in the source folder ${path.basename(sourceFolder)}`,
|
`There is ${contents.length} files/dir in the source folder ${path.basename(sourceFolder)}`,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (contents.length === 0) {
|
||||||
|
process.chdir(`${startPath}`);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await CloudRunnerSystem.Run(`tar -cf ${cacheArtifactName}.tar.lz4 ${path.basename(sourceFolder)}`);
|
||||||
|
await CloudRunnerSystem.Run(`du ${cacheArtifactName}.tar.lz4`);
|
||||||
assert(await fileExists(`${cacheArtifactName}.tar.lz4`), 'cache archive exists');
|
assert(await fileExists(`${cacheArtifactName}.tar.lz4`), 'cache archive exists');
|
||||||
assert(await fileExists(path.basename(sourceFolder)), 'source folder exists');
|
assert(await fileExists(path.basename(sourceFolder)), 'source folder exists');
|
||||||
await CloudRunnerSystem.Run(`mv ${cacheArtifactName}.tar.lz4 ${cacheFolder}`);
|
await CloudRunnerSystem.Run(`mv ${cacheArtifactName}.tar.lz4 ${cacheFolder}`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue