From c3a28a46fcd494b308258b0aba99a076945b8c23 Mon Sep 17 00:00:00 2001 From: blam Date: Wed, 19 Jan 2022 16:43:45 +0100 Subject: [PATCH] chore: deprecating the token field and renaming to backstageToken as token is far too generic Signed-off-by: blam --- plugins/scaffolder-backend/src/scaffolder/tasks/types.ts | 6 ++++-- plugins/scaffolder-backend/src/service/router.ts | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/tasks/types.ts b/plugins/scaffolder-backend/src/scaffolder/tasks/types.ts index 1a69f28fb6..7a2afcbaed 100644 --- a/plugins/scaffolder-backend/src/scaffolder/tasks/types.ts +++ b/plugins/scaffolder-backend/src/scaffolder/tasks/types.ts @@ -89,8 +89,10 @@ export type SerializedTaskEvent = { * * @public */ -export type TaskSecrets = { - token: string | undefined; +export type TaskSecrets = JsonObject & { + /** @deprecated Use `backstageToken` instead */ + token?: string; + backstageToken?: string; }; /** diff --git a/plugins/scaffolder-backend/src/service/router.ts b/plugins/scaffolder-backend/src/service/router.ts index 9d26857ab9..f4f7398c8a 100644 --- a/plugins/scaffolder-backend/src/service/router.ts +++ b/plugins/scaffolder-backend/src/service/router.ts @@ -232,6 +232,9 @@ export async function createRouter( } const result = await taskBroker.dispatch(taskSpec, { + ...req.body.secrets, + backstageToken: token, + // This is deprecated, but we need to support it for now if people are running their own task broker. token: token, });