use CheckpointOptions where possible
Signed-off-by: Kurt King <kurtaking@gmail.com>
This commit is contained in:
@@ -50,6 +50,7 @@ import {
|
||||
import { createConditionAuthorizer } from '@backstage/plugin-permission-node';
|
||||
import { actionExecutePermission } from '@backstage/plugin-scaffolder-common/alpha';
|
||||
import {
|
||||
CheckpointOptions,
|
||||
TaskContext,
|
||||
TemplateAction,
|
||||
TemplateFilter,
|
||||
@@ -375,10 +376,9 @@ export class NunjucksWorkflowRunner implements WorkflowRunner {
|
||||
secrets: task.secrets ?? {},
|
||||
logger: taskLogger,
|
||||
workspacePath,
|
||||
async checkpoint<T extends JsonValue | void>(opts: {
|
||||
key?: string;
|
||||
fn: () => Promise<T> | T;
|
||||
}) {
|
||||
async checkpoint<T extends JsonValue | void>(
|
||||
opts: CheckpointOptions<T>,
|
||||
) {
|
||||
const { key: checkpointKey, fn } = opts;
|
||||
const key = `v1.task.checkpoint.${step.id}.${checkpointKey}`;
|
||||
|
||||
|
||||
@@ -21,7 +21,10 @@ import {
|
||||
mockServices,
|
||||
} from '@backstage/backend-test-utils';
|
||||
import { JsonObject, JsonValue } from '@backstage/types';
|
||||
import { ActionContext } from '@backstage/plugin-scaffolder-node';
|
||||
import {
|
||||
ActionContext,
|
||||
CheckpointOptions,
|
||||
} from '@backstage/plugin-scaffolder-node';
|
||||
import { loggerToWinstonLogger } from './loggerToWinstonLogger';
|
||||
|
||||
/**
|
||||
@@ -44,10 +47,9 @@ export function createMockActionContext<
|
||||
output: jest.fn(),
|
||||
createTemporaryDirectory: jest.fn(),
|
||||
input: {} as TActionInput,
|
||||
async checkpoint<T extends JsonValue | void>(opts: {
|
||||
key: string;
|
||||
fn: () => Promise<T> | T;
|
||||
}): Promise<T> {
|
||||
async checkpoint<T extends JsonValue | void>(
|
||||
opts: CheckpointOptions<T>,
|
||||
): Promise<T> {
|
||||
return opts.fn();
|
||||
},
|
||||
getInitiatorCredentials: () => Promise.resolve(credentials),
|
||||
|
||||
Reference in New Issue
Block a user