Merge pull request #20361 from backstage/djam/github-org

chore: move catalogModuleGithubOrgEntityProvider to its own backend module
This commit is contained in:
Djam
2023-10-10 12:00:44 +02:00
committed by GitHub
13 changed files with 155 additions and 26 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-github-org': minor
---
Added `catalogModuleGithubOrgEntityProvider` to ingest users and teams from multiple Github organizations.
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-catalog-backend-module-github': patch
---
Removed `catalogModuleGithubOrgEntityProvider`. Import from `@backstage/plugin-catalog-backend-module-github-org` instead.
@@ -0,0 +1 @@
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname);
@@ -0,0 +1,5 @@
# @backstage/plugin-catalog-backend-module-github-org
The github-org backend module for the catalog plugin.
_This plugin was created through the Backstage CLI_
@@ -0,0 +1,30 @@
## API Report File for "@backstage/plugin-catalog-backend-module-github-org"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { BackendFeature } from '@backstage/backend-plugin-api';
import { ExtensionPoint } from '@backstage/backend-plugin-api';
import { GithubMultiOrgEntityProvider } from '@backstage/plugin-catalog-backend-module-github';
import { TeamTransformer } from '@backstage/plugin-catalog-backend-module-github';
import { UserTransformer } from '@backstage/plugin-catalog-backend-module-github';
// @public
const catalogModuleGithubOrgEntityProvider: () => BackendFeature;
export default catalogModuleGithubOrgEntityProvider;
export { GithubMultiOrgEntityProvider };
// @public
export interface GithubOrgEntityProviderTransformsExtensionPoint {
setTeamTransformer(transformer: TeamTransformer): void;
setUserTransformer(transformer: UserTransformer): void;
}
// @public
export const githubOrgEntityProviderTransformsExtensionPoint: ExtensionPoint<GithubOrgEntityProviderTransformsExtensionPoint>;
export { TeamTransformer };
export { UserTransformer };
```
@@ -0,0 +1,10 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: backstage-plugin-catalog-backend-module-github-org
title: '@backstage/plugin-catalog-backend-module-github-org'
description: A Backstage catalog backend module that ingests users and teams from multiple Github organizations
spec:
lifecycle: experimental
type: backstage-backend-plugin-module
owner: catalog-maintainers
@@ -0,0 +1,41 @@
{
"name": "@backstage/plugin-catalog-backend-module-github-org",
"description": "The github-org backend module for the catalog plugin.",
"version": "0.0.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
},
"backstage": {
"role": "backend-plugin-module"
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test",
"clean": "backstage-cli package clean",
"prepack": "backstage-cli package prepack",
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/backend-tasks": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/plugin-catalog-backend-module-github": "workspace:^",
"@backstage/plugin-catalog-node": "workspace:^"
},
"devDependencies": {
"@backstage/backend-test-utils": "workspace:^",
"@backstage/cli": "workspace:^",
"luxon": "^3.0.0"
},
"files": [
"dist"
]
}
@@ -0,0 +1,36 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* The github-org backend module for the catalog plugin.
*
* @packageDocumentation
*/
export {
catalogModuleGithubOrgEntityProvider as default,
type GithubOrgEntityProviderTransformsExtensionPoint,
githubOrgEntityProviderTransformsExtensionPoint,
} from './module';
/**
*
* TODO(djamaile): GithubMultiOrgEntityProvider should be mirgated over to this module.
* Afterwards, mark it as deprecated in catalog-backend-module-github and export them there from this module.
*/
export {
GithubMultiOrgEntityProvider,
type TeamTransformer,
type UserTransformer,
} from '@backstage/plugin-catalog-backend-module-github';
@@ -19,7 +19,7 @@ import { mockServices, startTestBackend } from '@backstage/backend-test-utils';
import { EntityProvider } from '@backstage/plugin-catalog-node';
import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/alpha';
import { Duration } from 'luxon';
import { catalogModuleGithubOrgEntityProvider } from './catalogModuleGithubOrgEntityProvider';
import { catalogModuleGithubOrgEntityProvider } from './module';
describe('catalogModuleGithubOrgEntityProvider', () => {
it('should register provider at the catalog extension point', async () => {
@@ -35,7 +35,7 @@ import { catalogProcessingExtensionPoint } from '@backstage/plugin-catalog-node/
/**
* Interface for {@link githubOrgEntityProviderTransformsExtensionPoint}.
*
* @alpha
* @public
*/
export interface GithubOrgEntityProviderTransformsExtensionPoint {
/**
@@ -52,9 +52,9 @@ export interface GithubOrgEntityProviderTransformsExtensionPoint {
}
/**
* Extension point for runtime configuration of {@link catalogModuleGithubOrgEntityProvider}.
* Extension point for runtime configuration of catalogModuleGithubOrgEntityProvider.
*
* @alpha
* @public
*/
export const githubOrgEntityProviderTransformsExtensionPoint =
createExtensionPoint<GithubOrgEntityProviderTransformsExtensionPoint>({
@@ -64,7 +64,7 @@ export const githubOrgEntityProviderTransformsExtensionPoint =
/**
* Registers the `GithubMultiOrgEntityProvider` with the catalog processing extension point.
*
* @alpha
* @public
*/
export const catalogModuleGithubOrgEntityProvider = createBackendModule({
pluginId: 'catalog',
@@ -4,25 +4,10 @@
```ts
import { BackendFeature } from '@backstage/backend-plugin-api';
import { ExtensionPoint } from '@backstage/backend-plugin-api';
import { TeamTransformer } from '@backstage/plugin-catalog-backend-module-github';
import { UserTransformer } from '@backstage/plugin-catalog-backend-module-github';
// @alpha
const catalogModuleGithubEntityProvider: () => BackendFeature;
export default catalogModuleGithubEntityProvider;
// @alpha
export const catalogModuleGithubOrgEntityProvider: () => BackendFeature;
// @alpha
export interface GithubOrgEntityProviderTransformsExtensionPoint {
setTeamTransformer(transformer: TeamTransformer): void;
setUserTransformer(transformer: UserTransformer): void;
}
// @alpha
export const githubOrgEntityProviderTransformsExtensionPoint: ExtensionPoint<GithubOrgEntityProviderTransformsExtensionPoint>;
// (No @packageDocumentation comment for this package)
```
@@ -15,8 +15,3 @@
*/
export { catalogModuleGithubEntityProvider as default } from './catalogModuleGithubEntityProvider';
export {
catalogModuleGithubOrgEntityProvider,
githubOrgEntityProviderTransformsExtensionPoint,
type GithubOrgEntityProviderTransformsExtensionPoint,
} from './catalogModuleGithubOrgEntityProvider';
+17 -1
View File
@@ -5484,7 +5484,23 @@ __metadata:
languageName: unknown
linkType: soft
"@backstage/plugin-catalog-backend-module-github@workspace:plugins/catalog-backend-module-github":
"@backstage/plugin-catalog-backend-module-github-org@workspace:plugins/catalog-backend-module-github-org":
version: 0.0.0-use.local
resolution: "@backstage/plugin-catalog-backend-module-github-org@workspace:plugins/catalog-backend-module-github-org"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-tasks": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
"@backstage/plugin-catalog-backend-module-github": "workspace:^"
"@backstage/plugin-catalog-node": "workspace:^"
luxon: ^3.0.0
languageName: unknown
linkType: soft
"@backstage/plugin-catalog-backend-module-github@workspace:^, @backstage/plugin-catalog-backend-module-github@workspace:plugins/catalog-backend-module-github":
version: 0.0.0-use.local
resolution: "@backstage/plugin-catalog-backend-module-github@workspace:plugins/catalog-backend-module-github"
dependencies: