Signed-off-by: bnechyporenko <bnechyporenko@bol.com>
This commit is contained in:
bnechyporenko
2024-02-10 14:34:14 +01:00
parent 491fba45df
commit 2b900fee6d
9 changed files with 274 additions and 101 deletions
+36 -17
View File
@@ -64,19 +64,6 @@ export function addFiles(options: {
logger?: Logger | undefined;
}): Promise<void>;
// @public
export type CheckpointRecord =
| {
key: string;
status: 'success';
value: JsonValue;
}
| {
key: string;
status: 'failed';
reason: string;
};
// @public (undocumented)
export function cloneRepo(options: {
url: string;
@@ -362,9 +349,19 @@ export interface TaskContext {
// (undocumented)
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
// (undocumented)
getCheckpoints?(): Promise<
getTaskState?(): Promise<
| {
state: TaskState;
state: {
[key: string]:
| {
status: 'failed';
reason: string;
}
| {
status: 'success';
value: JsonValue;
};
};
}
| undefined
>;
@@ -377,9 +374,31 @@ export interface TaskContext {
// (undocumented)
spec: TaskSpec;
// (undocumented)
state?: TaskState;
state?: {
[key: string]:
| {
status: 'failed';
reason: string;
}
| {
status: 'success';
value: JsonValue;
};
};
// (undocumented)
updateCheckpoint?(options: CheckpointRecord): Promise<void>;
updateCheckpoint?(
options:
| {
key: string;
status: 'success';
value: JsonValue;
}
| {
key: string;
status: 'failed';
reason: string;
},
): Promise<void>;
}
// @public
@@ -26,5 +26,4 @@ export type {
TaskEventType,
TaskState,
TaskStatus,
CheckpointRecord,
} from './types';
+34 -21
View File
@@ -26,24 +26,6 @@ export type TaskSecrets = Record<string, string> & {
backstageToken?: string;
};
/**
* The record passed to TaskBroker for updating a checkpoint.
* Parameters to store the result of the executed checkpoint
*
* @public
*/
export type CheckpointRecord =
| {
key: string;
status: 'success';
value: JsonValue;
}
| {
key: string;
status: 'failed';
reason: string;
};
/**
* The state of all task's checkpoints
*
@@ -142,7 +124,14 @@ export interface TaskContext {
cancelSignal: AbortSignal;
spec: TaskSpec;
secrets?: TaskSecrets;
state?: TaskState;
state?: {
[key: string]:
| { status: 'failed'; reason: string }
| {
status: 'success';
value: JsonValue;
};
};
createdBy?: string;
done: boolean;
isDryRun?: boolean;
@@ -151,9 +140,33 @@ export interface TaskContext {
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
getCheckpoints?(): Promise<{ state: TaskState } | undefined>;
getTaskState?(): Promise<
| {
state: {
[key: string]:
| { status: 'failed'; reason: string }
| {
status: 'success';
value: JsonValue;
};
};
}
| undefined
>;
updateCheckpoint?(options: CheckpointRecord): Promise<void>;
updateCheckpoint?(
options:
| {
key: string;
status: 'success';
value: JsonValue;
}
| {
key: string;
status: 'failed';
reason: string;
},
): Promise<void>;
getWorkspaceName(): Promise<string>;
}