diff --git a/.changeset/thirty-bikes-stare.md b/.changeset/thirty-bikes-stare.md new file mode 100644 index 0000000000..d8249299a7 --- /dev/null +++ b/.changeset/thirty-bikes-stare.md @@ -0,0 +1,7 @@ +--- +'@backstage/plugin-scaffolder-node-test-utils': patch +'@backstage/plugin-scaffolder-backend': patch +'@backstage/plugin-scaffolder-node': patch +--- + +Made "checkpoint" on scaffolder action context non-optional diff --git a/plugins/scaffolder-backend/src/scaffolder/tasks/NunjucksWorkflowRunner.test.ts b/plugins/scaffolder-backend/src/scaffolder/tasks/NunjucksWorkflowRunner.test.ts index 420ec69427..f5bbee2831 100644 --- a/plugins/scaffolder-backend/src/scaffolder/tasks/NunjucksWorkflowRunner.test.ts +++ b/plugins/scaffolder-backend/src/scaffolder/tasks/NunjucksWorkflowRunner.test.ts @@ -138,13 +138,13 @@ describe('NunjucksWorkflowRunner', () => { id: 'checkpoints-action', description: 'Mock action with checkpoints', handler: async ctx => { - const key1 = await ctx.checkpoint?.('key1', async () => { + const key1 = await ctx.checkpoint('key1', async () => { return 'updated'; }); - const key2 = await ctx.checkpoint?.('key2', async () => { + const key2 = await ctx.checkpoint('key2', async () => { return 'updated'; }); - const key3 = await ctx.checkpoint?.('key3', async () => { + const key3 = await ctx.checkpoint('key3', async () => { return 'updated'; }); diff --git a/plugins/scaffolder-node-test-utils/src/actions/mockActionConext.ts b/plugins/scaffolder-node-test-utils/src/actions/mockActionConext.ts index 33a40ad02c..f9cd556fd9 100644 --- a/plugins/scaffolder-node-test-utils/src/actions/mockActionConext.ts +++ b/plugins/scaffolder-node-test-utils/src/actions/mockActionConext.ts @@ -38,6 +38,7 @@ export const createMockActionContext = < output: jest.fn(), createTemporaryDirectory: jest.fn(), input: {} as TActionInput, + checkpoint: jest.fn(), }; const createDefaultWorkspace = () => ({ diff --git a/plugins/scaffolder-node/api-report.md b/plugins/scaffolder-node/api-report.md index 76e22c0c5a..ba914f8f87 100644 --- a/plugins/scaffolder-node/api-report.md +++ b/plugins/scaffolder-node/api-report.md @@ -30,7 +30,7 @@ export type ActionContext< secrets?: TaskSecrets; workspacePath: string; input: TActionInput; - checkpoint?( + checkpoint( key: string, fn: () => Promise, ): Promise; diff --git a/plugins/scaffolder-node/src/actions/types.ts b/plugins/scaffolder-node/src/actions/types.ts index 678d6f87d7..5abeb29a2b 100644 --- a/plugins/scaffolder-node/src/actions/types.ts +++ b/plugins/scaffolder-node/src/actions/types.ts @@ -35,7 +35,7 @@ export type ActionContext< secrets?: TaskSecrets; workspacePath: string; input: TActionInput; - checkpoint?( + checkpoint( key: string, fn: () => Promise, ): Promise;