chore: move to private method over gettter
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -572,8 +572,6 @@ export class TaskManager implements TaskContext_2 {
|
||||
// (undocumented)
|
||||
getWorkspaceName(): Promise<string>;
|
||||
// (undocumented)
|
||||
get isWorkspaceSerializationEnabled(): boolean;
|
||||
// (undocumented)
|
||||
rehydrateWorkspace?(options: {
|
||||
taskId: string;
|
||||
targetPath: string;
|
||||
|
||||
@@ -88,14 +88,6 @@ export class TaskManager implements TaskContext {
|
||||
private readonly config?: Config,
|
||||
) {}
|
||||
|
||||
get isWorkspaceSerializationEnabled(): boolean {
|
||||
return (
|
||||
this.config?.getOptionalBoolean(
|
||||
'scaffolder.EXPERIMENTAL_workspaceSerialization',
|
||||
) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
get spec() {
|
||||
return this.task.spec;
|
||||
}
|
||||
@@ -120,7 +112,7 @@ export class TaskManager implements TaskContext {
|
||||
taskId: string;
|
||||
targetPath: string;
|
||||
}): Promise<void> {
|
||||
if (this.isWorkspaceSerializationEnabled) {
|
||||
if (this.isWorkspaceSerializationEnabled()) {
|
||||
this.storage.rehydrateWorkspace?.(options);
|
||||
}
|
||||
}
|
||||
@@ -171,7 +163,7 @@ export class TaskManager implements TaskContext {
|
||||
}
|
||||
|
||||
async serializeWorkspace?(options: { path: string }): Promise<void> {
|
||||
if (this.isWorkspaceSerializationEnabled) {
|
||||
if (this.isWorkspaceSerializationEnabled()) {
|
||||
await this.storage.serializeWorkspace?.({
|
||||
path: options.path,
|
||||
taskId: this.task.taskId,
|
||||
@@ -180,7 +172,7 @@ export class TaskManager implements TaskContext {
|
||||
}
|
||||
|
||||
async cleanWorkspace?(): Promise<void> {
|
||||
if (this.isWorkspaceSerializationEnabled) {
|
||||
if (this.isWorkspaceSerializationEnabled()) {
|
||||
await this.storage.cleanWorkspace?.({ taskId: this.task.taskId });
|
||||
}
|
||||
}
|
||||
@@ -219,6 +211,14 @@ export class TaskManager implements TaskContext {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
private isWorkspaceSerializationEnabled(): boolean {
|
||||
return (
|
||||
this.config?.getOptionalBoolean(
|
||||
'scaffolder.EXPERIMENTAL_workspaceSerialization',
|
||||
) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
async getInitiatorCredentials(): Promise<BackstageCredentials> {
|
||||
const secrets = this.task.secrets as InternalTaskSecrets;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user