resolve all relative paths
parent
55d1ee1743
commit
379ee4fcb4
|
|
@ -588,26 +588,27 @@ class Caching {
|
||||||
const cacheSelection = cacheKey !== `` && fs_1.default.existsSync(`${cacheKey}.zip`) ? cacheKey : latestInBranch;
|
const cacheSelection = cacheKey !== `` && fs_1.default.existsSync(`${cacheKey}.zip`) ? cacheKey : latestInBranch;
|
||||||
yield cloud_runner_logger_1.default.log(`cache key ${cacheKey} selection ${cacheSelection}`);
|
yield cloud_runner_logger_1.default.log(`cache key ${cacheKey} selection ${cacheSelection}`);
|
||||||
if (fs_1.default.existsSync(`${cacheSelection}.zip`)) {
|
if (fs_1.default.existsSync(`${cacheSelection}.zip`)) {
|
||||||
const resultsDirectory = `results${cloud_runner_state_1.CloudRunnerState.buildParams.buildGuid}`;
|
const resultsFolder = `results${cloud_runner_state_1.CloudRunnerState.buildParams.buildGuid}`;
|
||||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`mkdir -p ${resultsDirectory}`);
|
yield cloud_runner_system_1.CloudRunnerSystem.Run(`mkdir -p ${resultsFolder}`);
|
||||||
if (__1.Input.cloudRunnerTests) {
|
if (__1.Input.cloudRunnerTests) {
|
||||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`tree ${destinationFolder}`);
|
yield cloud_runner_system_1.CloudRunnerSystem.Run(`tree ${destinationFolder}`);
|
||||||
}
|
}
|
||||||
remote_client_logger_1.RemoteClientLogger.log(`cache item exists ${cacheFolder}/${cacheSelection}.zip`);
|
remote_client_logger_1.RemoteClientLogger.log(`cache item exists ${cacheFolder}/${cacheSelection}.zip`);
|
||||||
console_1.assert(`${fs_1.default.existsSync(destinationFolder)}`);
|
console_1.assert(`${fs_1.default.existsSync(destinationFolder)}`);
|
||||||
console_1.assert(`${fs_1.default.existsSync(`${cacheSelection}.zip`)}`);
|
console_1.assert(`${fs_1.default.existsSync(`${cacheSelection}.zip`)}`);
|
||||||
const fullDestination = path_1.default.join(cacheFolder, resultsDirectory);
|
const fullDestination = path_1.default.join(cacheFolder, resultsFolder);
|
||||||
if (__1.Input.cloudRunnerTests) {
|
if (__1.Input.cloudRunnerTests) {
|
||||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`tree ${cacheFolder}`);
|
yield cloud_runner_system_1.CloudRunnerSystem.Run(`tree ${cacheFolder}`);
|
||||||
}
|
}
|
||||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`unzip ${cacheSelection}.zip -d ${path_1.default.basename(resultsDirectory)}`);
|
yield cloud_runner_system_1.CloudRunnerSystem.Run(`unzip ${cacheSelection}.zip -d ${path_1.default.basename(resultsFolder)}`);
|
||||||
remote_client_logger_1.RemoteClientLogger.log(`cache item extracted to ${fullDestination}`);
|
remote_client_logger_1.RemoteClientLogger.log(`cache item extracted to ${fullDestination}`);
|
||||||
console_1.assert(`${fs_1.default.existsSync(fullDestination)}`);
|
console_1.assert(`${fs_1.default.existsSync(fullDestination)}`);
|
||||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`mv "${fullDestination}" "${destinationFolder}/.."`);
|
const destinationParentFolder = path_1.default.resolve(destinationFolder, '..');
|
||||||
|
yield cloud_runner_system_1.CloudRunnerSystem.Run(`mv "${fullDestination}" "${destinationParentFolder}"`);
|
||||||
if (fs_1.default.existsSync(destinationFolder)) {
|
if (fs_1.default.existsSync(destinationFolder)) {
|
||||||
fs_1.default.rmSync(destinationFolder, { recursive: true, force: true });
|
fs_1.default.rmSync(destinationFolder, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
fs_1.default.renameSync(`${destinationFolder}/../${resultsDirectory}`, destinationFolder);
|
fs_1.default.renameSync(path_1.default.resolve(destinationParentFolder, resultsFolder), destinationFolder);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
remote_client_logger_1.RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`);
|
remote_client_logger_1.RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`);
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -62,26 +62,27 @@ export class Caching {
|
||||||
await CloudRunnerLogger.log(`cache key ${cacheKey} selection ${cacheSelection}`);
|
await CloudRunnerLogger.log(`cache key ${cacheKey} selection ${cacheSelection}`);
|
||||||
|
|
||||||
if (fs.existsSync(`${cacheSelection}.zip`)) {
|
if (fs.existsSync(`${cacheSelection}.zip`)) {
|
||||||
const resultsDirectory = `results${CloudRunnerState.buildParams.buildGuid}`;
|
const resultsFolder = `results${CloudRunnerState.buildParams.buildGuid}`;
|
||||||
await CloudRunnerSystem.Run(`mkdir -p ${resultsDirectory}`);
|
await CloudRunnerSystem.Run(`mkdir -p ${resultsFolder}`);
|
||||||
if (Input.cloudRunnerTests) {
|
if (Input.cloudRunnerTests) {
|
||||||
await CloudRunnerSystem.Run(`tree ${destinationFolder}`);
|
await CloudRunnerSystem.Run(`tree ${destinationFolder}`);
|
||||||
}
|
}
|
||||||
RemoteClientLogger.log(`cache item exists ${cacheFolder}/${cacheSelection}.zip`);
|
RemoteClientLogger.log(`cache item exists ${cacheFolder}/${cacheSelection}.zip`);
|
||||||
assert(`${fs.existsSync(destinationFolder)}`);
|
assert(`${fs.existsSync(destinationFolder)}`);
|
||||||
assert(`${fs.existsSync(`${cacheSelection}.zip`)}`);
|
assert(`${fs.existsSync(`${cacheSelection}.zip`)}`);
|
||||||
const fullDestination = path.join(cacheFolder, resultsDirectory);
|
const fullDestination = path.join(cacheFolder, resultsFolder);
|
||||||
if (Input.cloudRunnerTests) {
|
if (Input.cloudRunnerTests) {
|
||||||
await CloudRunnerSystem.Run(`tree ${cacheFolder}`);
|
await CloudRunnerSystem.Run(`tree ${cacheFolder}`);
|
||||||
}
|
}
|
||||||
await CloudRunnerSystem.Run(`unzip ${cacheSelection}.zip -d ${path.basename(resultsDirectory)}`);
|
await CloudRunnerSystem.Run(`unzip ${cacheSelection}.zip -d ${path.basename(resultsFolder)}`);
|
||||||
RemoteClientLogger.log(`cache item extracted to ${fullDestination}`);
|
RemoteClientLogger.log(`cache item extracted to ${fullDestination}`);
|
||||||
assert(`${fs.existsSync(fullDestination)}`);
|
assert(`${fs.existsSync(fullDestination)}`);
|
||||||
await CloudRunnerSystem.Run(`mv "${fullDestination}" "${destinationFolder}/.."`);
|
const destinationParentFolder = path.resolve(destinationFolder, '..');
|
||||||
|
await CloudRunnerSystem.Run(`mv "${fullDestination}" "${destinationParentFolder}"`);
|
||||||
if (fs.existsSync(destinationFolder)) {
|
if (fs.existsSync(destinationFolder)) {
|
||||||
fs.rmSync(destinationFolder, { recursive: true, force: true });
|
fs.rmSync(destinationFolder, { recursive: true, force: true });
|
||||||
}
|
}
|
||||||
fs.renameSync(`${destinationFolder}/../${resultsDirectory}`, destinationFolder);
|
fs.renameSync(path.resolve(destinationParentFolder, resultsFolder), destinationFolder);
|
||||||
} else {
|
} else {
|
||||||
RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`);
|
RemoteClientLogger.logWarning(`cache item ${cacheKey} doesn't exist ${destinationFolder}`);
|
||||||
if (cacheSelection !== ``) {
|
if (cacheSelection !== ``) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue