From d4f20e5be3555e28213cdaec89c3093c67734bf7 Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 17 Jun 2021 11:40:22 +0200 Subject: [PATCH 1/2] chore: dont replace empty strings to undefined in `input` parsing Signed-off-by: blam --- .../src/scaffolder/tasks/TaskWorker.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/plugins/scaffolder-backend/src/scaffolder/tasks/TaskWorker.ts b/plugins/scaffolder-backend/src/scaffolder/tasks/TaskWorker.ts index 94eaa62c85..bff10fc7e9 100644 --- a/plugins/scaffolder-backend/src/scaffolder/tasks/TaskWorker.ts +++ b/plugins/scaffolder-backend/src/scaffolder/tasks/TaskWorker.ts @@ -170,11 +170,6 @@ export class TaskWorker { preventIndent: true, })(templateCtx); - // If it's just an empty string, treat it as undefined - if (templated === '') { - return undefined; - } - // If it smells like a JSON object then give it a parse as an object and if it fails return the string if ( (templated.startsWith('"') && templated.endsWith('"')) || @@ -213,6 +208,10 @@ export class TaskWorker { // Keep track of all tmp dirs that are created by the action so we can remove them after const tmpDirs = new Array(); + this.options.logger.debug(`Running ${action.id} with input`, { + input: JSON.stringify(input, null, 2), + }); + await action.handler({ baseUrl: task.spec.baseUrl, logger: taskLogger, From b492221760757d4686cbae533f4b5f1242136f5e Mon Sep 17 00:00:00 2001 From: blam Date: Thu, 17 Jun 2021 11:41:56 +0200 Subject: [PATCH 2/2] chore: added changeset Signed-off-by: blam --- .changeset/unlucky-peas-nail.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/unlucky-peas-nail.md diff --git a/.changeset/unlucky-peas-nail.md b/.changeset/unlucky-peas-nail.md new file mode 100644 index 0000000000..a4b5da1f90 --- /dev/null +++ b/.changeset/unlucky-peas-nail.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-scaffolder-backend': patch +--- + +Keep the empty string as empty string in `input` rather than replacing with `undefined` to make empty values ok for `cookiecutter`