Basic changes to include templateMetadata

Signed-off-by: Mark Foresta <Mark.Foresta691@gmail.com>
This commit is contained in:
Mark Foresta
2024-09-14 14:06:25 -04:00
committed by blam
parent c9e35d081a
commit 4bcccb1620
2 changed files with 6 additions and 2 deletions
@@ -38,10 +38,11 @@ import {
BackstageCredentials,
resolveSafeChildPath,
} from '@backstage/backend-plugin-api';
import type { UserEntity } from '@backstage/catalog-model';
import type { EntityMeta, UserEntity } from '@backstage/catalog-model';
interface DryRunInput {
spec: TaskSpec;
templateMetadata: EntityMeta;
secrets?: TaskSecrets;
directoryContents: SerializedFile[];
credentials: BackstageCredentials;
@@ -105,7 +106,6 @@ export function createDryRunner(options: TemplateTesterCreateOptions) {
await deserializeDirectoryContents(contentsPath, input.directoryContents);
const abortSignal = new AbortController().signal;
const result = await workflowRunner.execute({
spec: {
...input.spec,
@@ -119,6 +119,9 @@ export function createDryRunner(options: TemplateTesterCreateOptions) {
],
templateInfo: {
entityRef: 'template:default/dry-run',
entity: {
metadata: input.templateMetadata,
},
baseUrl: pathToFileURL(
resolveSafeChildPath(contentsPath, 'template.yaml'),
).toString(),
@@ -825,6 +825,7 @@ export async function createRouter(
ref: userEntityRef,
},
},
templateMetadata: template.metadata,
directoryContents: (body.directoryContents ?? []).map(file => ({
path: file.path,
content: Buffer.from(file.base64Content, 'base64'),