extract lib in caching flow
parent
7c0eda570d
commit
fa274bd3ae
|
@ -5690,7 +5690,7 @@ class SharedWorkspaceLocking {
|
|||
}
|
||||
return (yield SharedWorkspaceLocking.ReadLines(`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}${buildParametersContext.cacheKey}/`))
|
||||
.map((x) => x.replace(`/`, ``))
|
||||
.filter((x) => x.includes(`_workspace`));
|
||||
.filter((x) => x.endsWith(`_workspace`));
|
||||
});
|
||||
}
|
||||
static DoesCacheKeyTopLevelExist(buildParametersContext) {
|
||||
|
@ -5706,7 +5706,7 @@ class SharedWorkspaceLocking {
|
|||
}
|
||||
return (yield SharedWorkspaceLocking.ReadLines(`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}${buildParametersContext.cacheKey}/`))
|
||||
.map((x) => x.replace(`/`, ``))
|
||||
.filter((x) => x.includes(`${workspace}_workspace_lock`));
|
||||
.filter((x) => x.endsWith(`${workspace}_workspace_lock`));
|
||||
});
|
||||
}
|
||||
static GetOrCreateLockedWorkspace(workspace, runId, buildParametersContext) {
|
||||
|
@ -5739,7 +5739,7 @@ class SharedWorkspaceLocking {
|
|||
}
|
||||
static DoesWorkspaceExist(workspace, buildParametersContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return ((yield SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext)).filter((x) => x.includes(`${workspace}_workspace`)).length > 0);
|
||||
return ((yield SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext)).filter((x) => x.endsWith(`${workspace}_workspace`)).length > 0);
|
||||
});
|
||||
}
|
||||
static HasWorkspaceLock(workspace, runId, buildParametersContext) {
|
||||
|
@ -5812,7 +5812,7 @@ class SharedWorkspaceLocking {
|
|||
}
|
||||
return (yield SharedWorkspaceLocking.ReadLines(`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}${buildParametersContext.cacheKey}/`))
|
||||
.map((x) => x.replace(`/`, ``))
|
||||
.filter((x) => x.includes(`_${workspace}_workspace`))
|
||||
.filter((x) => x.endsWith(`_${workspace}_workspace`))
|
||||
.map((x) => Number(x))[0];
|
||||
});
|
||||
}
|
||||
|
@ -5823,13 +5823,13 @@ class SharedWorkspaceLocking {
|
|||
}
|
||||
const files = yield SharedWorkspaceLocking.ReadLines(`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}${buildParametersContext.cacheKey}/`);
|
||||
const workspaceFileDoesNotExists = files.filter((x) => {
|
||||
return x.includes(`${workspace}_workspace`);
|
||||
return x.endsWith(`${workspace}_workspace`);
|
||||
}).length === 0;
|
||||
if (workspaceFileDoesNotExists) {
|
||||
throw new Error(`Workspace file doesn't exist`);
|
||||
}
|
||||
const lockFilesExist = files.filter((x) => {
|
||||
return x.includes(`${workspace}_workspace_lock`);
|
||||
return x.endsWith(`${workspace}_workspace_lock`);
|
||||
}).length > 0;
|
||||
return lockFilesExist;
|
||||
});
|
||||
|
@ -5865,7 +5865,7 @@ class SharedWorkspaceLocking {
|
|||
}
|
||||
static ReleaseWorkspace(workspace, runId, buildParametersContext) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const file = (yield SharedWorkspaceLocking.GetAllLocks(workspace, buildParametersContext)).filter((x) => x.includes(`_${runId}_${workspace}_workspace_lock`));
|
||||
const file = (yield SharedWorkspaceLocking.GetAllLocks(workspace, buildParametersContext)).filter((x) => x.endsWith(`_${runId}_${workspace}_workspace_lock`));
|
||||
cloud_runner_logger_1.default.log(`Deleting lock ${workspace}/${file}`);
|
||||
cloud_runner_logger_1.default.log(`rm ${SharedWorkspaceLocking.workspaceRoot}${buildParametersContext.cacheKey}/${file}`);
|
||||
yield cloud_runner_system_1.CloudRunnerSystem.Run(`aws s3 rm ${SharedWorkspaceLocking.workspaceRoot}${buildParametersContext.cacheKey}/${file}`, false, true);
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -22,7 +22,7 @@ export class SharedWorkspaceLocking {
|
|||
)
|
||||
)
|
||||
.map((x) => x.replace(`/`, ``))
|
||||
.filter((x) => x.includes(`_workspace`));
|
||||
.filter((x) => x.endsWith(`_workspace`));
|
||||
}
|
||||
public static async DoesCacheKeyTopLevelExist(buildParametersContext: BuildParameters) {
|
||||
const lines = await SharedWorkspaceLocking.ReadLines(`aws s3 ls ${SharedWorkspaceLocking.workspaceRoot}`);
|
||||
|
@ -40,7 +40,7 @@ export class SharedWorkspaceLocking {
|
|||
)
|
||||
)
|
||||
.map((x) => x.replace(`/`, ``))
|
||||
.filter((x) => x.includes(`${workspace}_workspace_lock`));
|
||||
.filter((x) => x.endsWith(`${workspace}_workspace_lock`));
|
||||
}
|
||||
public static async GetOrCreateLockedWorkspace(
|
||||
workspace: string,
|
||||
|
@ -84,7 +84,7 @@ export class SharedWorkspaceLocking {
|
|||
public static async DoesWorkspaceExist(workspace: string, buildParametersContext: BuildParameters) {
|
||||
return (
|
||||
(await SharedWorkspaceLocking.GetAllWorkspaces(buildParametersContext)).filter((x) =>
|
||||
x.includes(`${workspace}_workspace`),
|
||||
x.endsWith(`${workspace}_workspace`),
|
||||
).length > 0
|
||||
);
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ export class SharedWorkspaceLocking {
|
|||
)
|
||||
)
|
||||
.map((x) => x.replace(`/`, ``))
|
||||
.filter((x) => x.includes(`_${workspace}_workspace`))
|
||||
.filter((x) => x.endsWith(`_${workspace}_workspace`))
|
||||
.map((x) => Number(x))[0];
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ export class SharedWorkspaceLocking {
|
|||
|
||||
const workspaceFileDoesNotExists =
|
||||
files.filter((x) => {
|
||||
return x.includes(`${workspace}_workspace`);
|
||||
return x.endsWith(`${workspace}_workspace`);
|
||||
}).length === 0;
|
||||
|
||||
if (workspaceFileDoesNotExists) {
|
||||
|
@ -202,7 +202,7 @@ export class SharedWorkspaceLocking {
|
|||
|
||||
const lockFilesExist =
|
||||
files.filter((x) => {
|
||||
return x.includes(`${workspace}_workspace_lock`);
|
||||
return x.endsWith(`${workspace}_workspace_lock`);
|
||||
}).length > 0;
|
||||
|
||||
return lockFilesExist;
|
||||
|
@ -262,7 +262,7 @@ export class SharedWorkspaceLocking {
|
|||
buildParametersContext: BuildParameters,
|
||||
): Promise<boolean> {
|
||||
const file = (await SharedWorkspaceLocking.GetAllLocks(workspace, buildParametersContext)).filter((x) =>
|
||||
x.includes(`_${runId}_${workspace}_workspace_lock`),
|
||||
x.endsWith(`_${runId}_${workspace}_workspace_lock`),
|
||||
);
|
||||
CloudRunnerLogger.log(`Deleting lock ${workspace}/${file}`);
|
||||
CloudRunnerLogger.log(`rm ${SharedWorkspaceLocking.workspaceRoot}${buildParametersContext.cacheKey}/${file}`);
|
||||
|
|
Loading…
Reference in New Issue