Merge pull request #13289 from dagda1/template-info-entity-metadata

[scaffolder] Include entity metadata in ctx.templateInfo
This commit is contained in:
Ben Lambert
2022-08-23 11:23:41 +02:00
committed by GitHub
5 changed files with 33 additions and 4 deletions
+6
View File
@@ -0,0 +1,6 @@
---
'@backstage/plugin-scaffolder-backend': minor
'@backstage/plugin-scaffolder-common': minor
---
add entity metadata to the template info type
@@ -261,6 +261,9 @@ describe('createRouter', () => {
name: mockTemplate.metadata?.name,
}),
baseUrl: 'https://dev.azure.com',
entity: {
metadata: mockTemplate.metadata,
},
},
},
}),
@@ -312,6 +315,9 @@ describe('createRouter', () => {
name: mockTemplate.metadata?.name,
}),
baseUrl: 'https://dev.azure.com',
entity: {
metadata: mockTemplate.metadata,
},
},
},
}),
@@ -249,6 +249,9 @@ export async function createRouter(
name: template.metadata?.name,
}),
baseUrl,
entity: {
metadata: template.metadata,
},
},
};
+6 -2
View File
@@ -4,10 +4,11 @@
```ts
import { Entity } from '@backstage/catalog-model';
import type { EntityMeta } from '@backstage/catalog-model';
import { JsonObject } from '@backstage/types';
import { JsonValue } from '@backstage/types';
import type { JsonValue } from '@backstage/types';
import { KindValidator } from '@backstage/catalog-model';
import { UserEntity } from '@backstage/catalog-model';
import type { UserEntity } from '@backstage/catalog-model';
// @public
export type TaskSpec = TaskSpecV1beta3;
@@ -64,5 +65,8 @@ export const templateEntityV1beta3Validator: KindValidator;
export type TemplateInfo = {
entityRef: string;
baseUrl?: string;
entity?: {
metadata: EntityMeta;
};
};
```
+12 -2
View File
@@ -14,8 +14,8 @@
* limitations under the License.
*/
import { UserEntity } from '@backstage/catalog-model';
import { JsonValue, JsonObject } from '@backstage/types';
import type { EntityMeta, UserEntity } from '@backstage/catalog-model';
import type { JsonValue, JsonObject } from '@backstage/types';
/**
* Information about a template that is stored on a task specification.
@@ -32,6 +32,16 @@ export type TemplateInfo = {
* Where the template is stored, so we can resolve relative paths for things like `fetch:template` paths.
*/
baseUrl?: string;
/**
* the Template entity
*/
entity?: {
/**
* The metadata of the Template
*/
metadata: EntityMeta;
};
};
/**