Add support for lifecycle in template entities

Signed-off-by: Tyler Davis <tylerd@canva.com>
This commit is contained in:
Tyler Davis
2025-03-16 20:49:41 +11:00
parent 85df833fe3
commit c6a08fe954
3 changed files with 21 additions and 0 deletions
@@ -15,6 +15,7 @@
"spec": {
"owner": "artist-relations-team",
"type": "website",
"lifecycle": "production",
"parameters": {
"required": ["name", "description", "repoUrl"],
"backstage:permissions": {
@@ -95,6 +96,12 @@
"description": "The user (or group) owner of the template",
"minLength": 1
},
"lifecycle": {
"type": "string",
"description": "The lifecycle state of the template.",
"examples": ["experimental", "production", "deprecated"],
"minLength": 1
},
"parameters": {
"oneOf": [
{
@@ -181,4 +181,14 @@ describe('templateEntityV1beta3Validator', () => {
entity.spec.steps[0]['backstage:permissions'] = true as {};
expect(() => validator(entity)).toThrow(/must be object/);
});
it('accepts undefined lifecycle', async () => {
delete (entity as any).spec.lifecycle;
expect(validator(entity)).toBe(entity);
});
it('accepts valid lifecycle', async () => {
(entity as any).spec.lifecycle = 'production';
expect(validator(entity)).toBe(entity);
});
});
@@ -80,6 +80,10 @@ export interface TemplateEntityV1beta3 extends Entity {
* The owner entityRef of the TemplateEntity
*/
owner?: string;
/**
* Specifies the lifecycle phase of the TemplateEntity
*/
lifecycle?: string;
};
}