Merge pull request #22323 from backstage/blam/scaffolder-modules

scaffolder: Migrate the modules to new Backend System
This commit is contained in:
Ben Lambert
2024-01-23 13:46:09 +01:00
committed by GitHub
49 changed files with 847 additions and 39 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-scaffolder-backend-module-rails': patch
---
Make `containerRunner` argument optional
+14
View File
@@ -0,0 +1,14 @@
---
'@backstage/plugin-scaffolder-backend-module-confluence-to-markdown': patch
'@backstage/plugin-scaffolder-backend-module-cookiecutter': patch
'@backstage/plugin-scaffolder-backend-module-bitbucket': patch
'@backstage/plugin-scaffolder-backend-module-gerrit': patch
'@backstage/plugin-scaffolder-backend-module-github': patch
'@backstage/plugin-scaffolder-backend-module-gitlab': patch
'@backstage/plugin-scaffolder-backend-module-sentry': patch
'@backstage/plugin-scaffolder-backend-module-yeoman': patch
'@backstage/plugin-scaffolder-backend-module-azure': patch
'@backstage/plugin-scaffolder-backend-module-rails': patch
---
Exporting a default module for the new Backend System
+16
View File
@@ -0,0 +1,16 @@
---
'@backstage/plugin-scaffolder-backend': minor
---
The built-in module list has been trimmed down when using the new Backend System. Provider specific modules should now be installed with `backend.add` to provide additional actions to the scaffolder. These modules are as follows:
- `@backstage/plugin-scaffolder-backend-module-github`
- `@backstage/plugin-scaffolder-backend-module-gitlab`
- `@backstage/plugin-scaffolder-backend-module-bitbucket`
- `@backstage/plugin-scaffolder-backend-module-gitea`
- `@backstage/plugin-scaffolder-backend-module-gerrit`
- `@backstage/plugin-scaffolder-backend-module-confluence-to-markdown`
- `@backstage/plugin-scaffolder-backend-module-cookiecutter`
- `@backstage/plugin-scaffolder-backend-module-rails`
- `@backstage/plugin-scaffolder-backend-module-sentry`
- `@backstage/plugin-scaffolder-backend-module-yeoman`
@@ -700,6 +700,26 @@ const backend = createBackend();
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
```
With the new Backend System version of the Scaffolder plugin, any provider specific actions will need to be installed separately.
For example - GitHub actions are now collected under the `@backstage/plugin-scaffolder-backend-module-github` package.
```ts title="packages/backend/src/index.ts"
const backend = createBackend();
backend.add(import('@backstage/plugin-scaffolder-backend/alpha'));
/* highlight-add-next-line */
backend.add(import('@backstage/plugin-scaffolder-backend-module-github'));
```
And of course you'll need to install those separately as well.
```bash
# from the repository root
yarn add --cwd packages/backend @backstage/plugin-scaffolder-backend-module-github
```
You can find a list of the available modules under the [plugins directory](https://github.com/backstage/backstage/tree/master/plugins) in the monorepo.
If you have other customizations made to `plugins/scaffolder.ts`, such as adding
custom actions, read on. Otherwise, you should be able to just delete that file
at this point.
@@ -3,11 +3,16 @@
> 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 { Config } from '@backstage/config';
import { JsonObject } from '@backstage/types';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
// @public
const azureModule: () => BackendFeature;
export default azureModule;
// @public
export function createPublishAzureAction(options: {
integrations: ScmIntegrationRegistry;
@@ -6,13 +6,22 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
@@ -24,6 +33,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
@@ -21,3 +21,4 @@
*/
export * from './actions';
export { azureModule as default } from './module';
@@ -0,0 +1,48 @@
/*
* Copyright 2024 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.
*/
import {
createBackendModule,
coreServices,
} from '@backstage/backend-plugin-api';
import { ScmIntegrations } from '@backstage/integration';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import { createPublishAzureAction } from './actions';
/**
* @public
* The Azure Module for the Scaffolder Backend
*/
export const azureModule = createBackendModule({
moduleId: 'azure',
pluginId: 'scaffolder',
register({ registerInit }) {
registerInit({
deps: {
scaffolderActions: scaffolderActionsExtensionPoint,
config: coreServices.rootConfig,
},
async init({ scaffolderActions, config }) {
const integrations = ScmIntegrations.fromConfig(config);
scaffolderActions.addActions(
createPublishAzureAction({
integrations,
config,
}),
);
},
});
},
});
@@ -3,11 +3,16 @@
> 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 { Config } from '@backstage/config';
import { JsonObject } from '@backstage/types';
import { ScmIntegrationRegistry } from '@backstage/integration';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
// @public
const bitbucketModule: () => BackendFeature;
export default bitbucketModule;
// @public
export const createBitbucketPipelinesRunAction: (options: {
integrations: ScmIntegrationRegistry;
@@ -6,13 +6,22 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
@@ -24,6 +33,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
@@ -21,3 +21,4 @@
*/
export * from './actions';
export { bitbucketModule as default } from './module';
@@ -0,0 +1,57 @@
/*
* Copyright 2024 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.
*/
import {
coreServices,
createBackendModule,
} from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import {
createBitbucketPipelinesRunAction,
createPublishBitbucketCloudAction,
createPublishBitbucketServerAction,
createPublishBitbucketServerPullRequestAction,
} from './actions';
import { ScmIntegrations } from '@backstage/integration';
/**
* @public
* The Bitbucket Module for the Scaffolder Backend
*/
export const bitbucketModule = createBackendModule({
moduleId: 'bitbucket',
pluginId: 'scaffolder',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
config: coreServices.rootConfig,
},
async init({ scaffolder, config }) {
const integrations = ScmIntegrations.fromConfig(config);
scaffolder.addActions(
createPublishBitbucketCloudAction({ integrations, config }),
createPublishBitbucketServerAction({ integrations, config }),
createPublishBitbucketServerPullRequestAction({
integrations,
config,
}),
createBitbucketPipelinesRunAction({ integrations }),
);
},
});
},
});
@@ -3,12 +3,17 @@
> 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 { Config } from '@backstage/config';
import { JsonObject } from '@backstage/types';
import { ScmIntegrations } from '@backstage/integration';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
import { UrlReader } from '@backstage/backend-common';
// @public
const confluenceToMarkdownModule: () => BackendFeature;
export default confluenceToMarkdownModule;
// @public (undocumented)
export const createConfluenceToMarkdownAction: (options: {
reader: UrlReader;
@@ -6,9 +6,7 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
@@ -19,6 +17,17 @@
"url": "https://github.com/backstage/backstage",
"directory": "plugins/scaffolder-backend-module-confluence-to-markdown"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
@@ -31,6 +40,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
@@ -21,3 +21,4 @@
*/
export * from './actions';
export { confluenceToMarkdownModule as default } from './module';
@@ -0,0 +1,50 @@
/*
* Copyright 2024 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.
*/
import {
createBackendModule,
coreServices,
} from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import { createConfluenceToMarkdownAction } from './actions';
import { ScmIntegrations } from '@backstage/integration';
/**
* @public
* The Confluence to Markdown Module for the Scaffolder Backend
*/
export const confluenceToMarkdownModule = createBackendModule({
pluginId: 'scaffolder',
moduleId: 'confluence-to-markdown',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
config: coreServices.rootConfig,
reader: coreServices.urlReader,
},
async init({ scaffolder, config, reader }) {
const integrations = ScmIntegrations.fromConfig(config);
scaffolder.addActions(
createConfluenceToMarkdownAction({
config,
integrations,
reader,
}),
);
},
});
},
});
@@ -5,12 +5,17 @@
```ts
/// <reference types="node" />
import { BackendFeature } from '@backstage/backend-plugin-api';
import { ContainerRunner } from '@backstage/backend-common';
import { JsonObject } from '@backstage/types';
import { ScmIntegrations } from '@backstage/integration';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
import { UrlReader } from '@backstage/backend-common';
// @public
const cookiecutterModule: () => BackendFeature;
export default cookiecutterModule;
// @public
export function createFetchCookiecutterAction(options: {
reader: UrlReader;
@@ -6,9 +6,7 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
@@ -19,6 +17,17 @@
"url": "https://github.com/backstage/backstage",
"directory": "plugins/scaffolder-backend-module-cookiecutter"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
@@ -30,6 +39,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
@@ -21,3 +21,4 @@
*/
export * from './actions';
export { cookiecutterModule as default } from './module';
@@ -0,0 +1,46 @@
/*
* Copyright 2024 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.
*/
import {
coreServices,
createBackendModule,
} from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import { createFetchCookiecutterAction } from './actions';
import { ScmIntegrations } from '@backstage/integration';
/**
* @public
* The Cookiecutter Module for the Scaffolder Backend
*/
export const cookiecutterModule = createBackendModule({
pluginId: 'scaffolder',
moduleId: 'cookiecutter',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
config: coreServices.rootConfig,
reader: coreServices.urlReader,
},
async init({ scaffolder, config, reader }) {
const integrations = ScmIntegrations.fromConfig(config);
scaffolder.addActions(
createFetchCookiecutterAction({ reader, integrations }),
);
},
});
},
});
@@ -3,6 +3,7 @@
> 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 { Config } from '@backstage/config';
import { JsonObject } from '@backstage/types';
import { ScmIntegrationRegistry } from '@backstage/integration';
@@ -40,4 +41,8 @@ export function createPublishGerritReviewAction(options: {
},
JsonObject
>;
// @public
const gerritModule: () => BackendFeature;
export default gerritModule;
```
@@ -6,13 +6,22 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
@@ -23,6 +32,7 @@
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
@@ -21,3 +21,4 @@
*/
export * from './actions';
export { gerritModule as default } from './module';
@@ -0,0 +1,49 @@
/*
* Copyright 2024 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.
*/
import {
coreServices,
createBackendModule,
} from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import {
createPublishGerritAction,
createPublishGerritReviewAction,
} from './actions';
import { ScmIntegrations } from '@backstage/integration';
/**
* @public
* The Gerrit Module for the Scaffolder Backend
*/
export const gerritModule = createBackendModule({
pluginId: 'scaffolder',
moduleId: 'geritt',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
config: coreServices.rootConfig,
},
async init({ scaffolder, config }) {
const integrations = ScmIntegrations.fromConfig(config);
scaffolder.addActions(
createPublishGerritAction({ integrations, config }),
createPublishGerritReviewAction({ integrations, config }),
);
},
});
},
});
@@ -3,6 +3,7 @@
> 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 { Config } from '@backstage/config';
import { createPullRequest } from 'octokit-plugin-create-pull-request';
import { GithubCredentialsProvider } from '@backstage/integration';
@@ -377,4 +378,8 @@ export const createPublishGithubPullRequestAction: (
},
JsonObject
>;
// @public
const githubModule: () => BackendFeature;
export default githubModule;
```
@@ -6,13 +6,22 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
@@ -24,6 +33,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
@@ -21,3 +21,4 @@
*/
export * from './actions';
export { githubModule as default } from './module';
@@ -0,0 +1,97 @@
/*
* Copyright 2024 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.
*/
import {
coreServices,
createBackendModule,
} from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import {
createGithubActionsDispatchAction,
createGithubAutolinksAction,
createGithubDeployKeyAction,
createGithubEnvironmentAction,
createGithubIssuesLabelAction,
createGithubRepoCreateAction,
createGithubRepoPushAction,
createGithubWebhookAction,
createPublishGithubAction,
createPublishGithubPullRequestAction,
} from './actions';
import {
DefaultGithubCredentialsProvider,
ScmIntegrations,
} from '@backstage/integration';
/**
* @public
* The GitHub Module for the Scaffolder Backend
*/
export const githubModule = createBackendModule({
pluginId: 'scaffolder',
moduleId: 'github',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
config: coreServices.rootConfig,
},
async init({ scaffolder, config }) {
const integrations = ScmIntegrations.fromConfig(config);
const githubCredentialsProvider =
DefaultGithubCredentialsProvider.fromIntegrations(integrations);
scaffolder.addActions(
createGithubActionsDispatchAction({
integrations,
githubCredentialsProvider,
}),
createGithubAutolinksAction({
integrations,
githubCredentialsProvider,
}),
createGithubDeployKeyAction({
integrations,
}),
createGithubEnvironmentAction({
integrations,
}),
createGithubIssuesLabelAction({
integrations,
githubCredentialsProvider,
}),
createGithubRepoCreateAction({
integrations,
githubCredentialsProvider,
}),
createGithubRepoPushAction({ integrations, config }),
createGithubWebhookAction({
integrations,
githubCredentialsProvider,
}),
createPublishGithubAction({
integrations,
config,
githubCredentialsProvider,
}),
createPublishGithubPullRequestAction({
integrations,
githubCredentialsProvider,
}),
);
},
});
},
});
@@ -3,6 +3,7 @@
> 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 { Config } from '@backstage/config';
import { JsonObject } from '@backstage/types';
import { ScmIntegrationRegistry } from '@backstage/integration';
@@ -191,6 +192,10 @@ export const createPublishGitlabMergeRequestAction: (options: {
JsonObject
>;
// @public
const gitlabModule: () => BackendFeature;
export default gitlabModule;
// @public
export enum IssueType {
// (undocumented)
@@ -5,9 +5,7 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
@@ -21,6 +19,17 @@
"keywords": [
"backstage"
],
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
@@ -32,6 +41,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
@@ -21,3 +21,4 @@
*/
export * from './actions';
export { gitlabModule as default } from './module';
@@ -0,0 +1,62 @@
/*
* Copyright 2024 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.
*/
import {
coreServices,
createBackendModule,
} from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import {
createGitlabGroupEnsureExistsAction,
createGitlabIssueAction,
createGitlabProjectAccessTokenAction,
createGitlabProjectDeployTokenAction,
createGitlabProjectVariableAction,
createGitlabRepoPushAction,
createPublishGitlabAction,
createPublishGitlabMergeRequestAction,
} from './actions';
import { ScmIntegrations } from '@backstage/integration';
/**
* @public
* The GitLab Module for the Scaffolder Backend
*/
export const gitlabModule = createBackendModule({
pluginId: 'scaffolder',
moduleId: 'gitlab',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
config: coreServices.rootConfig,
},
async init({ scaffolder, config }) {
const integrations = ScmIntegrations.fromConfig(config);
scaffolder.addActions(
createGitlabGroupEnsureExistsAction({ integrations }),
createGitlabIssueAction({ integrations }),
createGitlabProjectAccessTokenAction({ integrations }),
createGitlabProjectDeployTokenAction({ integrations }),
createGitlabProjectVariableAction({ integrations }),
createGitlabRepoPushAction({ integrations }),
createPublishGitlabAction({ config, integrations }),
createPublishGitlabMergeRequestAction({ integrations }),
);
},
});
},
});
@@ -3,6 +3,7 @@
> 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 { ContainerRunner } from '@backstage/backend-common';
import { JsonObject } from '@backstage/types';
import { ScmIntegrations } from '@backstage/integration';
@@ -13,7 +14,7 @@ import { UrlReader } from '@backstage/backend-common';
export function createFetchRailsAction(options: {
reader: UrlReader;
integrations: ScmIntegrations;
containerRunner: ContainerRunner;
containerRunner?: ContainerRunner;
allowedImageNames?: string[];
}): TemplateAction<
{
@@ -24,4 +25,8 @@ export function createFetchRailsAction(options: {
},
JsonObject
>;
// @public
const railsModule: () => BackendFeature;
export default railsModule;
```
@@ -6,9 +6,7 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
@@ -19,6 +17,17 @@
"url": "https://github.com/backstage/backstage",
"directory": "plugins/scaffolder-backend-module-rails"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"scripts": {
"build": "backstage-cli package build",
"start": "backstage-cli package start",
@@ -30,6 +39,7 @@
},
"dependencies": {
"@backstage/backend-common": "workspace:^",
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/integration": "workspace:^",
@@ -40,7 +40,7 @@ import { RailsNewRunner } from './railsNewRunner';
export function createFetchRailsAction(options: {
reader: UrlReader;
integrations: ScmIntegrations;
containerRunner: ContainerRunner;
containerRunner?: ContainerRunner;
/** A list of image names that are allowed to be passed as imageName input */
allowedImageNames?: string[];
}) {
@@ -27,9 +27,9 @@ import { JsonObject } from '@backstage/types';
import { Writable } from 'stream';
export class RailsNewRunner {
private readonly containerRunner: ContainerRunner;
private readonly containerRunner?: ContainerRunner;
constructor({ containerRunner }: { containerRunner: ContainerRunner }) {
constructor({ containerRunner }: { containerRunner?: ContainerRunner }) {
this.containerRunner = containerRunner;
}
@@ -77,6 +77,11 @@ export class RailsNewRunner {
if (!imageName) {
throw new Error('No imageName provided');
}
if (!this.containerRunner) {
throw new Error(
'Command is not available and no container runner provided',
);
}
const arrayExtraArguments = railsArgumentResolver(
'/input',
railsArguments as RailsRunOptions,
@@ -21,3 +21,4 @@
*/
export * from './actions';
export { railsModule as default } from './module';
@@ -0,0 +1,45 @@
/*
* Copyright 2024 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.
*/
import {
coreServices,
createBackendModule,
} from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import { createFetchRailsAction } from './actions';
import { ScmIntegrations } from '@backstage/integration';
/**
* @public
* The Rails Module for the Scaffolder Backend
*/
export const railsModule = createBackendModule({
pluginId: 'scaffolder',
moduleId: 'rails',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
config: coreServices.rootConfig,
reader: coreServices.urlReader,
},
async init({ scaffolder, config, reader }) {
const integrations = ScmIntegrations.fromConfig(config);
scaffolder.addActions(createFetchRailsAction({ integrations, reader }));
},
});
},
});
@@ -3,6 +3,7 @@
> 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 { Config } from '@backstage/config';
import { JsonObject } from '@backstage/types';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
@@ -21,5 +22,9 @@ export function createSentryCreateProjectAction(options: {
JsonObject
>;
// @public
const sentryModule: () => BackendFeature;
export default sentryModule;
// (No @packageDocumentation comment for this package)
```
@@ -5,13 +5,22 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"homepage": "https://backstage.io",
"repository": {
"type": "git",
@@ -28,6 +37,7 @@
"postpack": "backstage-cli package postpack"
},
"dependencies": {
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
@@ -0,0 +1,15 @@
/*
* Copyright 2024 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.
*/
@@ -15,3 +15,4 @@
*/
export { createSentryCreateProjectAction } from './actions/createProject';
export { sentryModule as default } from './module';
@@ -0,0 +1,42 @@
/*
* Copyright 2024 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.
*/
import {
coreServices,
createBackendModule,
} from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import { createSentryCreateProjectAction } from './actions/createProject';
/**
* @public
* The Sentry Module for the Scaffolder Backend
*/
export const sentryModule = createBackendModule({
pluginId: 'scaffolder',
moduleId: 'sentry',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
config: coreServices.rootConfig,
reade: coreServices.urlReader,
},
async init({ scaffolder, config }) {
scaffolder.addActions(createSentryCreateProjectAction({ config }));
},
});
},
});
@@ -3,6 +3,7 @@
> 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 { JsonObject } from '@backstage/types';
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
@@ -15,4 +16,8 @@ export function createRunYeomanAction(): TemplateAction<
},
JsonObject
>;
// @public
const yeomanModule: () => BackendFeature;
export default yeomanModule;
```
@@ -5,13 +5,22 @@
"types": "src/index.ts",
"license": "Apache-2.0",
"publishConfig": {
"access": "public",
"main": "dist/index.cjs.js",
"types": "dist/index.d.ts"
"access": "public"
},
"backstage": {
"role": "backend-plugin-module"
},
"exports": {
".": "./src/index.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"package.json": [
"package.json"
]
}
},
"homepage": "https://backstage.io",
"repository": {
"type": "git",
@@ -28,6 +37,7 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
"@backstage/types": "workspace:^",
"winston": "^3.2.1",
@@ -21,3 +21,4 @@
* @packageDocumentation
*/
export * from './actions';
export { yeomanModule as default } from './module';
@@ -0,0 +1,37 @@
/*
* Copyright 2024 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.
*/
import { createBackendModule } from '@backstage/backend-plugin-api';
import { scaffolderActionsExtensionPoint } from '@backstage/plugin-scaffolder-node/alpha';
import { createRunYeomanAction } from './actions';
/**
* @public
* The Yeoman Module for the Scaffolder Backend
*/
export const yeomanModule = createBackendModule({
pluginId: 'scaffolder',
moduleId: 'yeoman',
register({ registerInit }) {
registerInit({
deps: {
scaffolder: scaffolderActionsExtensionPoint,
},
async init({ scaffolder }) {
scaffolder.addActions(createRunYeomanAction());
},
});
},
});
@@ -32,7 +32,18 @@ import {
scaffolderTaskBrokerExtensionPoint,
scaffolderTemplatingExtensionPoint,
} from '@backstage/plugin-scaffolder-node/alpha';
import { createBuiltinActions } from './scaffolder';
import {
createCatalogRegisterAction,
createCatalogWriteAction,
createDebugLogAction,
createFetchCatalogEntityAction,
createFetchPlainAction,
createFetchPlainFileAction,
createFetchTemplateAction,
createFilesystemDeleteAction,
createFilesystemRenameAction,
createWaitAction,
} from './scaffolder';
import { createRouter } from './service/router';
/**
@@ -91,20 +102,39 @@ export const scaffolderPlugin = createBackendPlugin({
permissions,
}) {
const log = loggerToWinstonLogger(logger);
const integrations = ScmIntegrations.fromConfig(config);
const actions = [
// actions provided from other modules
...addedActions,
...createBuiltinActions({
integrations: ScmIntegrations.fromConfig(config),
catalogClient,
// built-in actions for the scaffolder
createFetchPlainAction({
reader,
integrations,
}),
createFetchPlainFileAction({
reader,
integrations,
}),
createFetchTemplateAction({
integrations,
reader,
config,
additionalTemplateFilters,
additionalTemplateGlobals,
}),
createDebugLogAction(),
createWaitAction(),
// todo(blam): maybe these should be a -catalog module?
createCatalogRegisterAction({ catalogClient, integrations }),
createFetchCatalogEntityAction({ catalogClient }),
createCatalogWriteAction(),
createFilesystemDeleteAction(),
createFilesystemRenameAction(),
];
const actionIds = actions.map(action => action.id).join(', ');
log.info(
`Starting scaffolder with the following actions enabled ${actionIds}`,
);
+10
View File
@@ -8024,6 +8024,7 @@ __metadata:
resolution: "@backstage/plugin-scaffolder-backend-module-azure@workspace:plugins/scaffolder-backend-module-azure"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
"@backstage/errors": "workspace:^"
@@ -8039,6 +8040,7 @@ __metadata:
resolution: "@backstage/plugin-scaffolder-backend-module-bitbucket@workspace:plugins/scaffolder-backend-module-bitbucket"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
@@ -8057,6 +8059,7 @@ __metadata:
resolution: "@backstage/plugin-scaffolder-backend-module-confluence-to-markdown@workspace:plugins/scaffolder-backend-module-confluence-to-markdown"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
@@ -8077,6 +8080,7 @@ __metadata:
resolution: "@backstage/plugin-scaffolder-backend-module-cookiecutter@workspace:plugins/scaffolder-backend-module-cookiecutter"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
@@ -8098,6 +8102,7 @@ __metadata:
resolution: "@backstage/plugin-scaffolder-backend-module-gerrit@workspace:plugins/scaffolder-backend-module-gerrit"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
@@ -8115,6 +8120,7 @@ __metadata:
resolution: "@backstage/plugin-scaffolder-backend-module-github@workspace:plugins/scaffolder-backend-module-github"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
@@ -8139,6 +8145,7 @@ __metadata:
resolution: "@backstage/plugin-scaffolder-backend-module-gitlab@workspace:plugins/scaffolder-backend-module-gitlab"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
@@ -8160,6 +8167,7 @@ __metadata:
resolution: "@backstage/plugin-scaffolder-backend-module-rails@workspace:plugins/scaffolder-backend-module-rails"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
@@ -8180,6 +8188,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@backstage/plugin-scaffolder-backend-module-sentry@workspace:plugins/scaffolder-backend-module-sentry"
dependencies:
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/backend-test-utils": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
@@ -8196,6 +8205,7 @@ __metadata:
resolution: "@backstage/plugin-scaffolder-backend-module-yeoman@workspace:plugins/scaffolder-backend-module-yeoman"
dependencies:
"@backstage/backend-common": "workspace:^"
"@backstage/backend-plugin-api": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/plugin-scaffolder-node": "workspace:^"
"@backstage/types": "workspace:^"