Add the status field to the Entity envelope

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-05-11 18:31:37 +02:00
parent 8a45504787
commit 68fdbf014e
13 changed files with 183 additions and 13 deletions
@@ -91,6 +91,11 @@ describe('Stitcher', () => {
},
},
],
status: {
'backstage.io/processing-status': {
errors: [],
},
},
apiVersion: 'a',
kind: 'k',
metadata: {
@@ -171,6 +176,11 @@ describe('Stitcher', () => {
},
},
]),
status: {
'backstage.io/processing-status': {
errors: [],
},
},
apiVersion: 'a',
kind: 'k',
metadata: {
+15 -2
View File
@@ -41,6 +41,11 @@ function generateStableHash(entity: Entity) {
.digest('hex');
}
/**
* Performs the act of stitching - to take all of the various outputs from the
* ingestion process, and stitching them together into the final entity JSON
* shape.
*/
export class Stitcher {
constructor(
private readonly database: Knex,
@@ -109,7 +114,7 @@ export class Stitcher {
const {
entityId,
processedEntity,
// errors,
errors,
incomingReferenceCount,
previousHash,
} = result[0];
@@ -137,7 +142,15 @@ export class Stitcher {
['backstage.io/orphan']: 'true',
};
}
if (errors !== '') {
const parsedErrors = JSON.parse(errors);
entity.status = {
...entity.status,
'backstage.io/processing-status': {
errors: parsedErrors,
},
};
}
// TODO: entityRef is lower case and should be uppercase in the final
// result
entity.relations = result