remove the last remnants of cookiecutter from scaffolder-backend
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
---
|
||||
'@backstage/create-app': patch
|
||||
---
|
||||
|
||||
Builtin support for cookiecutter based templates has been removed from `@backstage/plugin-scaffolder-backend`. Due to this, the `containerRunner` argument to its `createRouter` has also been removed.
|
||||
|
||||
If you do not use cookiecutter templates and are fine with removing support from it in your own installation, update your `packages/backend/src/plugins/scaffolder.ts` file as follows:
|
||||
|
||||
```diff
|
||||
-import { DockerContainerRunner } from '@backstage/backend-common';
|
||||
import { CatalogClient } from '@backstage/catalog-client';
|
||||
import { createRouter } from '@backstage/plugin-scaffolder-backend';
|
||||
-import Docker from 'dockerode';
|
||||
import { Router } from 'express';
|
||||
import type { PluginEnvironment } from '../types';
|
||||
|
||||
export default async function createPlugin({
|
||||
reader,
|
||||
discovery,
|
||||
}: PluginEnvironment): Promise<Router> {
|
||||
- const dockerClient = new Docker();
|
||||
- const containerRunner = new DockerContainerRunner({ dockerClient });
|
||||
-
|
||||
const catalogClient = new CatalogClient({ discoveryApi: discovery });
|
||||
-
|
||||
return await createRouter({
|
||||
- containerRunner,
|
||||
logger,
|
||||
config,
|
||||
// ...
|
||||
```
|
||||
|
||||
If you want to retain cookiecutter support, please use the `@backstage/plugin-scaffolder-backend-module-cookiecutter` package explicitly (see [its README](https://github.com/backstage/backstage/tree/master/plugins/scaffolder-backend-module-cookiecutter) for installation instructions).
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend': minor
|
||||
---
|
||||
|
||||
**BREAKING**:
|
||||
|
||||
- Removed the `createFetchCookiecutterAction` export, please use the `@backstage/plugin-scaffolder-backend-module-cookiecutter` package explicitly (see [its README](https://github.com/backstage/backstage/tree/master/plugins/scaffolder-backend-module-cookiecutter) for installation instructions).
|
||||
- Removed the `containerRunner` argument from the types `RouterOptions` (as used by `createRouter`) and `CreateBuiltInActionsOptions` (as used by `createBuiltinActions`).
|
||||
@@ -14,10 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { DockerContainerRunner } from '@backstage/backend-common';
|
||||
import { CatalogClient } from '@backstage/catalog-client';
|
||||
import { createRouter } from '@backstage/plugin-scaffolder-backend';
|
||||
import Docker from 'dockerode';
|
||||
import { Router } from 'express';
|
||||
import type { PluginEnvironment } from '../types';
|
||||
|
||||
@@ -28,13 +26,8 @@ export default async function createPlugin({
|
||||
reader,
|
||||
discovery,
|
||||
}: PluginEnvironment): Promise<Router> {
|
||||
const dockerClient = new Docker();
|
||||
const containerRunner = new DockerContainerRunner({ dockerClient });
|
||||
|
||||
const catalogClient = new CatalogClient({ discoveryApi: discovery });
|
||||
|
||||
return await createRouter({
|
||||
containerRunner,
|
||||
logger,
|
||||
config,
|
||||
database,
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { DockerContainerRunner } from '@backstage/backend-common';
|
||||
import { CatalogClient } from '@backstage/catalog-client';
|
||||
import { createRouter } from '@backstage/plugin-scaffolder-backend';
|
||||
import Docker from 'dockerode';
|
||||
import { Router } from 'express';
|
||||
import type { PluginEnvironment } from '../types';
|
||||
|
||||
@@ -12,12 +10,8 @@ export default async function createPlugin({
|
||||
reader,
|
||||
discovery,
|
||||
}: PluginEnvironment): Promise<Router> {
|
||||
const dockerClient = new Docker();
|
||||
const containerRunner = new DockerContainerRunner({ dockerClient });
|
||||
const catalogClient = new CatalogClient({ discoveryApi: discovery });
|
||||
|
||||
return await createRouter({
|
||||
containerRunner,
|
||||
logger,
|
||||
config,
|
||||
database,
|
||||
|
||||
@@ -9,8 +9,6 @@ import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
|
||||
import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
|
||||
import { Config } from '@backstage/config';
|
||||
import { ContainerRunner } from '@backstage/backend-common';
|
||||
import { createFetchCookiecutterAction } from '@backstage/plugin-scaffolder-backend-module-cookiecutter';
|
||||
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import express from 'express';
|
||||
@@ -63,8 +61,6 @@ export interface CreateBuiltInActionsOptions {
|
||||
catalogClient: CatalogApi;
|
||||
// (undocumented)
|
||||
config: Config;
|
||||
// @deprecated (undocumented)
|
||||
containerRunner?: ContainerRunner;
|
||||
// (undocumented)
|
||||
integrations: ScmIntegrations;
|
||||
// (undocumented)
|
||||
@@ -99,8 +95,6 @@ export function createDebugLogAction(): TemplateAction<{
|
||||
listWorkspace?: boolean | undefined;
|
||||
}>;
|
||||
|
||||
export { createFetchCookiecutterAction };
|
||||
|
||||
// @public
|
||||
export function createFetchPlainAction(options: {
|
||||
reader: UrlReader;
|
||||
@@ -428,8 +422,6 @@ export interface RouterOptions {
|
||||
// (undocumented)
|
||||
config: Config;
|
||||
// (undocumented)
|
||||
containerRunner?: ContainerRunner;
|
||||
// (undocumented)
|
||||
database: PluginDatabaseManager;
|
||||
// (undocumented)
|
||||
logger: Logger_2;
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
"@backstage/integration": "^0.8.0",
|
||||
"@backstage/plugin-catalog-backend": "^0.23.0",
|
||||
"@backstage/plugin-scaffolder-common": "^0.2.3",
|
||||
"@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.2.3",
|
||||
"@backstage/types": "^0.1.3",
|
||||
"@gitbeaker/core": "^34.6.0",
|
||||
"@gitbeaker/node": "^35.1.0",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ContainerRunner, UrlReader } from '@backstage/backend-common';
|
||||
import { UrlReader } from '@backstage/backend-common';
|
||||
import { JsonObject } from '@backstage/types';
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import {
|
||||
@@ -30,7 +30,6 @@ import {
|
||||
|
||||
import { createDebugLogAction } from './debug';
|
||||
import { createFetchPlainAction, createFetchTemplateAction } from './fetch';
|
||||
import { createFetchCookiecutterAction } from '@backstage/plugin-scaffolder-backend-module-cookiecutter';
|
||||
import {
|
||||
createFilesystemDeleteAction,
|
||||
createFilesystemRenameAction,
|
||||
@@ -49,7 +48,6 @@ import {
|
||||
} from './github';
|
||||
import { TemplateFilter } from '../../../lib';
|
||||
import { TemplateAction } from '../types';
|
||||
import { getRootLogger } from '@backstage/backend-common';
|
||||
|
||||
/**
|
||||
* The options passed to {@link createBuiltinActions}
|
||||
@@ -59,8 +57,6 @@ export interface CreateBuiltInActionsOptions {
|
||||
reader: UrlReader;
|
||||
integrations: ScmIntegrations;
|
||||
catalogClient: CatalogApi;
|
||||
/** @deprecated when the cookiecutter action is removed this won't be necessary */
|
||||
containerRunner?: ContainerRunner;
|
||||
config: Config;
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
||||
}
|
||||
@@ -78,7 +74,6 @@ export const createBuiltinActions = (
|
||||
const {
|
||||
reader,
|
||||
integrations,
|
||||
containerRunner,
|
||||
catalogClient,
|
||||
config,
|
||||
additionalTemplateFilters,
|
||||
@@ -135,20 +130,5 @@ export const createBuiltinActions = (
|
||||
}),
|
||||
];
|
||||
|
||||
if (containerRunner) {
|
||||
getRootLogger().warn(
|
||||
`[DEPRECATED] The fetch:cookiecutter action will be removed part of the default scaffolder actions in later versions.
|
||||
You can install the package seperately and remove the containerRunner from the createBuiltInActions to remove this warning,
|
||||
or you can migrate to using fetch:template https://backstage.io/docs/features/software-templates/builtin-actions#migrating-from-fetchcookiecutter-to-fetchtemplate`,
|
||||
);
|
||||
actions.push(
|
||||
createFetchCookiecutterAction({
|
||||
reader,
|
||||
integrations,
|
||||
containerRunner,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
return actions as TemplateAction<JsonObject>[];
|
||||
};
|
||||
|
||||
@@ -22,8 +22,5 @@ export * from './filesystem';
|
||||
export * from './publish';
|
||||
export * from './github';
|
||||
|
||||
/** @deprecated please add this package to your own installation manually */
|
||||
export { createFetchCookiecutterAction } from '@backstage/plugin-scaffolder-backend-module-cookiecutter';
|
||||
|
||||
export { runCommand, executeShellCommand } from './helpers';
|
||||
export type { RunCommandOptions } from './helpers';
|
||||
|
||||
@@ -30,7 +30,6 @@ jest.doMock('fs-extra', () => ({
|
||||
|
||||
import {
|
||||
DatabaseManager,
|
||||
DockerContainerRunner,
|
||||
getVoidLogger,
|
||||
PluginDatabaseManager,
|
||||
UrlReaders,
|
||||
@@ -122,7 +121,6 @@ describe('createRouter', () => {
|
||||
config: new ConfigReader({}),
|
||||
database: createDatabase(),
|
||||
catalogClient: createCatalogClient(template),
|
||||
containerRunner: new DockerContainerRunner({} as any),
|
||||
reader: mockUrlReader,
|
||||
taskBroker,
|
||||
});
|
||||
|
||||
@@ -14,11 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
ContainerRunner,
|
||||
PluginDatabaseManager,
|
||||
UrlReader,
|
||||
} from '@backstage/backend-common';
|
||||
import { PluginDatabaseManager, UrlReader } from '@backstage/backend-common';
|
||||
import { CatalogApi } from '@backstage/catalog-client';
|
||||
import { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
@@ -61,7 +57,6 @@ export interface RouterOptions {
|
||||
catalogClient: CatalogApi;
|
||||
actions?: TemplateAction<any>[];
|
||||
taskWorkers?: number;
|
||||
containerRunner?: ContainerRunner;
|
||||
taskBroker?: TaskBroker;
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
||||
}
|
||||
@@ -89,7 +84,6 @@ export async function createRouter(
|
||||
database,
|
||||
catalogClient,
|
||||
actions,
|
||||
containerRunner,
|
||||
taskWorkers,
|
||||
additionalTemplateFilters,
|
||||
} = options;
|
||||
@@ -128,7 +122,6 @@ export async function createRouter(
|
||||
: createBuiltinActions({
|
||||
integrations,
|
||||
catalogClient,
|
||||
containerRunner,
|
||||
reader,
|
||||
config,
|
||||
additionalTemplateFilters,
|
||||
|
||||
Reference in New Issue
Block a user