@@ -30,6 +30,10 @@ export type ActionContext<
|
||||
secrets?: TaskSecrets;
|
||||
workspacePath: string;
|
||||
input: TActionInput;
|
||||
checkpoint?<U extends JsonValue>(
|
||||
key: string,
|
||||
fn: () => Promise<U>,
|
||||
): Promise<U>;
|
||||
output(
|
||||
name: keyof TActionOutput,
|
||||
value: TActionOutput[keyof TActionOutput],
|
||||
@@ -60,6 +64,19 @@ 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;
|
||||
@@ -345,6 +362,13 @@ export interface TaskContext {
|
||||
// (undocumented)
|
||||
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
|
||||
// (undocumented)
|
||||
getCheckpoints?(): Promise<
|
||||
| {
|
||||
state: TaskState;
|
||||
}
|
||||
| undefined
|
||||
>;
|
||||
// (undocumented)
|
||||
getWorkspaceName(): Promise<string>;
|
||||
// (undocumented)
|
||||
isDryRun?: boolean;
|
||||
@@ -352,6 +376,10 @@ export interface TaskContext {
|
||||
secrets?: TaskSecrets;
|
||||
// (undocumented)
|
||||
spec: TaskSpec;
|
||||
// (undocumented)
|
||||
state?: TaskState;
|
||||
// (undocumented)
|
||||
updateCheckpoint?(options: CheckpointRecord): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -362,6 +390,19 @@ export type TaskSecrets = Record<string, string> & {
|
||||
backstageToken?: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
export type TaskState = {
|
||||
[key: string]:
|
||||
| {
|
||||
status: 'failed';
|
||||
reason: string;
|
||||
}
|
||||
| {
|
||||
status: 'success';
|
||||
value: JsonValue;
|
||||
};
|
||||
};
|
||||
|
||||
// @public
|
||||
export type TaskStatus =
|
||||
| 'cancelled'
|
||||
|
||||
@@ -35,7 +35,7 @@ export type ActionContext<
|
||||
secrets?: TaskSecrets;
|
||||
workspacePath: string;
|
||||
input: TActionInput;
|
||||
checkpoint<U extends JsonValue>(
|
||||
checkpoint?<U extends JsonValue>(
|
||||
key: string,
|
||||
fn: () => Promise<U>,
|
||||
): Promise<U>;
|
||||
|
||||
@@ -27,7 +27,7 @@ export type TaskSecrets = Record<string, string> & {
|
||||
};
|
||||
|
||||
/**
|
||||
* The record passed to {@link TaskBroker.updateCheckpoint?}
|
||||
* The record passed to TaskBroker for updating a checkpoint.
|
||||
* Parameters to store the result of the executed checkpoint
|
||||
*
|
||||
* @public
|
||||
@@ -45,7 +45,7 @@ export type CheckpointRecord =
|
||||
};
|
||||
|
||||
/**
|
||||
* TaskState
|
||||
* The state of all task's checkpoints
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user