@backstage/plugin-catalog-backend-module-gerrit 0.0.0-nightly-20220422024928

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 ADDED
@@ -0,0 +1,14 @@
1
+ # @backstage/plugin-catalog-backend-module-gerrit
2
+
3
+ ## 0.0.0-nightly-20220422024928
4
+
5
+ ### Minor Changes
6
+
7
+ - 566407bf8a: Initial version of the `plugin-catalog-backend-module-gerrit` plugin
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/backend-common@0.0.0-nightly-20220422024928
13
+ - @backstage/plugin-catalog-backend@0.0.0-nightly-20220422024928
14
+ - @backstage/integration@0.0.0-nightly-20220422024928
package/README.md ADDED
@@ -0,0 +1,8 @@
1
+ # Catalog Backend Module for Gerrit
2
+
3
+ This is an extension module to the plugin-catalog-backend plugin, providing extensions targeted at Gerrit integrations.
4
+
5
+ ## Getting started
6
+
7
+ See [Backstage documentation](https://backstage.io/docs/integrations/gerrit/discovery.md)
8
+ for details on how to install and configure the plugin.
package/config.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright 2022 The Backstage Authors
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ interface GerritConfig {
18
+ /**
19
+ * (Required) The host of the Gerrit integration to use.
20
+ * @visibility backend
21
+ */
22
+ host: string;
23
+ /**
24
+ * (Required) The query to use for the "List Projects" API call. Used to limit the
25
+ * scope of the projects that the provider tries to ingest.
26
+ * @visibility backend
27
+ */
28
+ query: string;
29
+ /**
30
+ * (Optional) Branch.
31
+ * The branch where the provider will try to find entities. Defaults to "master".
32
+ * @visibility backend
33
+ */
34
+ branch?: string;
35
+ }
36
+
37
+ export interface Config {
38
+ catalog?: {
39
+ /**
40
+ * List of provider-specific options and attributes
41
+ */
42
+ providers?: {
43
+ /**
44
+ * GerritEntityProvider configuration
45
+ *
46
+ * Maps provider id with configuration.
47
+ */
48
+ gerrit?: Record<string, GerritConfig>;
49
+ };
50
+ };
51
+ }
@@ -0,0 +1,144 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var errors = require('@backstage/errors');
6
+ var pluginCatalogBackend = require('@backstage/plugin-catalog-backend');
7
+ var fetch = require('node-fetch');
8
+ var integration = require('@backstage/integration');
9
+ var uuid = require('uuid');
10
+
11
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
+
13
+ function _interopNamespace(e) {
14
+ if (e && e.__esModule) return e;
15
+ var n = Object.create(null);
16
+ if (e) {
17
+ Object.keys(e).forEach(function (k) {
18
+ if (k !== 'default') {
19
+ var d = Object.getOwnPropertyDescriptor(e, k);
20
+ Object.defineProperty(n, k, d.get ? d : {
21
+ enumerable: true,
22
+ get: function () { return e[k]; }
23
+ });
24
+ }
25
+ });
26
+ }
27
+ n["default"] = e;
28
+ return Object.freeze(n);
29
+ }
30
+
31
+ var fetch__default = /*#__PURE__*/_interopDefaultLegacy(fetch);
32
+ var uuid__namespace = /*#__PURE__*/_interopNamespace(uuid);
33
+
34
+ function readGerritConfig(id, config) {
35
+ var _a;
36
+ const branch = (_a = config.getOptionalString("branch")) != null ? _a : "master";
37
+ const host = config.getString("host");
38
+ const query = config.getString("query");
39
+ return {
40
+ branch,
41
+ host,
42
+ id,
43
+ query
44
+ };
45
+ }
46
+ function readGerritConfigs(config) {
47
+ const configs = [];
48
+ const providerConfigs = config.getOptionalConfig("catalog.providers.gerrit");
49
+ if (!providerConfigs) {
50
+ return configs;
51
+ }
52
+ for (const id of providerConfigs.keys()) {
53
+ configs.push(readGerritConfig(id, providerConfigs.getConfig(id)));
54
+ }
55
+ return configs;
56
+ }
57
+
58
+ class GerritEntityProvider {
59
+ static fromConfig(configRoot, options) {
60
+ const providerConfigs = readGerritConfigs(configRoot);
61
+ const integrations = integration.ScmIntegrations.fromConfig(configRoot).gerrit;
62
+ const providers = [];
63
+ providerConfigs.forEach((providerConfig) => {
64
+ const integration = integrations.byHost(providerConfig.host);
65
+ if (!integration) {
66
+ throw new errors.InputError(`No gerrit integration found that matches host ${providerConfig.host}`);
67
+ }
68
+ providers.push(new GerritEntityProvider(providerConfig, integration, options.logger, options.schedule));
69
+ });
70
+ return providers;
71
+ }
72
+ constructor(config, integration, logger, schedule) {
73
+ this.config = config;
74
+ this.integration = integration;
75
+ this.logger = logger.child({
76
+ target: this.getProviderName()
77
+ });
78
+ this.scheduleFn = this.createScheduleFn(schedule);
79
+ }
80
+ getProviderName() {
81
+ return `gerrit-provider:${this.config.id}`;
82
+ }
83
+ async connect(connection) {
84
+ this.connection = connection;
85
+ await this.scheduleFn();
86
+ }
87
+ createScheduleFn(schedule) {
88
+ return async () => {
89
+ const taskId = `${this.getProviderName()}:refresh`;
90
+ return schedule.run({
91
+ id: taskId,
92
+ fn: async () => {
93
+ const logger = this.logger.child({
94
+ class: GerritEntityProvider.prototype.constructor.name,
95
+ taskId,
96
+ taskInstanceId: uuid__namespace.v4()
97
+ });
98
+ try {
99
+ await this.refresh(logger);
100
+ } catch (error) {
101
+ logger.error(error);
102
+ }
103
+ }
104
+ });
105
+ };
106
+ }
107
+ async refresh(logger) {
108
+ if (!this.connection) {
109
+ throw new Error("Gerrit discovery connection not initialized");
110
+ }
111
+ let response;
112
+ const baseProjectApiUrl = integration.getGerritProjectsApiUrl(this.integration.config);
113
+ const projectQueryUrl = `${baseProjectApiUrl}?${this.config.query}`;
114
+ try {
115
+ response = await fetch__default["default"](projectQueryUrl, {
116
+ method: "GET",
117
+ ...integration.getGerritRequestOptions(this.integration.config)
118
+ });
119
+ } catch (e) {
120
+ throw new Error(`Failed to list Gerrit projects for query ${this.config.query}, ${e}`);
121
+ }
122
+ const gerritProjectsResponse = await integration.parseGerritJsonResponse(response);
123
+ const projects = Object.keys(gerritProjectsResponse);
124
+ const locations = projects.map((project) => this.createLocationSpec(project));
125
+ await this.connection.applyMutation({
126
+ type: "full",
127
+ entities: locations.map((location) => ({
128
+ locationKey: this.getProviderName(),
129
+ entity: pluginCatalogBackend.locationSpecToLocationEntity({ location })
130
+ }))
131
+ });
132
+ logger.info(`Found ${locations.length} locations.`);
133
+ }
134
+ createLocationSpec(project) {
135
+ return {
136
+ type: "url",
137
+ target: `${this.integration.config.gitilesBaseUrl}/${project}/+/refs/heads/${this.config.branch}/catalog-info.yaml`,
138
+ presence: "optional"
139
+ };
140
+ }
141
+ }
142
+
143
+ exports.GerritEntityProvider = GerritEntityProvider;
144
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/providers/config.ts","../src/providers/GerritEntityProvider.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 { Config } from '@backstage/config';\nimport { GerritProviderConfig } from './types';\n\nfunction readGerritConfig(id: string, config: Config): GerritProviderConfig {\n const branch = config.getOptionalString('branch') ?? 'master';\n const host = config.getString('host');\n const query = config.getString('query');\n\n return {\n branch,\n host,\n id,\n query,\n };\n}\n\nexport function readGerritConfigs(config: Config): GerritProviderConfig[] {\n const configs: GerritProviderConfig[] = [];\n\n const providerConfigs = config.getOptionalConfig('catalog.providers.gerrit');\n\n if (!providerConfigs) {\n return configs;\n }\n\n for (const id of providerConfigs.keys()) {\n configs.push(readGerritConfig(id, providerConfigs.getConfig(id)));\n }\n\n return configs;\n}\n","/*\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 { TaskRunner } from '@backstage/backend-tasks';\nimport { Config } from '@backstage/config';\nimport { InputError } from '@backstage/errors';\nimport {\n EntityProvider,\n EntityProviderConnection,\n LocationSpec,\n locationSpecToLocationEntity,\n} from '@backstage/plugin-catalog-backend';\nimport fetch, { Response } from 'node-fetch';\nimport {\n GerritIntegration,\n getGerritProjectsApiUrl,\n getGerritRequestOptions,\n parseGerritJsonResponse,\n ScmIntegrations,\n} from '@backstage/integration';\nimport * as uuid from 'uuid';\nimport { Logger } from 'winston';\n\nimport { readGerritConfigs } from './config';\nimport { GerritProjectQueryResult, GerritProviderConfig } from './types';\n\n/** @public */\nexport class GerritEntityProvider implements EntityProvider {\n private readonly config: GerritProviderConfig;\n private readonly integration: GerritIntegration;\n private readonly logger: Logger;\n private readonly scheduleFn: () => Promise<void>;\n private connection?: EntityProviderConnection;\n\n static fromConfig(\n configRoot: Config,\n options: {\n logger: Logger;\n schedule: TaskRunner;\n },\n ): GerritEntityProvider[] {\n const providerConfigs = readGerritConfigs(configRoot);\n const integrations = ScmIntegrations.fromConfig(configRoot).gerrit;\n const providers: GerritEntityProvider[] = [];\n\n providerConfigs.forEach(providerConfig => {\n const integration = integrations.byHost(providerConfig.host);\n if (!integration) {\n throw new InputError(\n `No gerrit integration found that matches host ${providerConfig.host}`,\n );\n }\n providers.push(\n new GerritEntityProvider(\n providerConfig,\n integration,\n options.logger,\n options.schedule,\n ),\n );\n });\n return providers;\n }\n\n private constructor(\n config: GerritProviderConfig,\n integration: GerritIntegration,\n logger: Logger,\n schedule: TaskRunner,\n ) {\n this.config = config;\n this.integration = integration;\n this.logger = logger.child({\n target: this.getProviderName(),\n });\n this.scheduleFn = this.createScheduleFn(schedule);\n }\n\n getProviderName(): string {\n return `gerrit-provider:${this.config.id}`;\n }\n\n async connect(connection: EntityProviderConnection): Promise<void> {\n this.connection = connection;\n await this.scheduleFn();\n }\n\n private createScheduleFn(schedule: TaskRunner): () => Promise<void> {\n return async () => {\n const taskId = `${this.getProviderName()}:refresh`;\n return schedule.run({\n id: taskId,\n fn: async () => {\n const logger = this.logger.child({\n class: GerritEntityProvider.prototype.constructor.name,\n taskId,\n taskInstanceId: uuid.v4(),\n });\n\n try {\n await this.refresh(logger);\n } catch (error) {\n logger.error(error);\n }\n },\n });\n };\n }\n\n async refresh(logger: Logger): Promise<void> {\n if (!this.connection) {\n throw new Error('Gerrit discovery connection not initialized');\n }\n\n let response: Response;\n\n const baseProjectApiUrl = getGerritProjectsApiUrl(this.integration.config);\n const projectQueryUrl = `${baseProjectApiUrl}?${this.config.query}`;\n try {\n response = await fetch(projectQueryUrl, {\n method: 'GET',\n ...getGerritRequestOptions(this.integration.config),\n });\n } catch (e) {\n throw new Error(\n `Failed to list Gerrit projects for query ${this.config.query}, ${e}`,\n );\n }\n const gerritProjectsResponse = (await parseGerritJsonResponse(\n response as any,\n )) as GerritProjectQueryResult;\n const projects = Object.keys(gerritProjectsResponse);\n\n const locations = projects.map(project => this.createLocationSpec(project));\n await this.connection.applyMutation({\n type: 'full',\n entities: locations.map(location => ({\n locationKey: this.getProviderName(),\n entity: locationSpecToLocationEntity({ location }),\n })),\n });\n logger.info(`Found ${locations.length} locations.`);\n }\n\n private createLocationSpec(project: string): LocationSpec {\n return {\n type: 'url',\n target: `${this.integration.config.gitilesBaseUrl}/${project}/+/refs/heads/${this.config.branch}/catalog-info.yaml`,\n presence: 'optional',\n };\n }\n}\n"],"names":["ScmIntegrations","InputError","uuid","getGerritProjectsApiUrl","fetch","getGerritRequestOptions","parseGerritJsonResponse","locationSpecToLocationEntity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE;AACtC,EAAE,IAAI,EAAE,CAAC;AACT,EAAE,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,IAAI,GAAG,EAAE,GAAG,QAAQ,CAAC;AACnF,EAAE,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AACxC,EAAE,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AAC1C,EAAE,OAAO;AACT,IAAI,MAAM;AACV,IAAI,IAAI;AACR,IAAI,EAAE;AACN,IAAI,KAAK;AACT,GAAG,CAAC;AACJ,CAAC;AACM,SAAS,iBAAiB,CAAC,MAAM,EAAE;AAC1C,EAAE,MAAM,OAAO,GAAG,EAAE,CAAC;AACrB,EAAE,MAAM,eAAe,GAAG,MAAM,CAAC,iBAAiB,CAAC,0BAA0B,CAAC,CAAC;AAC/E,EAAE,IAAI,CAAC,eAAe,EAAE;AACxB,IAAI,OAAO,OAAO,CAAC;AACnB,GAAG;AACH,EAAE,KAAK,MAAM,EAAE,IAAI,eAAe,CAAC,IAAI,EAAE,EAAE;AAC3C,IAAI,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,EAAE,eAAe,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACtE,GAAG;AACH,EAAE,OAAO,OAAO,CAAC;AACjB;;ACTO,MAAM,oBAAoB,CAAC;AAClC,EAAE,OAAO,UAAU,CAAC,UA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AAM,EAAE,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC;AACzH,MAAM,QAAQ,EAAE,UAAU;AAC1B,KAAK,CAAC;AACN,GAAG;AACH;;;;"}
@@ -0,0 +1,25 @@
1
+ import { TaskRunner } from '@backstage/backend-tasks';
2
+ import { Config } from '@backstage/config';
3
+ import { EntityProvider, EntityProviderConnection } from '@backstage/plugin-catalog-backend';
4
+ import { Logger } from 'winston';
5
+
6
+ /** @public */
7
+ declare class GerritEntityProvider implements EntityProvider {
8
+ private readonly config;
9
+ private readonly integration;
10
+ private readonly logger;
11
+ private readonly scheduleFn;
12
+ private connection?;
13
+ static fromConfig(configRoot: Config, options: {
14
+ logger: Logger;
15
+ schedule: TaskRunner;
16
+ }): GerritEntityProvider[];
17
+ private constructor();
18
+ getProviderName(): string;
19
+ connect(connection: EntityProviderConnection): Promise<void>;
20
+ private createScheduleFn;
21
+ refresh(logger: Logger): Promise<void>;
22
+ private createLocationSpec;
23
+ }
24
+
25
+ export { GerritEntityProvider };
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@backstage/plugin-catalog-backend-module-gerrit",
3
+ "version": "0.0.0-nightly-20220422024928",
4
+ "main": "dist/index.esm.js",
5
+ "types": "dist/index.d.ts",
6
+ "license": "Apache-2.0",
7
+ "publishConfig": {
8
+ "access": "public",
9
+ "main": "dist/index.esm.js",
10
+ "types": "dist/index.d.ts"
11
+ },
12
+ "backstage": {
13
+ "role": "backend-plugin-module"
14
+ },
15
+ "homepage": "https://backstage.io",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/backstage/backstage",
19
+ "directory": "plugins/catalog-backend-module-gerrit"
20
+ },
21
+ "scripts": {
22
+ "start": "backstage-cli package start",
23
+ "build": "backstage-cli package build",
24
+ "lint": "backstage-cli package lint",
25
+ "test": "backstage-cli package test",
26
+ "clean": "backstage-cli package clean",
27
+ "prepack": "backstage-cli package prepack",
28
+ "postpack": "backstage-cli package postpack"
29
+ },
30
+ "dependencies": {
31
+ "@backstage/backend-common": "^0.0.0-nightly-20220422024928",
32
+ "@backstage/backend-tasks": "^0.3.0",
33
+ "@backstage/catalog-model": "^1.0.1",
34
+ "@backstage/config": "^1.0.0",
35
+ "@backstage/errors": "^1.0.0",
36
+ "@backstage/integration": "^0.0.0-nightly-20220422024928",
37
+ "@backstage/plugin-catalog-backend": "^0.0.0-nightly-20220422024928",
38
+ "fs-extra": "10.0.1",
39
+ "msw": "^0.35.0",
40
+ "node-fetch": "^2.6.7",
41
+ "uuid": "^8.0.0",
42
+ "winston": "^3.2.1"
43
+ },
44
+ "devDependencies": {
45
+ "@backstage/backend-test-utils": "^0.1.23",
46
+ "@backstage/cli": "^0.0.0-nightly-20220422024928",
47
+ "@types/fs-extra": "^9.0.1"
48
+ },
49
+ "files": [
50
+ "dist",
51
+ "config.d.ts"
52
+ ],
53
+ "configSchema": "config.d.ts"
54
+ }