feat: final modules

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2024-01-18 17:02:52 +01:00
parent 84c80636e7
commit 115e4a592c
15 changed files with 268 additions and 4 deletions
@@ -0,0 +1,13 @@
## API Report File for "@backstage/plugin-scaffolder-backend-module-rails"
> 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';
// @alpha
const railsModule: () => BackendFeature;
export default railsModule;
// (No @packageDocumentation comment for this package)
```
@@ -13,7 +13,7 @@ import { UrlReader } from '@backstage/backend-common';
export function createFetchRailsAction(options: {
reader: UrlReader;
integrations: ScmIntegrations;
containerRunner: ContainerRunner;
containerRunner?: ContainerRunner;
allowedImageNames?: string[];
}): TemplateAction<
{
@@ -19,6 +19,21 @@
"url": "https://github.com/backstage/backstage",
"directory": "plugins/scaffolder-backend-module-rails"
},
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"alpha": [
"src/alpha.ts"
],
"package.json": [
"package.json"
]
}
},
"scripts": {
"build": "backstage-cli package build",
"start": "backstage-cli package start",
@@ -29,6 +44,7 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/backend-common": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "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,
@@ -0,0 +1,16 @@
/*
* 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.
*/
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';
/**
* @alpha
* 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 }));
},
});
},
});
@@ -0,0 +1,13 @@
## API Report File for "@backstage/plugin-scaffolder-backend-module-sentry"
> 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';
// @alpha
const sentryModule: () => BackendFeature;
export default sentryModule;
// (No @packageDocumentation comment for this package)
```
@@ -12,6 +12,21 @@
"backstage": {
"role": "backend-plugin-module"
},
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"alpha": [
"src/alpha.ts"
],
"package.json": [
"package.json"
]
}
},
"homepage": "https://backstage.io",
"repository": {
"type": "git",
@@ -28,6 +43,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,16 @@
/*
* 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.
*/
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';
/**
* @alpha
* 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 }));
},
});
},
});
@@ -0,0 +1,13 @@
## API Report File for "@backstage/plugin-scaffolder-backend-module-yeoman"
> 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';
// @alpha
const yeomanModule: () => BackendFeature;
export default yeomanModule;
// (No @packageDocumentation comment for this package)
```
@@ -12,6 +12,21 @@
"backstage": {
"role": "backend-plugin-module"
},
"exports": {
".": "./src/index.ts",
"./alpha": "./src/alpha.ts",
"./package.json": "./package.json"
},
"typesVersions": {
"*": {
"alpha": [
"src/alpha.ts"
],
"package.json": [
"package.json"
]
}
},
"homepage": "https://backstage.io",
"repository": {
"type": "git",
@@ -28,6 +43,7 @@
"clean": "backstage-cli package clean"
},
"dependencies": {
"@backstage/backend-plugin-api": "workspace:^",
"@backstage/plugin-scaffolder-node": "workspace:^",
"@backstage/types": "workspace:^",
"winston": "^3.2.1",
@@ -0,0 +1,16 @@
/*
* 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.
*/
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';
/**
* @alpha
* 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());
},
});
},
});