@backstage/plugin-catalog-backend-module-azure 0.2.4-next.2 → 0.3.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/alpha.cjs.js +1 -1
- package/dist/index.cjs.js +6 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/module/catalogModuleAzureDevOpsEntityProvider.cjs.js +20 -9
- package/dist/module/catalogModuleAzureDevOpsEntityProvider.cjs.js.map +1 -1
- package/dist/providers/AzureBlobStorageEntityProvider.cjs.js +174 -0
- package/dist/providers/AzureBlobStorageEntityProvider.cjs.js.map +1 -0
- package/dist/providers/config.cjs.js +34 -0
- package/dist/providers/config.cjs.js.map +1 -1
- package/package.json +22 -11
- package/alpha/package.json +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @backstage/plugin-catalog-backend-module-azure
|
|
2
2
|
|
|
3
|
+
## 0.3.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 277092a: Added the Azure Blob Storage as catalog entity provider to import all the desired entities from storage account provided in app-config.yaml
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/integration@1.16.0-next.0
|
|
13
|
+
- @backstage/backend-plugin-api@1.0.3-next.0
|
|
14
|
+
- @backstage/config@1.3.0
|
|
15
|
+
- @backstage/plugin-catalog-common@1.1.1
|
|
16
|
+
- @backstage/plugin-catalog-node@1.14.1-next.0
|
|
17
|
+
|
|
18
|
+
## 0.2.4
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 4e58bc7: Upgrade to uuid v11 internally
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @backstage/config@1.3.0
|
|
25
|
+
- @backstage/plugin-catalog-node@1.14.0
|
|
26
|
+
- @backstage/backend-plugin-api@1.0.2
|
|
27
|
+
- @backstage/integration@1.15.2
|
|
28
|
+
- @backstage/plugin-catalog-common@1.1.1
|
|
29
|
+
|
|
3
30
|
## 0.2.4-next.2
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
package/dist/alpha.cjs.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var catalogModuleAzureDevOpsEntityProvider = require('./module/catalogModuleAzureDevOpsEntityProvider.cjs.js');
|
|
6
6
|
|
|
7
|
-
const _feature = catalogModuleAzureDevOpsEntityProvider.
|
|
7
|
+
const _feature = catalogModuleAzureDevOpsEntityProvider.catalogModuleAzureEntityProvider;
|
|
8
8
|
|
|
9
9
|
exports.default = _feature;
|
|
10
10
|
//# sourceMappingURL=alpha.cjs.js.map
|
package/dist/index.cjs.js
CHANGED
|
@@ -5,10 +5,15 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var catalogModuleAzureDevOpsEntityProvider = require('./module/catalogModuleAzureDevOpsEntityProvider.cjs.js');
|
|
6
6
|
var AzureDevOpsDiscoveryProcessor = require('./processors/AzureDevOpsDiscoveryProcessor.cjs.js');
|
|
7
7
|
var AzureDevOpsEntityProvider = require('./providers/AzureDevOpsEntityProvider.cjs.js');
|
|
8
|
+
require('@azure/storage-blob');
|
|
9
|
+
require('@backstage/plugin-catalog-node');
|
|
10
|
+
require('uuid');
|
|
11
|
+
require('@backstage/backend-plugin-api');
|
|
12
|
+
require('@backstage/integration');
|
|
8
13
|
|
|
9
14
|
|
|
10
15
|
|
|
11
|
-
exports.default = catalogModuleAzureDevOpsEntityProvider.
|
|
16
|
+
exports.default = catalogModuleAzureDevOpsEntityProvider.catalogModuleAzureEntityProvider;
|
|
12
17
|
exports.AzureDevOpsDiscoveryProcessor = AzureDevOpsDiscoveryProcessor.AzureDevOpsDiscoveryProcessor;
|
|
13
18
|
exports.AzureDevOpsEntityProvider = AzureDevOpsEntityProvider.AzureDevOpsEntityProvider;
|
|
14
19
|
//# sourceMappingURL=index.cjs.js.map
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { LocationSpec } from '@backstage/plugin-catalog-common';
|
|
|
10
10
|
*
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
|
-
declare const
|
|
13
|
+
declare const catalogModuleAzureEntityProvider: _backstage_backend_plugin_api.BackendFeature;
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Extracts repositories out of an Azure DevOps org.
|
|
@@ -73,4 +73,4 @@ declare class AzureDevOpsEntityProvider implements EntityProvider {
|
|
|
73
73
|
private createObjectUrl;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
export { AzureDevOpsDiscoveryProcessor, AzureDevOpsEntityProvider,
|
|
76
|
+
export { AzureDevOpsDiscoveryProcessor, AzureDevOpsEntityProvider, catalogModuleAzureEntityProvider as default };
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
var backendPluginApi = require('@backstage/backend-plugin-api');
|
|
4
4
|
var alpha = require('@backstage/plugin-catalog-node/alpha');
|
|
5
5
|
var AzureDevOpsEntityProvider = require('../providers/AzureDevOpsEntityProvider.cjs.js');
|
|
6
|
+
var AzureBlobStorageEntityProvider = require('../providers/AzureBlobStorageEntityProvider.cjs.js');
|
|
6
7
|
|
|
7
|
-
const
|
|
8
|
+
const catalogModuleAzureEntityProvider = backendPluginApi.createBackendModule({
|
|
8
9
|
pluginId: "catalog",
|
|
9
|
-
moduleId: "azure-
|
|
10
|
+
moduleId: "azure-providers",
|
|
10
11
|
register(env) {
|
|
11
12
|
env.registerInit({
|
|
12
13
|
deps: {
|
|
@@ -16,16 +17,26 @@ const catalogModuleAzureDevOpsEntityProvider = backendPluginApi.createBackendMod
|
|
|
16
17
|
scheduler: backendPluginApi.coreServices.scheduler
|
|
17
18
|
},
|
|
18
19
|
async init({ config, catalog, logger, scheduler }) {
|
|
19
|
-
catalog.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
if (config.has("catalog.providers.azureBlob")) {
|
|
21
|
+
catalog.addEntityProvider(
|
|
22
|
+
AzureBlobStorageEntityProvider.AzureBlobStorageEntityProvider.fromConfig(config, {
|
|
23
|
+
logger,
|
|
24
|
+
scheduler
|
|
25
|
+
})
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
if (config.has("catalog.providers.azureDevOps")) {
|
|
29
|
+
catalog.addEntityProvider(
|
|
30
|
+
AzureDevOpsEntityProvider.AzureDevOpsEntityProvider.fromConfig(config, {
|
|
31
|
+
logger,
|
|
32
|
+
scheduler
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
}
|
|
25
36
|
}
|
|
26
37
|
});
|
|
27
38
|
}
|
|
28
39
|
});
|
|
29
40
|
|
|
30
|
-
exports.
|
|
41
|
+
exports.catalogModuleAzureEntityProvider = catalogModuleAzureEntityProvider;
|
|
31
42
|
//# sourceMappingURL=catalogModuleAzureDevOpsEntityProvider.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalogModuleAzureDevOpsEntityProvider.cjs.js","sources":["../../src/module/catalogModuleAzureDevOpsEntityProvider.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\nimport {
|
|
1
|
+
{"version":3,"file":"catalogModuleAzureDevOpsEntityProvider.cjs.js","sources":["../../src/module/catalogModuleAzureDevOpsEntityProvider.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n coreServices,\n createBackendModule,\n} from '@backstage/backend-plugin-api';\nimport { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';\nimport {\n AzureBlobStorageEntityProvider,\n AzureDevOpsEntityProvider,\n} from '../providers';\n\n/**\n * Registers the AzureDevOpsEntityProvider with the catalog processing extension point.\n *\n * @public\n */\nexport const catalogModuleAzureEntityProvider = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'azure-providers',\n register(env) {\n env.registerInit({\n deps: {\n config: coreServices.rootConfig,\n catalog: catalogProcessingExtensionPoint,\n logger: coreServices.logger,\n scheduler: coreServices.scheduler,\n },\n async init({ config, catalog, logger, scheduler }) {\n // Check for Azure Blob Storage provider configuration and register it\n if (config.has('catalog.providers.azureBlob')) {\n catalog.addEntityProvider(\n AzureBlobStorageEntityProvider.fromConfig(config, {\n logger,\n scheduler,\n }),\n );\n }\n\n // Check for Azure DevOps provider configuration and register it\n if (config.has('catalog.providers.azureDevOps')) {\n catalog.addEntityProvider(\n AzureDevOpsEntityProvider.fromConfig(config, {\n logger,\n scheduler,\n }),\n );\n }\n },\n });\n },\n});\n"],"names":["createBackendModule","coreServices","catalogProcessingExtensionPoint","AzureBlobStorageEntityProvider","AzureDevOpsEntityProvider"],"mappings":";;;;;;;AA+BO,MAAM,mCAAmCA,oCAAoB,CAAA;AAAA,EAClE,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,iBAAA;AAAA,EACV,SAAS,GAAK,EAAA;AACZ,IAAA,GAAA,CAAI,YAAa,CAAA;AAAA,MACf,IAAM,EAAA;AAAA,QACJ,QAAQC,6BAAa,CAAA,UAAA;AAAA,QACrB,OAAS,EAAAC,qCAAA;AAAA,QACT,QAAQD,6BAAa,CAAA,MAAA;AAAA,QACrB,WAAWA,6BAAa,CAAA;AAAA,OAC1B;AAAA,MACA,MAAM,IAAK,CAAA,EAAE,QAAQ,OAAS,EAAA,MAAA,EAAQ,WAAa,EAAA;AAEjD,QAAI,IAAA,MAAA,CAAO,GAAI,CAAA,6BAA6B,CAAG,EAAA;AAC7C,UAAQ,OAAA,CAAA,iBAAA;AAAA,YACNE,6DAAA,CAA+B,WAAW,MAAQ,EAAA;AAAA,cAChD,MAAA;AAAA,cACA;AAAA,aACD;AAAA,WACH;AAAA;AAIF,QAAI,IAAA,MAAA,CAAO,GAAI,CAAA,+BAA+B,CAAG,EAAA;AAC/C,UAAQ,OAAA,CAAA,iBAAA;AAAA,YACNC,mDAAA,CAA0B,WAAW,MAAQ,EAAA;AAAA,cAC3C,MAAA;AAAA,cACA;AAAA,aACD;AAAA,WACH;AAAA;AACF;AACF,KACD,CAAA;AAAA;AAEL,CAAC;;;;"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var storageBlob = require('@azure/storage-blob');
|
|
4
|
+
var pluginCatalogNode = require('@backstage/plugin-catalog-node');
|
|
5
|
+
var uuid = require('uuid');
|
|
6
|
+
var config = require('./config.cjs.js');
|
|
7
|
+
var integration = require('@backstage/integration');
|
|
8
|
+
|
|
9
|
+
function _interopNamespaceCompat(e) {
|
|
10
|
+
if (e && typeof e === 'object' && 'default' in e) return e;
|
|
11
|
+
var n = Object.create(null);
|
|
12
|
+
if (e) {
|
|
13
|
+
Object.keys(e).forEach(function (k) {
|
|
14
|
+
if (k !== 'default') {
|
|
15
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return e[k]; }
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
n.default = e;
|
|
24
|
+
return Object.freeze(n);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var uuid__namespace = /*#__PURE__*/_interopNamespaceCompat(uuid);
|
|
28
|
+
|
|
29
|
+
class AzureBlobStorageEntityProvider {
|
|
30
|
+
constructor(config, integration, credentialsProvider, logger, schedule) {
|
|
31
|
+
this.config = config;
|
|
32
|
+
this.integration = integration;
|
|
33
|
+
this.credentialsProvider = credentialsProvider;
|
|
34
|
+
this.logger = logger.child({ target: this.getProviderName() });
|
|
35
|
+
this.scheduleFn = this.createScheduleFn(schedule);
|
|
36
|
+
}
|
|
37
|
+
logger;
|
|
38
|
+
connection;
|
|
39
|
+
blobServiceClient;
|
|
40
|
+
scheduleFn;
|
|
41
|
+
static fromConfig(configRoot, options) {
|
|
42
|
+
const providerConfigs = config.readAzureBlobStorageConfigs(configRoot);
|
|
43
|
+
const scmIntegration = integration.ScmIntegrations.fromConfig(configRoot);
|
|
44
|
+
const credentialsProvider = integration.DefaultAzureCredentialsManager.fromIntegrations(scmIntegration);
|
|
45
|
+
if (!options.schedule && !options.scheduler) {
|
|
46
|
+
throw new Error("Either schedule or scheduler must be provided.");
|
|
47
|
+
}
|
|
48
|
+
return providerConfigs.map((providerConfig) => {
|
|
49
|
+
const integration = scmIntegration.azureBlobStorage.list().filter(
|
|
50
|
+
(azureIntegration) => azureIntegration.config.accountName === providerConfig.accountName
|
|
51
|
+
)[0];
|
|
52
|
+
if (!options.schedule && !providerConfig.schedule) {
|
|
53
|
+
throw new Error(
|
|
54
|
+
`No schedule provided neither via code nor config for AzureBlobStorageEntityProvider:${providerConfig.id}.`
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
if (!integration) {
|
|
58
|
+
throw new Error(
|
|
59
|
+
`There is no Azure blob storage integration for account. Please add a configuration entry for it under integrations.azureBlobStorage`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
const taskRunner = options.schedule ?? options.scheduler.createScheduledTaskRunner(providerConfig.schedule);
|
|
63
|
+
return new AzureBlobStorageEntityProvider(
|
|
64
|
+
providerConfig,
|
|
65
|
+
integration,
|
|
66
|
+
credentialsProvider,
|
|
67
|
+
options.logger,
|
|
68
|
+
taskRunner
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
createScheduleFn(taskRunner) {
|
|
73
|
+
return async () => {
|
|
74
|
+
const taskId = `${this.getProviderName()}:refresh`;
|
|
75
|
+
return taskRunner.run({
|
|
76
|
+
id: taskId,
|
|
77
|
+
fn: async () => {
|
|
78
|
+
const logger = this.logger.child({
|
|
79
|
+
class: AzureBlobStorageEntityProvider.prototype.constructor.name,
|
|
80
|
+
taskId,
|
|
81
|
+
taskInstanceId: uuid__namespace.v4()
|
|
82
|
+
});
|
|
83
|
+
try {
|
|
84
|
+
await this.refresh(logger);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
logger.error(
|
|
87
|
+
`${this.getProviderName()} refresh failed, ${error}`,
|
|
88
|
+
error
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
getProviderName() {
|
|
96
|
+
return `azureBlobStorage-provider:${this.config.id}`;
|
|
97
|
+
}
|
|
98
|
+
async connect(connection) {
|
|
99
|
+
this.connection = connection;
|
|
100
|
+
let credential;
|
|
101
|
+
if (this.integration.config.accountKey) {
|
|
102
|
+
credential = new storageBlob.StorageSharedKeyCredential(
|
|
103
|
+
this.integration.config.accountName,
|
|
104
|
+
this.integration.config.accountKey
|
|
105
|
+
);
|
|
106
|
+
} else {
|
|
107
|
+
credential = await this.credentialsProvider.getCredentials(
|
|
108
|
+
this.integration.config.accountName
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
let blobServiceClientUrl;
|
|
112
|
+
if (this.integration.config.endpoint) {
|
|
113
|
+
if (this.integration.config.sasToken) {
|
|
114
|
+
blobServiceClientUrl = `${this.integration.config.endpoint}?${this.integration.config.sasToken}`;
|
|
115
|
+
} else {
|
|
116
|
+
blobServiceClientUrl = `${this.integration.config.endpoint}`;
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
blobServiceClientUrl = `https://${this.integration.config.accountName}.${this.integration.config.host}`;
|
|
120
|
+
}
|
|
121
|
+
this.blobServiceClient = new storageBlob.BlobServiceClient(
|
|
122
|
+
blobServiceClientUrl,
|
|
123
|
+
credential
|
|
124
|
+
);
|
|
125
|
+
await this.scheduleFn();
|
|
126
|
+
}
|
|
127
|
+
async refresh(logger) {
|
|
128
|
+
if (!this.connection) {
|
|
129
|
+
throw new Error("Not initialized");
|
|
130
|
+
}
|
|
131
|
+
logger.info("Discovering Azure Blob Storage blobs");
|
|
132
|
+
const keys = await this.listAllBlobKeys();
|
|
133
|
+
logger.info(`Discovered ${keys.length} Azure Blob Storage blobs`);
|
|
134
|
+
const locations = keys.map((key) => this.createLocationSpec(key));
|
|
135
|
+
await this.connection.applyMutation({
|
|
136
|
+
type: "full",
|
|
137
|
+
entities: locations.map((location) => {
|
|
138
|
+
return {
|
|
139
|
+
locationKey: this.getProviderName(),
|
|
140
|
+
entity: pluginCatalogNode.locationSpecToLocationEntity({ location })
|
|
141
|
+
};
|
|
142
|
+
})
|
|
143
|
+
});
|
|
144
|
+
logger.info(
|
|
145
|
+
`Committed ${locations.length} Locations for Azure Blob Storage blobs`
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
async listAllBlobKeys() {
|
|
149
|
+
const keys = [];
|
|
150
|
+
const containerClient = this.blobServiceClient?.getContainerClient(
|
|
151
|
+
this.config.containerName
|
|
152
|
+
);
|
|
153
|
+
for await (const blob of containerClient.listBlobsFlat()) {
|
|
154
|
+
if (blob.name) {
|
|
155
|
+
keys.push(blob.name);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return keys;
|
|
159
|
+
}
|
|
160
|
+
createLocationSpec(key) {
|
|
161
|
+
return {
|
|
162
|
+
type: "url",
|
|
163
|
+
target: this.createObjectUrl(key),
|
|
164
|
+
presence: "required"
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
createObjectUrl(key) {
|
|
168
|
+
const endpoint = this.blobServiceClient?.url;
|
|
169
|
+
return `${endpoint}${this.config.containerName}/${key}`;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
exports.AzureBlobStorageEntityProvider = AzureBlobStorageEntityProvider;
|
|
174
|
+
//# sourceMappingURL=AzureBlobStorageEntityProvider.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AzureBlobStorageEntityProvider.cjs.js","sources":["../../src/providers/AzureBlobStorageEntityProvider.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n AnonymousCredential,\n BlobServiceClient,\n ContainerClient,\n StorageSharedKeyCredential,\n} from '@azure/storage-blob';\nimport { Config } from '@backstage/config';\nimport {\n LoggerService,\n SchedulerService,\n SchedulerServiceTaskRunner,\n} from '@backstage/backend-plugin-api';\nimport {\n EntityProvider,\n EntityProviderConnection,\n locationSpecToLocationEntity,\n} from '@backstage/plugin-catalog-node';\nimport { LocationSpec } from '@backstage/plugin-catalog-common';\nimport * as uuid from 'uuid';\nimport { readAzureBlobStorageConfigs } from './config';\nimport {\n AzureBlobStorageIntergation,\n DefaultAzureCredentialsManager,\n ScmIntegrations,\n} from '@backstage/integration';\nimport { TokenCredential } from '@azure/identity';\nimport { AzureBlobStorageConfig } from './types';\n\n/**\n * Provider which discovers catalog files within an Azure Storage accounts.\n *\n * Use `AzureBlobStorageEntityProvider.fromConfig(...)` to create instances.\n *\n * @public\n */\nexport class AzureBlobStorageEntityProvider implements EntityProvider {\n private readonly logger: LoggerService;\n private connection?: EntityProviderConnection;\n private blobServiceClient?: BlobServiceClient;\n private readonly scheduleFn: () => Promise<void>;\n\n static fromConfig(\n configRoot: Config,\n options: {\n logger: LoggerService;\n schedule?: SchedulerServiceTaskRunner;\n scheduler?: SchedulerService;\n },\n ): AzureBlobStorageEntityProvider[] {\n const providerConfigs = readAzureBlobStorageConfigs(configRoot);\n\n const scmIntegration = ScmIntegrations.fromConfig(configRoot);\n const credentialsProvider =\n DefaultAzureCredentialsManager.fromIntegrations(scmIntegration);\n if (!options.schedule && !options.scheduler) {\n throw new Error('Either schedule or scheduler must be provided.');\n }\n\n return providerConfigs.map(providerConfig => {\n const integration = scmIntegration.azureBlobStorage\n .list()\n .filter(\n azureIntegration =>\n azureIntegration.config.accountName === providerConfig.accountName,\n )[0];\n\n if (!options.schedule && !providerConfig.schedule) {\n throw new Error(\n `No schedule provided neither via code nor config for AzureBlobStorageEntityProvider:${providerConfig.id}.`,\n );\n }\n\n if (!integration) {\n throw new Error(\n `There is no Azure blob storage integration for account. Please add a configuration entry for it under integrations.azureBlobStorage`,\n );\n }\n\n const taskRunner =\n options.schedule ??\n options.scheduler!.createScheduledTaskRunner(providerConfig.schedule!);\n\n return new AzureBlobStorageEntityProvider(\n providerConfig,\n integration,\n credentialsProvider,\n options.logger,\n taskRunner,\n );\n });\n }\n private constructor(\n private readonly config: AzureBlobStorageConfig,\n private readonly integration: AzureBlobStorageIntergation,\n private readonly credentialsProvider: DefaultAzureCredentialsManager,\n logger: LoggerService,\n schedule: SchedulerServiceTaskRunner,\n ) {\n this.logger = logger.child({ target: this.getProviderName() });\n this.scheduleFn = this.createScheduleFn(schedule);\n }\n\n private createScheduleFn(\n taskRunner: SchedulerServiceTaskRunner,\n ): () => Promise<void> {\n return async () => {\n const taskId = `${this.getProviderName()}:refresh`;\n return taskRunner.run({\n id: taskId,\n fn: async () => {\n const logger = this.logger.child({\n class: AzureBlobStorageEntityProvider.prototype.constructor.name,\n taskId,\n taskInstanceId: uuid.v4(),\n });\n\n try {\n await this.refresh(logger);\n } catch (error) {\n logger.error(\n `${this.getProviderName()} refresh failed, ${error}`,\n error,\n );\n }\n },\n });\n };\n }\n\n getProviderName(): string {\n return `azureBlobStorage-provider:${this.config.id}`;\n }\n\n async connect(connection: EntityProviderConnection): Promise<void> {\n this.connection = connection;\n let credential:\n | TokenCredential\n | StorageSharedKeyCredential\n | AnonymousCredential;\n if (this.integration.config.accountKey) {\n credential = new StorageSharedKeyCredential(\n this.integration.config.accountName as string,\n this.integration.config.accountKey as string,\n ); // StorageSharedKeyCredential is only allowed in node.js runtime not in browser\n } else {\n credential = await this.credentialsProvider.getCredentials(\n this.integration.config.accountName as string,\n );\n }\n let blobServiceClientUrl: string;\n\n if (this.integration.config.endpoint) {\n if (this.integration.config.sasToken) {\n blobServiceClientUrl = `${this.integration.config.endpoint}?${this.integration.config.sasToken}`;\n } else {\n blobServiceClientUrl = `${this.integration.config.endpoint}`;\n }\n } else {\n blobServiceClientUrl = `https://${this.integration.config.accountName}.${this.integration.config.host}`;\n }\n\n this.blobServiceClient = new BlobServiceClient(\n blobServiceClientUrl,\n credential,\n );\n await this.scheduleFn();\n }\n\n async refresh(logger: LoggerService) {\n if (!this.connection) {\n throw new Error('Not initialized');\n }\n\n logger.info('Discovering Azure Blob Storage blobs');\n\n const keys = await this.listAllBlobKeys();\n logger.info(`Discovered ${keys.length} Azure Blob Storage blobs`);\n\n const locations = keys.map(key => this.createLocationSpec(key));\n\n await this.connection.applyMutation({\n type: 'full',\n entities: locations.map(location => {\n return {\n locationKey: this.getProviderName(),\n entity: locationSpecToLocationEntity({ location }),\n };\n }),\n });\n\n logger.info(\n `Committed ${locations.length} Locations for Azure Blob Storage blobs`,\n );\n }\n\n private async listAllBlobKeys(): Promise<string[]> {\n const keys: string[] = [];\n const containerClient = this.blobServiceClient?.getContainerClient(\n this.config.containerName,\n );\n\n for await (const blob of (\n containerClient as ContainerClient\n ).listBlobsFlat()) {\n if (blob.name) {\n keys.push(blob.name);\n }\n }\n\n return keys;\n }\n\n private createLocationSpec(key: string): LocationSpec {\n return {\n type: 'url',\n target: this.createObjectUrl(key),\n presence: 'required',\n };\n }\n\n private createObjectUrl(key: string): string {\n const endpoint = this.blobServiceClient?.url;\n return `${endpoint}${this.config.containerName}/${key}`;\n }\n}\n"],"names":["readAzureBlobStorageConfigs","ScmIntegrations","DefaultAzureCredentialsManager","uuid","StorageSharedKeyCredential","BlobServiceClient","locationSpecToLocationEntity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDO,MAAM,8BAAyD,CAAA;AAAA,EAwD5D,WACW,CAAA,MAAA,EACA,WACA,EAAA,mBAAA,EACjB,QACA,QACA,EAAA;AALiB,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AACA,IAAA,IAAA,CAAA,WAAA,GAAA,WAAA;AACA,IAAA,IAAA,CAAA,mBAAA,GAAA,mBAAA;AAIjB,IAAK,IAAA,CAAA,MAAA,GAAS,OAAO,KAAM,CAAA,EAAE,QAAQ,IAAK,CAAA,eAAA,IAAmB,CAAA;AAC7D,IAAK,IAAA,CAAA,UAAA,GAAa,IAAK,CAAA,gBAAA,CAAiB,QAAQ,CAAA;AAAA;A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T_PROVIDER_ID = "default";
|
|
5
6
|
function readAzureDevOpsConfigs(config) {
|
|
6
7
|
const configs = [];
|
|
7
8
|
const providerConfigs = config.getOptionalConfig(
|
|
@@ -36,6 +37,39 @@ function readAzureDevOpsConfig(id, config) {
|
|
|
36
37
|
schedule
|
|
37
38
|
};
|
|
38
39
|
}
|
|
40
|
+
function readAzureBlobStorageConfigs(config) {
|
|
41
|
+
const configs = [];
|
|
42
|
+
const providerConfigs = config.getOptionalConfig(
|
|
43
|
+
"catalog.providers.azureBlob"
|
|
44
|
+
);
|
|
45
|
+
if (!providerConfigs) {
|
|
46
|
+
return configs;
|
|
47
|
+
}
|
|
48
|
+
if (providerConfigs.has("containerName")) {
|
|
49
|
+
configs.push(
|
|
50
|
+
readAzureBlobStorageConfig(DEFAULT_PROVIDER_ID, providerConfigs)
|
|
51
|
+
);
|
|
52
|
+
return configs;
|
|
53
|
+
}
|
|
54
|
+
for (const id of providerConfigs.keys()) {
|
|
55
|
+
configs.push(readAzureBlobStorageConfig(id, providerConfigs.getConfig(id)));
|
|
56
|
+
}
|
|
57
|
+
return configs;
|
|
58
|
+
}
|
|
59
|
+
function readAzureBlobStorageConfig(id, config) {
|
|
60
|
+
const containerName = config.getString("containerName");
|
|
61
|
+
const accountName = config.getString("accountName");
|
|
62
|
+
const schedule = config.has("schedule") ? backendPluginApi.readSchedulerServiceTaskScheduleDefinitionFromConfig(
|
|
63
|
+
config.getConfig("schedule")
|
|
64
|
+
) : void 0;
|
|
65
|
+
return {
|
|
66
|
+
id,
|
|
67
|
+
containerName,
|
|
68
|
+
accountName,
|
|
69
|
+
schedule
|
|
70
|
+
};
|
|
71
|
+
}
|
|
39
72
|
|
|
73
|
+
exports.readAzureBlobStorageConfigs = readAzureBlobStorageConfigs;
|
|
40
74
|
exports.readAzureDevOpsConfigs = readAzureDevOpsConfigs;
|
|
41
75
|
//# sourceMappingURL=config.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs.js","sources":["../../src/providers/config.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { readSchedulerServiceTaskScheduleDefinitionFromConfig } from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport { AzureDevOpsConfig } from './types';\n\nexport function readAzureDevOpsConfigs(config: Config): AzureDevOpsConfig[] {\n const configs: AzureDevOpsConfig[] = [];\n\n const providerConfigs = config.getOptionalConfig(\n 'catalog.providers.azureDevOps',\n );\n\n if (!providerConfigs) {\n return configs;\n }\n\n for (const id of providerConfigs.keys()) {\n configs.push(readAzureDevOpsConfig(id, providerConfigs.getConfig(id)));\n }\n\n return configs;\n}\n\nfunction readAzureDevOpsConfig(id: string, config: Config): AzureDevOpsConfig {\n const organization = config.getString('organization');\n const project = config.getString('project');\n const host = config.getOptionalString('host') || 'dev.azure.com';\n const repository = config.getOptionalString('repository') || '*';\n const branch = config.getOptionalString('branch');\n const path = config.getOptionalString('path') || '/catalog-info.yaml';\n\n const schedule = config.has('schedule')\n ? readSchedulerServiceTaskScheduleDefinitionFromConfig(\n config.getConfig('schedule'),\n )\n : undefined;\n\n return {\n id,\n host,\n organization,\n project,\n repository,\n branch,\n path,\n schedule,\n };\n}\n"],"names":["readSchedulerServiceTaskScheduleDefinitionFromConfig"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"config.cjs.js","sources":["../../src/providers/config.ts"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { readSchedulerServiceTaskScheduleDefinitionFromConfig } from '@backstage/backend-plugin-api';\nimport { Config } from '@backstage/config';\nimport { AzureDevOpsConfig, AzureBlobStorageConfig } from './types';\n\nconst DEFAULT_PROVIDER_ID = 'default';\n\nexport function readAzureDevOpsConfigs(config: Config): AzureDevOpsConfig[] {\n const configs: AzureDevOpsConfig[] = [];\n\n const providerConfigs = config.getOptionalConfig(\n 'catalog.providers.azureDevOps',\n );\n\n if (!providerConfigs) {\n return configs;\n }\n\n for (const id of providerConfigs.keys()) {\n configs.push(readAzureDevOpsConfig(id, providerConfigs.getConfig(id)));\n }\n\n return configs;\n}\n\nfunction readAzureDevOpsConfig(id: string, config: Config): AzureDevOpsConfig {\n const organization = config.getString('organization');\n const project = config.getString('project');\n const host = config.getOptionalString('host') || 'dev.azure.com';\n const repository = config.getOptionalString('repository') || '*';\n const branch = config.getOptionalString('branch');\n const path = config.getOptionalString('path') || '/catalog-info.yaml';\n\n const schedule = config.has('schedule')\n ? readSchedulerServiceTaskScheduleDefinitionFromConfig(\n config.getConfig('schedule'),\n )\n : undefined;\n\n return {\n id,\n host,\n organization,\n project,\n repository,\n branch,\n path,\n schedule,\n };\n}\n\nexport function readAzureBlobStorageConfigs(\n config: Config,\n): AzureBlobStorageConfig[] {\n const configs: AzureBlobStorageConfig[] = [];\n\n const providerConfigs = config.getOptionalConfig(\n 'catalog.providers.azureBlob',\n );\n\n if (!providerConfigs) {\n return configs;\n }\n\n if (providerConfigs.has('containerName')) {\n // simple/single config variant\n configs.push(\n readAzureBlobStorageConfig(DEFAULT_PROVIDER_ID, providerConfigs),\n );\n\n return configs;\n }\n\n for (const id of providerConfigs.keys()) {\n configs.push(readAzureBlobStorageConfig(id, providerConfigs.getConfig(id)));\n }\n\n return configs;\n}\n\nfunction readAzureBlobStorageConfig(\n id: string,\n config: Config,\n): AzureBlobStorageConfig {\n const containerName = config.getString('containerName');\n const accountName = config.getString('accountName');\n const schedule = config.has('schedule')\n ? readSchedulerServiceTaskScheduleDefinitionFromConfig(\n config.getConfig('schedule'),\n )\n : undefined;\n\n return {\n id,\n containerName,\n accountName,\n schedule,\n };\n}\n"],"names":["readSchedulerServiceTaskScheduleDefinitionFromConfig"],"mappings":";;;;AAoBA,MAAM,mBAAsB,GAAA,SAAA;AAErB,SAAS,uBAAuB,MAAqC,EAAA;AAC1E,EAAA,MAAM,UAA+B,EAAC;AAEtC,EAAA,MAAM,kBAAkB,MAAO,CAAA,iBAAA;AAAA,IAC7B;AAAA,GACF;AAEA,EAAA,IAAI,CAAC,eAAiB,EAAA;AACpB,IAAO,OAAA,OAAA;AAAA;AAGT,EAAW,KAAA,MAAA,EAAA,IAAM,eAAgB,CAAA,IAAA,EAAQ,EAAA;AACvC,IAAA,OAAA,CAAQ,KAAK,qBAAsB,CAAA,EAAA,EAAI,gBAAgB,SAAU,CAAA,EAAE,CAAC,CAAC,CAAA;AAAA;AAGvE,EAAO,OAAA,OAAA;AACT;AAEA,SAAS,qBAAA,CAAsB,IAAY,MAAmC,EAAA;AAC5E,EAAM,MAAA,YAAA,GAAe,MAAO,CAAA,SAAA,CAAU,cAAc,CAAA;AACpD,EAAM,MAAA,OAAA,GAAU,MAAO,CAAA,SAAA,CAAU,SAAS,CAAA;AAC1C,EAAA,MAAM,IAAO,GAAA,MAAA,CAAO,iBAAkB,CAAA,MAAM,CAAK,IAAA,eAAA;AACjD,EAAA,MAAM,UAAa,GAAA,MAAA,CAAO,iBAAkB,CAAA,YAAY,CAAK,IAAA,GAAA;AAC7D,EAAM,MAAA,MAAA,GAAS,MAAO,CAAA,iBAAA,CAAkB,QAAQ,CAAA;AAChD,EAAA,MAAM,IAAO,GAAA,MAAA,CAAO,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AE7B,GAAA,KAAA,CAAA;AAEJ,EAAO,OAAA;AAAA,IACL,EAAA;AAAA,IACA,aAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AACF;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-catalog-backend-module-azure",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0-next.0",
|
|
4
4
|
"description": "A Backstage catalog backend module that helps integrate towards Azure",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "backend-plugin-module",
|
|
@@ -37,10 +37,19 @@
|
|
|
37
37
|
},
|
|
38
38
|
"main": "./dist/index.cjs.js",
|
|
39
39
|
"types": "./dist/index.d.ts",
|
|
40
|
+
"typesVersions": {
|
|
41
|
+
"*": {
|
|
42
|
+
"index": [
|
|
43
|
+
"dist/index.d.ts"
|
|
44
|
+
],
|
|
45
|
+
"alpha": [
|
|
46
|
+
"dist/alpha.d.ts"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
40
50
|
"files": [
|
|
41
51
|
"config.d.ts",
|
|
42
|
-
"dist"
|
|
43
|
-
"alpha"
|
|
52
|
+
"dist"
|
|
44
53
|
],
|
|
45
54
|
"scripts": {
|
|
46
55
|
"build": "backstage-cli package build",
|
|
@@ -52,17 +61,19 @@
|
|
|
52
61
|
"test": "backstage-cli package test"
|
|
53
62
|
},
|
|
54
63
|
"dependencies": {
|
|
55
|
-
"@
|
|
56
|
-
"@
|
|
57
|
-
"@backstage/
|
|
58
|
-
"@backstage/
|
|
59
|
-
"@backstage/
|
|
64
|
+
"@azure/identity": "^4.0.0",
|
|
65
|
+
"@azure/storage-blob": "^12.5.0",
|
|
66
|
+
"@backstage/backend-plugin-api": "1.0.3-next.0",
|
|
67
|
+
"@backstage/config": "1.3.0",
|
|
68
|
+
"@backstage/integration": "1.16.0-next.0",
|
|
69
|
+
"@backstage/plugin-catalog-common": "1.1.1",
|
|
70
|
+
"@backstage/plugin-catalog-node": "1.14.1-next.0",
|
|
60
71
|
"node-fetch": "^2.7.0",
|
|
61
|
-
"uuid": "^
|
|
72
|
+
"uuid": "^11.0.0"
|
|
62
73
|
},
|
|
63
74
|
"devDependencies": {
|
|
64
|
-
"@backstage/backend-test-utils": "1.
|
|
65
|
-
"@backstage/cli": "0.29.
|
|
75
|
+
"@backstage/backend-test-utils": "1.2.0-next.0",
|
|
76
|
+
"@backstage/cli": "0.29.3-next.0",
|
|
66
77
|
"luxon": "^3.0.0",
|
|
67
78
|
"msw": "^1.0.0"
|
|
68
79
|
},
|