@backstage/plugin-catalog-backend-module-gitlab 0.4.3-next.0 → 0.4.3-next.2

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 CHANGED
@@ -1,5 +1,33 @@
1
1
  # @backstage/plugin-catalog-backend-module-gitlab
2
2
 
3
+ ## 0.4.3-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+ - @backstage/backend-defaults@0.5.1-next.2
9
+ - @backstage/plugin-catalog-node@1.13.1-next.1
10
+ - @backstage/integration@1.15.1-next.1
11
+ - @backstage/backend-plugin-api@1.0.1-next.1
12
+ - @backstage/catalog-model@1.7.0
13
+ - @backstage/config@1.2.0
14
+ - @backstage/plugin-catalog-common@1.1.0
15
+ - @backstage/plugin-events-node@0.4.1-next.1
16
+
17
+ ## 0.4.3-next.1
18
+
19
+ ### Patch Changes
20
+
21
+ - Updated dependencies
22
+ - @backstage/backend-defaults@0.5.1-next.1
23
+ - @backstage/integration@1.15.1-next.0
24
+ - @backstage/backend-plugin-api@1.0.1-next.0
25
+ - @backstage/catalog-model@1.7.0
26
+ - @backstage/config@1.2.0
27
+ - @backstage/plugin-catalog-common@1.1.0
28
+ - @backstage/plugin-catalog-node@1.13.1-next.0
29
+ - @backstage/plugin-events-node@0.4.1-next.0
30
+
3
31
  ## 0.4.3-next.0
4
32
 
5
33
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-catalog-backend-module-gitlab__alpha",
3
- "version": "0.4.3-next.0",
3
+ "version": "0.4.3-next.2",
4
4
  "main": "../dist/alpha.cjs.js",
5
5
  "types": "../dist/alpha.d.ts"
6
6
  }
@@ -0,0 +1,131 @@
1
+ 'use strict';
2
+
3
+ var integration = require('@backstage/integration');
4
+ var pluginCatalogNode = require('@backstage/plugin-catalog-node');
5
+ require('@backstage/backend-plugin-api');
6
+ var client = require('./lib/client.cjs.js');
7
+ var cache = require('@backstage/backend-defaults/cache');
8
+
9
+ class GitLabDiscoveryProcessor {
10
+ integrations;
11
+ logger;
12
+ cache;
13
+ skipReposWithoutExactFileMatch;
14
+ skipForkedRepos;
15
+ static fromConfig(config, options) {
16
+ const integrations = integration.ScmIntegrations.fromConfig(config);
17
+ const pluginCache = cache.CacheManager.fromConfig(config).forPlugin("gitlab-discovery");
18
+ return new GitLabDiscoveryProcessor({
19
+ ...options,
20
+ integrations,
21
+ pluginCache
22
+ });
23
+ }
24
+ constructor(options) {
25
+ this.integrations = options.integrations;
26
+ this.cache = options.pluginCache;
27
+ this.logger = options.logger;
28
+ this.skipReposWithoutExactFileMatch = options.skipReposWithoutExactFileMatch || false;
29
+ this.skipForkedRepos = options.skipForkedRepos || false;
30
+ }
31
+ getProcessorName() {
32
+ return "GitLabDiscoveryProcessor";
33
+ }
34
+ async readLocation(location, _optional, emit) {
35
+ if (location.type !== "gitlab-discovery") {
36
+ return false;
37
+ }
38
+ const startTime = /* @__PURE__ */ new Date();
39
+ const { group, host, branch, catalogPath } = parseUrl(location.target);
40
+ const integration = this.integrations.gitlab.byUrl(`https://${host}`);
41
+ if (!integration) {
42
+ throw new Error(
43
+ `There is no GitLab integration that matches ${host}. Please add a configuration entry for it under integrations.gitlab`
44
+ );
45
+ }
46
+ const client$1 = new client.GitLabClient({
47
+ config: integration.config,
48
+ logger: this.logger
49
+ });
50
+ this.logger.debug(`Reading GitLab projects from ${location.target}`);
51
+ const lastActivity = await this.cache.get(this.getCacheKey());
52
+ const opts = {
53
+ archived: false,
54
+ group,
55
+ page: 1,
56
+ // We check for the existence of lastActivity and only set it if it's present to ensure
57
+ // that the options doesn't include the key so that the API doesn't receive an empty query parameter.
58
+ ...lastActivity && { last_activity_after: lastActivity }
59
+ };
60
+ const projects = client.paginated((options) => client$1.listProjects(options), opts);
61
+ const res = {
62
+ scanned: 0,
63
+ matches: []
64
+ };
65
+ for await (const project of projects) {
66
+ res.scanned++;
67
+ if (branch === "*" && project.default_branch === void 0) {
68
+ continue;
69
+ }
70
+ if (this.skipReposWithoutExactFileMatch) {
71
+ const project_branch = branch === "*" ? project.default_branch : branch;
72
+ const projectHasFile = await client$1.hasFile(
73
+ project.path_with_namespace,
74
+ project_branch,
75
+ catalogPath
76
+ );
77
+ if (!projectHasFile) {
78
+ continue;
79
+ }
80
+ }
81
+ if (this.skipForkedRepos && project.hasOwnProperty("forked_from_project")) {
82
+ continue;
83
+ }
84
+ res.matches.push(project);
85
+ }
86
+ for (const project of res.matches) {
87
+ const project_branch = branch === "*" ? project.default_branch : branch;
88
+ emit(
89
+ pluginCatalogNode.processingResult.location({
90
+ type: "url",
91
+ // The format expected by the GitLabUrlReader:
92
+ // https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/filepath
93
+ //
94
+ // This unfortunately will trigger another API call in `getGitLabFileFetchUrl` to get the project ID.
95
+ // The alternative is using the `buildRawUrl` function, which does not support subgroups, so providing a raw
96
+ // URL here won't work either.
97
+ target: `${project.web_url}/-/blob/${project_branch}/${catalogPath}`,
98
+ presence: "optional"
99
+ })
100
+ );
101
+ }
102
+ await this.cache.set(this.getCacheKey(), startTime.toISOString());
103
+ const duration = ((Date.now() - startTime.getTime()) / 1e3).toFixed(1);
104
+ this.logger.debug(
105
+ `Read ${res.scanned} GitLab repositories in ${duration} seconds`
106
+ );
107
+ return true;
108
+ }
109
+ getCacheKey() {
110
+ return `processors/${this.getProcessorName()}/last-activity`;
111
+ }
112
+ }
113
+ function parseUrl(urlString) {
114
+ const url = new URL(urlString);
115
+ const path = url.pathname.slice(1).split("/");
116
+ const blobIndex = path.findIndex((p) => p === "blob");
117
+ if (blobIndex !== -1 && path.length > blobIndex + 2) {
118
+ const group = blobIndex > 0 ? path.slice(0, blobIndex).join("/") : void 0;
119
+ return {
120
+ group,
121
+ host: url.host,
122
+ branch: decodeURIComponent(path[blobIndex + 1]),
123
+ catalogPath: decodeURIComponent(path.slice(blobIndex + 2).join("/"))
124
+ };
125
+ }
126
+ throw new Error(`Failed to parse ${urlString}`);
127
+ }
128
+
129
+ exports.GitLabDiscoveryProcessor = GitLabDiscoveryProcessor;
130
+ exports.parseUrl = parseUrl;
131
+ //# sourceMappingURL=GitLabDiscoveryProcessor.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitLabDiscoveryProcessor.cjs.js","sources":["../src/GitLabDiscoveryProcessor.ts"],"sourcesContent":["/*\n * Copyright 2021 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 {\n ScmIntegrationRegistry,\n ScmIntegrations,\n} from '@backstage/integration';\nimport {\n CatalogProcessor,\n CatalogProcessorEmit,\n LocationSpec,\n processingResult,\n} from '@backstage/plugin-catalog-node';\nimport { GitLabClient, GitLabProject, paginated } from './lib';\nimport { CacheService, LoggerService } from '@backstage/backend-plugin-api';\nimport { CacheManager } from '@backstage/backend-defaults/cache';\n\n/**\n * Extracts repositories out of an GitLab instance.\n * @public\n */\nexport class GitLabDiscoveryProcessor implements CatalogProcessor {\n private readonly integrations: ScmIntegrationRegistry;\n private readonly logger: LoggerService;\n private readonly cache: CacheService;\n private readonly skipReposWithoutExactFileMatch: boolean;\n private readonly skipForkedRepos: boolean;\n\n static fromConfig(\n config: Config,\n options: {\n logger: LoggerService;\n skipReposWithoutExactFileMatch?: boolean;\n skipForkedRepos?: boolean;\n },\n ): GitLabDiscoveryProcessor {\n const integrations = ScmIntegrations.fromConfig(config);\n const pluginCache =\n CacheManager.fromConfig(config).forPlugin('gitlab-discovery');\n\n return new GitLabDiscoveryProcessor({\n ...options,\n integrations,\n pluginCache,\n });\n }\n\n private constructor(options: {\n integrations: ScmIntegrationRegistry;\n pluginCache: CacheService;\n logger: LoggerService;\n skipReposWithoutExactFileMatch?: boolean;\n skipForkedRepos?: boolean;\n }) {\n this.integrations = options.integrations;\n this.cache = options.pluginCache;\n this.logger = options.logger;\n this.skipReposWithoutExactFileMatch =\n options.skipReposWithoutExactFileMatch || false;\n this.skipForkedRepos = options.skipForkedRepos || false;\n }\n\n getProcessorName(): string {\n return 'GitLabDiscoveryProcessor';\n }\n\n async readLocation(\n location: LocationSpec,\n _optional: boolean,\n emit: CatalogProcessorEmit,\n ): Promise<boolean> {\n if (location.type !== 'gitlab-discovery') {\n return false;\n }\n\n const startTime = new Date();\n const { group, host, branch, catalogPath } = parseUrl(location.target);\n\n const integration = this.integrations.gitlab.byUrl(`https://${host}`);\n if (!integration) {\n throw new Error(\n `There is no GitLab integration that matches ${host}. Please add a configuration entry for it under integrations.gitlab`,\n );\n }\n\n const client = new GitLabClient({\n config: integration.config,\n logger: this.logger,\n });\n this.logger.debug(`Reading GitLab projects from ${location.target}`);\n\n const lastActivity = (await this.cache.get(this.getCacheKey())) as string;\n const opts = {\n archived: false,\n group,\n page: 1,\n // We check for the existence of lastActivity and only set it if it's present to ensure\n // that the options doesn't include the key so that the API doesn't receive an empty query parameter.\n ...(lastActivity && { last_activity_after: lastActivity }),\n };\n\n const projects = paginated(options => client.listProjects(options), opts);\n\n const res: Result = {\n scanned: 0,\n matches: [],\n };\n for await (const project of projects) {\n res.scanned++;\n\n if (branch === '*' && project.default_branch === undefined) {\n continue;\n }\n\n if (this.skipReposWithoutExactFileMatch) {\n const project_branch = branch === '*' ? project.default_branch : branch;\n\n const projectHasFile: boolean = await client.hasFile(\n project.path_with_namespace,\n project_branch,\n catalogPath,\n );\n\n if (!projectHasFile) {\n continue;\n }\n }\n\n if (\n this.skipForkedRepos &&\n project.hasOwnProperty('forked_from_project')\n ) {\n continue;\n }\n\n res.matches.push(project);\n }\n\n for (const project of res.matches) {\n const project_branch = branch === '*' ? project.default_branch : branch;\n\n emit(\n processingResult.location({\n type: 'url',\n // The format expected by the GitLabUrlReader:\n // https://gitlab.com/groupA/teams/teamA/subgroupA/repoA/-/blob/branch/filepath\n //\n // This unfortunately will trigger another API call in `getGitLabFileFetchUrl` to get the project ID.\n // The alternative is using the `buildRawUrl` function, which does not support subgroups, so providing a raw\n // URL here won't work either.\n target: `${project.web_url}/-/blob/${project_branch}/${catalogPath}`,\n presence: 'optional',\n }),\n );\n }\n\n // Save an ISO formatted string in the cache as that's what GitLab expects in the API request.\n await this.cache.set(this.getCacheKey(), startTime.toISOString());\n\n const duration = ((Date.now() - startTime.getTime()) / 1000).toFixed(1);\n this.logger.debug(\n `Read ${res.scanned} GitLab repositories in ${duration} seconds`,\n );\n\n return true;\n }\n\n private getCacheKey(): string {\n return `processors/${this.getProcessorName()}/last-activity`;\n }\n}\n\ntype Result = {\n scanned: number;\n matches: GitLabProject[];\n};\n\n/*\n * Helpers\n */\n\nexport function parseUrl(urlString: string): {\n group?: string;\n host: string;\n branch: string;\n catalogPath: string;\n} {\n const url = new URL(urlString);\n const path = url.pathname.slice(1).split('/');\n\n // (/group/subgroup)/blob/branch|*/filepath\n const blobIndex = path.findIndex(p => p === 'blob');\n if (blobIndex !== -1 && path.length > blobIndex + 2) {\n const group =\n blobIndex > 0 ? path.slice(0, blobIndex).join('/') : undefined;\n\n return {\n group,\n host: url.host,\n branch: decodeURIComponent(path[blobIndex + 1]),\n catalogPath: decodeURIComponent(path.slice(blobIndex + 2).join('/')),\n };\n }\n\n throw new Error(`Failed to parse ${urlString}`);\n}\n"],"names":["ScmIntegrations","CacheManager","client","GitLabClient","paginated","processingResult"],"mappings":";;;;;;;;AAmCO,MAAM,wBAAqD,CAAA;AAAA,EAC/C,YAAA,CAAA;AAAA,EACA,MAAA,CAAA;AAAA,EACA,KAAA,CAAA;AAAA,EACA,8BAAA,CAAA;AAAA,EACA,eAAA,CAAA;AAAA,EAEjB,OAAO,UACL,CAAA,MA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,WAAsB,GAAA;AAC5B,IAAO,OAAA,CAAA,WAAA,EAAc,IAAK,CAAA,gBAAA,EAAkB,CAAA,cAAA,CAAA,CAAA;AAAA,GAC9C;AACF,CAAA;AAWO,SAAS,SAAS,SAKvB,EAAA;AACA,EAAM,MAAA,GAAA,GAAM,IAAI,GAAA,CAAI,SAAS,CAAA,CAAA;AAC7B,EAAA,MAAM,OAAO,GAAI,CAAA,QAAA,CAAS,MAAM,CAAC,CAAA,CAAE,MAAM,GAAG,CAAA,CAAA;AAG5C,EAAA,MAAM,SAAY,GAAA,IAAA,CAAK,SAAU,CAAA,CAAA,CAAA,KAAK,MAAM,MAAM,CAAA,CAAA;AAClD,EAAA,IAAI,SAAc,KAAA,CAAA,CAAA,IAAM,IAAK,CAAA,MAAA,GAAS,YAAY,CAAG,EAAA;AACnD,IAAM,MAAA,KAAA,GACJ,SAAY,GAAA,CAAA,GAAI,IAAK,CAAA,KAAA,CAAM,GAAG,SAAS,CAAA,CAAE,IAAK,CAAA,GAAG,CAAI,GAAA,KAAA,CAAA,CAAA;AAEvD,IAAO,OAAA;AAAA,MACL,KAAA;AAAA,MACA,MAAM,GAAI,CAAA,IAAA;AAAA,MACV,MAAQ,EAAA,kBAAA,CAAmB,IAAK,CAAA,SAAA,GAAY,CAAC,CAAC,CAAA;AAAA,MAC9C,WAAA,EAAa,mBAAmB,IAAK,CAAA,KAAA,CAAM,YAAY,CAAC,CAAA,CAAE,IAAK,CAAA,GAAG,CAAC,CAAA;AAAA,KACrE,CAAA;AAAA,GACF;AAEA,EAAA,MAAM,IAAI,KAAA,CAAM,CAAmB,gBAAA,EAAA,SAAS,CAAE,CAAA,CAAA,CAAA;AAChD;;;;;"}
package/dist/alpha.cjs.js CHANGED
@@ -2,41 +2,9 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var backendPluginApi = require('@backstage/backend-plugin-api');
6
- var alpha = require('@backstage/plugin-catalog-node/alpha');
7
- var pluginEventsNode = require('@backstage/plugin-events-node');
8
- var GitlabDiscoveryEntityProvider = require('./cjs/GitlabDiscoveryEntityProvider-BBXRz42v.cjs.js');
9
- require('@backstage/catalog-model');
10
- require('@backstage/integration');
11
- require('lodash');
12
- require('uuid');
13
- require('node-fetch');
14
- require('@backstage/plugin-catalog-node');
15
- require('path');
5
+ var catalogModuleGitlabDiscoveryEntityProvider = require('./module/catalogModuleGitlabDiscoveryEntityProvider.cjs.js');
16
6
 
17
- const catalogModuleGitlabDiscoveryEntityProvider = backendPluginApi.createBackendModule({
18
- pluginId: "catalog",
19
- moduleId: "gitlab-discovery-entity-provider",
20
- register(env) {
21
- env.registerInit({
22
- deps: {
23
- config: backendPluginApi.coreServices.rootConfig,
24
- catalog: alpha.catalogProcessingExtensionPoint,
25
- logger: backendPluginApi.coreServices.logger,
26
- scheduler: backendPluginApi.coreServices.scheduler,
27
- events: pluginEventsNode.eventsServiceRef
28
- },
29
- async init({ config, catalog, logger, scheduler, events }) {
30
- const gitlabDiscoveryEntityProvider = GitlabDiscoveryEntityProvider.GitlabDiscoveryEntityProvider.fromConfig(config, {
31
- logger,
32
- events,
33
- scheduler
34
- });
35
- catalog.addEntityProvider(gitlabDiscoveryEntityProvider);
36
- }
37
- });
38
- }
39
- });
40
7
 
41
- exports.default = catalogModuleGitlabDiscoveryEntityProvider;
8
+
9
+ exports.default = catalogModuleGitlabDiscoveryEntityProvider.catalogModuleGitlabDiscoveryEntityProvider;
42
10
  //# sourceMappingURL=alpha.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.cjs.js","sources":["../src/module/catalogModuleGitlabDiscoveryEntityProvider.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 { eventsServiceRef } from '@backstage/plugin-events-node';\nimport { GitlabDiscoveryEntityProvider } from '../providers';\n\n/**\n * Registers the GitlabDiscoveryEntityProvider with the catalog processing extension point.\n *\n * @alpha\n */\n\nexport const catalogModuleGitlabDiscoveryEntityProvider = createBackendModule({\n pluginId: 'catalog',\n moduleId: 'gitlab-discovery-entity-provider',\n register(env) {\n env.registerInit({\n deps: {\n config: coreServices.rootConfig,\n catalog: catalogProcessingExtensionPoint,\n logger: coreServices.logger,\n scheduler: coreServices.scheduler,\n events: eventsServiceRef,\n },\n async init({ config, catalog, logger, scheduler, events }) {\n const gitlabDiscoveryEntityProvider =\n GitlabDiscoveryEntityProvider.fromConfig(config, {\n logger,\n events,\n scheduler,\n });\n catalog.addEntityProvider(gitlabDiscoveryEntityProvider);\n },\n });\n },\n});\n"],"names":["createBackendModule","coreServices","catalogProcessingExtensionPoint","eventsServiceRef","GitlabDiscoveryEntityProvider"],"mappings":";;;;;;;;;;;;;;;;AA8BO,MAAM,6CAA6CA,oCAAoB,CAAA;AAAA,EAC5E,QAAU,EAAA,SAAA;AAAA,EACV,QAAU,EAAA,kCAAA;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,SAAA;AAAA,QACxB,MAAQ,EAAAE,iCAAA;AAAA,OACV;AAAA,MACA,MAAM,KAAK,EAAE,MAAA,EAAQ,SAAS,MAAQ,EAAA,SAAA,EAAW,QAAU,EAAA;AACzD,QAAM,MAAA,6BAAA,GACJC,2DAA8B,CAAA,UAAA,CAAW,MAAQ,EAAA;AAAA,UAC/C,MAAA;AAAA,UACA,MAAA;AAAA,UACA,SAAA;AAAA,SACD,CAAA,CAAA;AACH,QAAA,OAAA,CAAQ,kBAAkB,6BAA6B,CAAA,CAAA;AAAA,OACzD;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"alpha.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}