Skip to content

Commit

Permalink
release: 0.2.0 (#5)
Browse files Browse the repository at this point in the history
### Description

This release adds multi-account support on entity processor. Now if the
`account` property exists in the database for the mapped entity it will
get added as an annotation to the Backstage entity.

## Acknowledgement

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

**Disclaimer:** We value your time and bandwidth. As such, any pull
requests created on non-triaged issues might not be successful.
  • Loading branch information
t1agob authored Jul 12, 2024
2 parents e595008 + 4560c87 commit 272e8ca
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 54 deletions.
46 changes: 0 additions & 46 deletions config.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@backstage/catalog-model": "^1.5.0",
"@backstage/config": "^1.2.0",
"@backstage/plugin-catalog-node": "^1.12.2",
"@pagerduty/backstage-plugin-common": "0.1.5",
"@pagerduty/backstage-plugin-common": "0.2.0",
"@rjsf/core": "^5.14.3",
"node-fetch": "^2.6.7",
"winston": "^3.2.1",
Expand Down
3 changes: 2 additions & 1 deletion src/apis/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class PagerDutyClient {
return {
serviceId: foundMapping.mapping.serviceId,
integrationKey: foundMapping.mapping.integrationKey,
entityRef: foundMapping.mapping.entityRef
entityRef: foundMapping.mapping.entityRef,
account: foundMapping.mapping.account,
}
}
} catch (error) {
Expand Down
9 changes: 8 additions & 1 deletion src/processor/PagerDutyEntityProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ export class PagerDutyEntityProcessor implements CatalogProcessor {
delete entity.metadata.annotations!["pagerduty.com/integration-key"];
}

this.logger.debug(`Added annotations to entity ${entity.metadata.name} with service id: ${mapping.serviceId} and integration key: ${mapping.integrationKey}`);
if (mapping.account && mapping.account !== "") {
entity.metadata.annotations!["pagerduty.com/account"] = mapping.account;
}
else {
delete entity.metadata.annotations!["pagerduty.com/account"];
}

this.logger.debug(`Added annotations to entity ${entity.metadata.name} with service id: ${mapping.serviceId}, integration key: ${mapping.integrationKey} and account: ${mapping.account}`);
} else {
this.logger.debug(`No mapping found for entity: ${entity.metadata.name}`);
}
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export type EntityMapping = {
serviceId?: string;
integrationKey?: string;
entityRef?: string;
account?: string;
}
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5068,10 +5068,10 @@ __metadata:
languageName: node
linkType: hard

"@pagerduty/backstage-plugin-common@npm:0.1.5":
version: 0.1.5
resolution: "@pagerduty/backstage-plugin-common@npm:0.1.5"
checksum: 07d527c07aee79d5bb6bf7f310827b11534922c1f817b2cea5cf672ebe393b2def07293b2d42241a033f257139f8d935114edd5e9385dbbc427f8720f20265b6
"@pagerduty/backstage-plugin-common@npm:0.2.0":
version: 0.2.0
resolution: "@pagerduty/backstage-plugin-common@npm:0.2.0"
checksum: d7243ef9c11408eee046be351346455316dcd8984c33a61d773fec292843d3df9eb9906dfc5ce0ed4fc0c17a60b9b3ebbfe1a8f4a25b8ecc003ffa8d4304db77
languageName: node
linkType: hard

Expand All @@ -5086,7 +5086,7 @@ __metadata:
"@backstage/cli": ^0.24.0
"@backstage/config": ^1.2.0
"@backstage/plugin-catalog-node": ^1.12.2
"@pagerduty/backstage-plugin-common": 0.1.5
"@pagerduty/backstage-plugin-common": 0.2.0
"@rjsf/core": ^5.14.3
"@types/node": ^20.9.2
"@types/node-fetch": 2.6.11
Expand Down

0 comments on commit 272e8ca

Please sign in to comment.