breaking: more removals and deprecations
Signed-off-by: benjdlambert <ben@blam.sh>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend': major
|
||||
---
|
||||
|
||||
**BREAKING CHANGES**
|
||||
|
||||
The following functions have been re-exported from the `scaffolder-backend` plugin for quite some time, and now it's time to clean them up. They've been moved as follows:
|
||||
|
||||
- `SerializedTask`, `SerializedTaskEvent`, `TaskBroker`, `TaskBrokerDispatchOptions`, `TaskBrokerDispatchResult`, `TaskCompletionState`, `TaskContext`, `TaskEventType`, `TaskStatus`, `TemplateFilter`, and `TemplateGlobal` should be imported from `@backstage/plugin-scaffolder-node` instead.
|
||||
|
||||
- The deprecated `copyWithoutRender` option has been removed from `fetch:template` action. You should rename the option to `copyWithoutTemplating` instead.
|
||||
@@ -0,0 +1,20 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend': minor
|
||||
---
|
||||
|
||||
**DEPRECATIONS**
|
||||
|
||||
The following types and implementations have been deprecated, either because they're no longer relevant, or because upcoming changes to the `scaffolder-backend` after `2.0.0` will influence the changes to these API surfaces.
|
||||
|
||||
- `CreateWorkerOptions`
|
||||
- `DatabaseTaskStore`
|
||||
- `DatabaseTaskStoreOptions`
|
||||
- `TaskManager`
|
||||
- `TaskStoreCreateTaskOptions`
|
||||
- `TaskStoreCreateTaskResult`
|
||||
- `TaskStoreEmitOptions`
|
||||
- `TaskStoreListEventsOptions`
|
||||
- `TaskStoreRecoverTaskOptions`
|
||||
- `TaskStoreShutDownTaskOptions`
|
||||
|
||||
There is no current path off deprecation, these types are going to be removed and rethought with a better way to define workers in the new backend system.
|
||||
@@ -23,23 +23,20 @@ import { PermissionRuleParams } from '@backstage/plugin-permission-common';
|
||||
import { RESOURCE_TYPE_SCAFFOLDER_ACTION } from '@backstage/plugin-scaffolder-common/alpha';
|
||||
import { RESOURCE_TYPE_SCAFFOLDER_TEMPLATE } from '@backstage/plugin-scaffolder-common/alpha';
|
||||
import { ScmIntegrations } from '@backstage/integration';
|
||||
import { SerializedTask as SerializedTask_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { SerializedTaskEvent as SerializedTaskEvent_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskBroker as TaskBroker_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskBrokerDispatchOptions as TaskBrokerDispatchOptions_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskBrokerDispatchResult as TaskBrokerDispatchResult_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskCompletionState as TaskCompletionState_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskContext as TaskContext_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskEventType as TaskEventType_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { SerializedTask } from '@backstage/plugin-scaffolder-node';
|
||||
import { SerializedTaskEvent } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskBroker } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskCompletionState } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskContext } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskRecovery } from '@backstage/plugin-scaffolder-common';
|
||||
import { TaskSecrets } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
|
||||
import { TaskSpecV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { TaskStatus as TaskStatus_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TaskStatus } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateEntityStepV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { TemplateFilter as TemplateFilter_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateGlobal as TemplateGlobal_2 } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateFilter } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateGlobal } from '@backstage/plugin-scaffolder-node';
|
||||
import { TemplateParametersV1beta3 } from '@backstage/plugin-scaffolder-common';
|
||||
import { UrlReaderService } from '@backstage/backend-plugin-api';
|
||||
import { WorkspaceProvider } from '@backstage/plugin-scaffolder-node/alpha';
|
||||
@@ -61,9 +58,9 @@ export const createBuiltinActions: (
|
||||
|
||||
// @public
|
||||
export interface CreateBuiltInActionsOptions {
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter_2>;
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
||||
// (undocumented)
|
||||
additionalTemplateGlobals?: Record<string, TemplateGlobal_2>;
|
||||
additionalTemplateGlobals?: Record<string, TemplateGlobal>;
|
||||
auth?: AuthService;
|
||||
catalogClient: CatalogApi;
|
||||
config: Config;
|
||||
@@ -154,15 +151,14 @@ export function createFetchPlainFileAction(options: {
|
||||
export function createFetchTemplateAction(options: {
|
||||
reader: UrlReaderService;
|
||||
integrations: ScmIntegrations;
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter_2>;
|
||||
additionalTemplateGlobals?: Record<string, TemplateGlobal_2>;
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
||||
additionalTemplateGlobals?: Record<string, TemplateGlobal>;
|
||||
}): TemplateAction<
|
||||
{
|
||||
url: string;
|
||||
targetPath?: string;
|
||||
values: any;
|
||||
templateFileExtension?: string | boolean;
|
||||
copyWithoutRender?: string[];
|
||||
copyWithoutTemplating?: string[];
|
||||
cookiecutterCompat?: boolean;
|
||||
replace?: boolean;
|
||||
@@ -178,8 +174,8 @@ export function createFetchTemplateAction(options: {
|
||||
export function createFetchTemplateFileAction(options: {
|
||||
reader: UrlReaderService;
|
||||
integrations: ScmIntegrations;
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter_2>;
|
||||
additionalTemplateGlobals?: Record<string, TemplateGlobal_2>;
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
||||
additionalTemplateGlobals?: Record<string, TemplateGlobal>;
|
||||
}): TemplateAction<
|
||||
{
|
||||
url: string;
|
||||
@@ -243,17 +239,17 @@ export function createWaitAction(options?: {
|
||||
maxWaitTime?: Duration | HumanDuration;
|
||||
}): TemplateAction<HumanDuration, JsonObject, 'v1'>;
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export type CreateWorkerOptions = {
|
||||
taskBroker: TaskBroker_2;
|
||||
taskBroker: TaskBroker;
|
||||
actionRegistry: TemplateActionRegistry;
|
||||
integrations: ScmIntegrations;
|
||||
workingDirectory: string;
|
||||
logger: Logger;
|
||||
auditor?: AuditorService;
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter_2>;
|
||||
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
||||
concurrentTasksLimit?: number;
|
||||
additionalTemplateGlobals?: Record<string, TemplateGlobal_2>;
|
||||
additionalTemplateGlobals?: Record<string, TemplateGlobal>;
|
||||
permissions?: PermissionEvaluator;
|
||||
gracefulShutdown?: boolean;
|
||||
};
|
||||
@@ -268,7 +264,7 @@ export interface CurrentClaimedTask {
|
||||
workspace?: Promise<Buffer>;
|
||||
}
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export class DatabaseTaskStore implements TaskStore {
|
||||
// (undocumented)
|
||||
cancelTask(
|
||||
@@ -279,13 +275,13 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
>,
|
||||
): Promise<void>;
|
||||
// (undocumented)
|
||||
claimTask(): Promise<SerializedTask_2 | undefined>;
|
||||
claimTask(): Promise<SerializedTask | undefined>;
|
||||
// (undocumented)
|
||||
cleanWorkspace({ taskId }: { taskId: string }): Promise<void>;
|
||||
// (undocumented)
|
||||
completeTask(options: {
|
||||
taskId: string;
|
||||
status: TaskStatus_2;
|
||||
status: TaskStatus;
|
||||
eventBody: JsonObject;
|
||||
}): Promise<void>;
|
||||
// (undocumented)
|
||||
@@ -303,7 +299,7 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
>,
|
||||
): Promise<void>;
|
||||
// (undocumented)
|
||||
getTask(taskId: string): Promise<SerializedTask_2>;
|
||||
getTask(taskId: string): Promise<SerializedTask>;
|
||||
// (undocumented)
|
||||
getTaskState({ taskId }: { taskId: string }): Promise<
|
||||
| {
|
||||
@@ -316,10 +312,10 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
// (undocumented)
|
||||
list(options: {
|
||||
createdBy?: string;
|
||||
status?: TaskStatus_2;
|
||||
status?: TaskStatus;
|
||||
filters?: {
|
||||
createdBy?: string | string[];
|
||||
status?: TaskStatus_2 | TaskStatus_2[];
|
||||
status?: TaskStatus | TaskStatus[];
|
||||
};
|
||||
pagination?: {
|
||||
limit?: number;
|
||||
@@ -330,12 +326,12 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
field: string;
|
||||
}[];
|
||||
}): Promise<{
|
||||
tasks: SerializedTask_2[];
|
||||
tasks: SerializedTask[];
|
||||
totalTasks?: number;
|
||||
}>;
|
||||
// (undocumented)
|
||||
listEvents(options: TaskStoreListEventsOptions): Promise<{
|
||||
events: SerializedTaskEvent_2[];
|
||||
events: SerializedTaskEvent[];
|
||||
}>;
|
||||
// (undocumented)
|
||||
listStaleTasks(options: { timeoutS: number }): Promise<{
|
||||
@@ -363,7 +359,7 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
shutdownTask(options: TaskStoreShutDownTaskOptions): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export type DatabaseTaskStoreOptions = {
|
||||
database: DatabaseService | Knex;
|
||||
events?: EventsService;
|
||||
@@ -374,37 +370,13 @@ const scaffolderPlugin: BackendFeature;
|
||||
export default scaffolderPlugin;
|
||||
|
||||
// @public @deprecated
|
||||
export type SerializedTask = SerializedTask_2;
|
||||
|
||||
// @public @deprecated
|
||||
export type SerializedTaskEvent = SerializedTaskEvent_2;
|
||||
|
||||
// @public @deprecated
|
||||
export type TaskBroker = TaskBroker_2;
|
||||
|
||||
// @public @deprecated
|
||||
export type TaskBrokerDispatchOptions = TaskBrokerDispatchOptions_2;
|
||||
|
||||
// @public @deprecated
|
||||
export type TaskBrokerDispatchResult = TaskBrokerDispatchResult_2;
|
||||
|
||||
// @public @deprecated
|
||||
export type TaskCompletionState = TaskCompletionState_2;
|
||||
|
||||
// @public @deprecated
|
||||
export type TaskContext = TaskContext_2;
|
||||
|
||||
// @public @deprecated
|
||||
export type TaskEventType = TaskEventType_2;
|
||||
|
||||
// @public
|
||||
export class TaskManager implements TaskContext_2 {
|
||||
export class TaskManager implements TaskContext {
|
||||
// (undocumented)
|
||||
get cancelSignal(): AbortSignal;
|
||||
// (undocumented)
|
||||
cleanWorkspace?(): Promise<void>;
|
||||
// (undocumented)
|
||||
complete(result: TaskCompletionState_2, metadata?: JsonObject): Promise<void>;
|
||||
complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
|
||||
// (undocumented)
|
||||
static create(
|
||||
task: CurrentClaimedTask,
|
||||
@@ -460,9 +432,6 @@ export class TaskManager implements TaskContext_2 {
|
||||
}
|
||||
|
||||
// @public @deprecated
|
||||
export type TaskStatus = TaskStatus_2;
|
||||
|
||||
// @public
|
||||
export interface TaskStore {
|
||||
// (undocumented)
|
||||
cancelTask?(options: TaskStoreEmitOptions): Promise<void>;
|
||||
@@ -569,42 +538,42 @@ export interface TaskStore {
|
||||
shutdownTask?(options: TaskStoreShutDownTaskOptions): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export type TaskStoreCreateTaskOptions = {
|
||||
spec: TaskSpec;
|
||||
createdBy?: string;
|
||||
secrets?: TaskSecrets;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export type TaskStoreCreateTaskResult = {
|
||||
taskId: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export type TaskStoreEmitOptions<TBody = JsonObject> = {
|
||||
taskId: string;
|
||||
body: TBody;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export type TaskStoreListEventsOptions = {
|
||||
isTaskRecoverable?: boolean;
|
||||
taskId: string;
|
||||
after?: number | undefined;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export type TaskStoreRecoverTaskOptions = {
|
||||
timeout: HumanDuration;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export type TaskStoreShutDownTaskOptions = {
|
||||
taskId: string;
|
||||
};
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export class TaskWorker {
|
||||
// (undocumented)
|
||||
static create(options: CreateWorkerOptions): Promise<TaskWorker>;
|
||||
@@ -613,14 +582,14 @@ export class TaskWorker {
|
||||
// (undocumented)
|
||||
recoverTasks(): Promise<void>;
|
||||
// (undocumented)
|
||||
runOneTask(task: TaskContext_2): Promise<void>;
|
||||
runOneTask(task: TaskContext): Promise<void>;
|
||||
// (undocumented)
|
||||
start(): void;
|
||||
// (undocumented)
|
||||
stop(): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export class TemplateActionRegistry {
|
||||
// (undocumented)
|
||||
get(actionId: string): TemplateAction<any, any, any>;
|
||||
@@ -630,12 +599,6 @@ export class TemplateActionRegistry {
|
||||
register(action: TemplateAction<any, any, any>): void;
|
||||
}
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export type TemplateFilter = TemplateFilter_2;
|
||||
|
||||
// @public @deprecated (undocumented)
|
||||
export type TemplateGlobal = TemplateGlobal_2;
|
||||
|
||||
// @public (undocumented)
|
||||
export type TemplatePermissionRuleInput<
|
||||
TParams extends PermissionRuleParams = PermissionRuleParams,
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
export { scaffolderPlugin as default } from './ScaffolderPlugin';
|
||||
export * from './scaffolder';
|
||||
export * from './lib';
|
||||
export {
|
||||
type TemplatePermissionRuleInput,
|
||||
type ActionPermissionRuleInput,
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2022 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 * from './templating';
|
||||
@@ -17,8 +17,8 @@
|
||||
import { Isolate } from 'isolated-vm';
|
||||
import { resolvePackagePath } from '@backstage/backend-plugin-api';
|
||||
import {
|
||||
TemplateFilter as _TemplateFilter,
|
||||
TemplateGlobal as _TemplateGlobal,
|
||||
TemplateFilter,
|
||||
TemplateGlobal,
|
||||
} from '@backstage/plugin-scaffolder-node';
|
||||
import fs from 'fs-extra';
|
||||
import { JsonValue } from '@backstage/types';
|
||||
@@ -96,18 +96,6 @@ const { render, renderCompat } = (() => {
|
||||
})();
|
||||
`;
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type TemplateFilter = _TemplateFilter;
|
||||
|
||||
/**
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type TemplateGlobal = _TemplateGlobal;
|
||||
|
||||
interface SecureTemplaterOptions {
|
||||
/* Enables jinja compatibility and the "jsonify" filter */
|
||||
cookiecutterCompat?: boolean;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright 2022 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 type { TemplateFilter, TemplateGlobal } from './SecureTemplater';
|
||||
@@ -19,6 +19,7 @@ import { TemplateAction } from '@backstage/plugin-scaffolder-node';
|
||||
/**
|
||||
* Registry of all registered template actions.
|
||||
* @public
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
*/
|
||||
export class TemplateActionRegistry {
|
||||
private readonly actions = new Map<string, TemplateAction>();
|
||||
|
||||
@@ -98,42 +98,6 @@ describe('fetch:template', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('throws if copyWithoutRender parameter is not an array', async () => {
|
||||
await expect(() =>
|
||||
action.handler(
|
||||
mockContext({ copyWithoutRender: 'abc' as unknown as string[] }),
|
||||
),
|
||||
).rejects.toThrow(
|
||||
/copyWithoutRender\/copyWithoutTemplating must be an array/i,
|
||||
);
|
||||
});
|
||||
|
||||
it('throws if both copyWithoutRender and copyWithoutTemplating are used', async () => {
|
||||
await expect(() =>
|
||||
action.handler(
|
||||
mockContext({
|
||||
copyWithoutRender: 'abc' as unknown as string[],
|
||||
copyWithoutTemplating: 'def' as unknown as string[],
|
||||
}),
|
||||
),
|
||||
).rejects.toThrow(
|
||||
/copyWithoutRender and copyWithoutTemplating can not be used at the same time/i,
|
||||
);
|
||||
});
|
||||
|
||||
it('throws if copyWithoutRender is used with extension', async () => {
|
||||
await expect(() =>
|
||||
action.handler(
|
||||
mockContext({
|
||||
copyWithoutRender: ['abc'],
|
||||
templateFileExtension: true,
|
||||
}),
|
||||
),
|
||||
).rejects.toThrow(
|
||||
/input extension incompatible with copyWithoutRender\/copyWithoutTemplating and cookiecutterCompat/,
|
||||
);
|
||||
});
|
||||
|
||||
it('throws if cookiecutterCompat is used with extension', async () => {
|
||||
await expect(() =>
|
||||
action.handler(
|
||||
@@ -143,7 +107,7 @@ describe('fetch:template', () => {
|
||||
}),
|
||||
),
|
||||
).rejects.toThrow(
|
||||
/input extension incompatible with copyWithoutRender\/copyWithoutTemplating and cookiecutterCompat/,
|
||||
/input extension incompatible with copyWithoutTemplating and cookiecutterCompat/,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -378,55 +342,6 @@ describe('fetch:template', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('copyWithoutRender', () => {
|
||||
let context: ActionContext<FetchTemplateInput>;
|
||||
|
||||
beforeEach(async () => {
|
||||
context = mockContext({
|
||||
values: {
|
||||
name: 'test-project',
|
||||
count: 1234,
|
||||
},
|
||||
copyWithoutRender: ['.unprocessed'],
|
||||
});
|
||||
|
||||
mockFetchContents.mockImplementation(({ outputPath }) => {
|
||||
mockDir.setContent({
|
||||
[outputPath]: {
|
||||
processed: {
|
||||
'templated-content-${{ values.name }}.txt': '${{ values.count }}',
|
||||
},
|
||||
'.unprocessed': {
|
||||
'templated-content-${{ values.name }}.txt': '${{ values.count }}',
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
await action.handler(context);
|
||||
});
|
||||
|
||||
it('ignores template syntax in files matched in copyWithoutRender', async () => {
|
||||
await expect(
|
||||
fs.readFile(
|
||||
`${workspacePath}/target/.unprocessed/templated-content-\${{ values.name }}.txt`,
|
||||
'utf-8',
|
||||
),
|
||||
).resolves.toEqual('${{ values.count }}');
|
||||
});
|
||||
|
||||
it('processes files not matched in copyWithoutRender', async () => {
|
||||
await expect(
|
||||
fs.readFile(
|
||||
`${workspacePath}/target/processed/templated-content-test-project.txt`,
|
||||
'utf-8',
|
||||
),
|
||||
).resolves.toEqual('1234');
|
||||
});
|
||||
});
|
||||
|
||||
describe('copyWithoutTemplating', () => {
|
||||
let context: ActionContext<FetchTemplateInput>;
|
||||
|
||||
|
||||
@@ -48,10 +48,6 @@ export function createFetchTemplateAction(options: {
|
||||
templateFileExtension?: string | boolean;
|
||||
|
||||
// Cookiecutter compat options
|
||||
/**
|
||||
* @deprecated This field is deprecated in favor of copyWithoutTemplating.
|
||||
*/
|
||||
copyWithoutRender?: string[];
|
||||
copyWithoutTemplating?: string[];
|
||||
cookiecutterCompat?: boolean;
|
||||
replace?: boolean;
|
||||
|
||||
+5
-25
@@ -36,12 +36,6 @@ export type TemplateActionInput = {
|
||||
targetPath?: string;
|
||||
values: any;
|
||||
templateFileExtension?: string | boolean;
|
||||
|
||||
// Cookiecutter compat options
|
||||
/**
|
||||
* @deprecated This field is deprecated in favor of copyWithoutTemplating.
|
||||
*/
|
||||
copyWithoutRender?: string[];
|
||||
copyWithoutTemplating?: string[];
|
||||
cookiecutterCompat?: boolean;
|
||||
replace?: boolean;
|
||||
@@ -206,26 +200,12 @@ function resolveTemplateActionSettings<I extends TemplateActionInput>(
|
||||
const targetPath = ctx.input.targetPath ?? './';
|
||||
const outputDir = resolveSafeChildPath(ctx.workspacePath, targetPath);
|
||||
|
||||
if (ctx.input.copyWithoutRender && ctx.input.copyWithoutTemplating) {
|
||||
throw new InputError(
|
||||
'Fetch action input copyWithoutRender and copyWithoutTemplating can not be used at the same time',
|
||||
);
|
||||
}
|
||||
let copyOnlyPatterns: string[] | undefined;
|
||||
let renderFilename: boolean;
|
||||
if (ctx.input.copyWithoutRender) {
|
||||
ctx.logger.warn(
|
||||
'[Deprecated] copyWithoutRender is deprecated Please use copyWithoutTemplating instead.',
|
||||
);
|
||||
copyOnlyPatterns = ctx.input.copyWithoutRender;
|
||||
renderFilename = false;
|
||||
} else {
|
||||
copyOnlyPatterns = ctx.input.copyWithoutTemplating;
|
||||
renderFilename = true;
|
||||
}
|
||||
const copyOnlyPatterns = ctx.input.copyWithoutTemplating;
|
||||
const renderFilename = true;
|
||||
|
||||
if (copyOnlyPatterns && !Array.isArray(copyOnlyPatterns)) {
|
||||
throw new InputError(
|
||||
'Fetch action input copyWithoutRender/copyWithoutTemplating must be an Array',
|
||||
'Fetch action input copyWithoutTemplating must be an Array',
|
||||
);
|
||||
}
|
||||
if (
|
||||
@@ -233,7 +213,7 @@ function resolveTemplateActionSettings<I extends TemplateActionInput>(
|
||||
(copyOnlyPatterns || ctx.input.cookiecutterCompat)
|
||||
) {
|
||||
throw new InputError(
|
||||
'Fetch action input extension incompatible with copyWithoutRender/copyWithoutTemplating and cookiecutterCompat',
|
||||
'Fetch action input extension incompatible with copyWithoutTemplating and cookiecutterCompat',
|
||||
);
|
||||
}
|
||||
let extension: string | false = false;
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ describe('workspace:template', () => {
|
||||
}),
|
||||
),
|
||||
).rejects.toThrow(
|
||||
/input extension incompatible with copyWithoutRender\/copyWithoutTemplating and cookiecutterCompat/,
|
||||
/input extension incompatible with copyWithoutTemplating and cookiecutterCompat/,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ export type RawDbTaskEventRow = {
|
||||
|
||||
/**
|
||||
* DatabaseTaskStore
|
||||
*
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
* @public
|
||||
*/
|
||||
export type DatabaseTaskStoreOptions = {
|
||||
@@ -86,9 +86,7 @@ export type DatabaseTaskStoreOptions = {
|
||||
|
||||
/**
|
||||
* Type guard to help DatabaseTaskStore understand when database is DatabaseService vs. when database is a Knex instance.
|
||||
*
|
||||
* * @public
|
||||
*/
|
||||
* */
|
||||
function isDatabaseService(
|
||||
opt: DatabaseService | Knex,
|
||||
): opt is DatabaseService {
|
||||
@@ -111,7 +109,7 @@ const parseSqlDateToIsoString = <T>(input: T): T | string => {
|
||||
|
||||
/**
|
||||
* DatabaseTaskStore
|
||||
*
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
* @public
|
||||
*/
|
||||
export class DatabaseTaskStore implements TaskStore {
|
||||
|
||||
@@ -59,7 +59,7 @@ type TaskState = {
|
||||
};
|
||||
/**
|
||||
* TaskManager
|
||||
*
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
* @public
|
||||
*/
|
||||
export class TaskManager implements TaskContext {
|
||||
|
||||
@@ -33,7 +33,7 @@ import { setTimeout } from 'timers/promises';
|
||||
|
||||
/**
|
||||
* TaskWorkerOptions
|
||||
*
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
* @public
|
||||
*/
|
||||
export type TaskWorkerOptions = {
|
||||
@@ -50,7 +50,7 @@ export type TaskWorkerOptions = {
|
||||
|
||||
/**
|
||||
* CreateWorkerOptions
|
||||
*
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
* @public
|
||||
*/
|
||||
export type CreateWorkerOptions = {
|
||||
@@ -81,7 +81,7 @@ export type CreateWorkerOptions = {
|
||||
|
||||
/**
|
||||
* TaskWorker
|
||||
*
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
* @public
|
||||
*/
|
||||
export class TaskWorker {
|
||||
|
||||
@@ -21,19 +21,10 @@ export type { CurrentClaimedTask } from './StorageTaskBroker';
|
||||
export { TaskWorker } from './TaskWorker';
|
||||
export type { CreateWorkerOptions } from './TaskWorker';
|
||||
export type {
|
||||
TaskCompletionState,
|
||||
TaskStoreEmitOptions,
|
||||
TaskStoreListEventsOptions,
|
||||
TaskStoreShutDownTaskOptions,
|
||||
SerializedTask,
|
||||
SerializedTaskEvent,
|
||||
TaskStatus,
|
||||
TaskEventType,
|
||||
TaskBroker,
|
||||
TaskContext,
|
||||
TaskStore,
|
||||
TaskBrokerDispatchResult,
|
||||
TaskBrokerDispatchOptions,
|
||||
TaskStoreCreateTaskOptions,
|
||||
TaskStoreRecoverTaskOptions,
|
||||
TaskStoreCreateTaskResult,
|
||||
|
||||
@@ -17,96 +17,19 @@
|
||||
import { HumanDuration, JsonObject, JsonValue } from '@backstage/types';
|
||||
import { TaskSpec, TaskStep } from '@backstage/plugin-scaffolder-common';
|
||||
import {
|
||||
SerializedTask as _SerializedTask,
|
||||
SerializedTaskEvent as _SerializedTaskEvent,
|
||||
TaskBroker as _TaskBroker,
|
||||
TaskBrokerDispatchOptions as _TaskBrokerDispatchOptions,
|
||||
TaskBrokerDispatchResult as _TaskBrokerDispatchResult,
|
||||
TaskCompletionState as _TaskCompletionState,
|
||||
TaskContext as _TaskContext,
|
||||
TaskEventType as _TaskEventType,
|
||||
TaskSecrets,
|
||||
TaskStatus as _TaskStatus,
|
||||
TemplateAction,
|
||||
TaskContext,
|
||||
SerializedTaskEvent,
|
||||
SerializedTask,
|
||||
TaskStatus,
|
||||
} from '@backstage/plugin-scaffolder-node';
|
||||
|
||||
/**
|
||||
* The status of each step of the Task
|
||||
*
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type TaskStatus = _TaskStatus;
|
||||
|
||||
/**
|
||||
* The state of a completed task.
|
||||
*
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type TaskCompletionState = _TaskCompletionState;
|
||||
|
||||
/**
|
||||
* SerializedTask
|
||||
*
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type SerializedTask = _SerializedTask;
|
||||
|
||||
/**
|
||||
* TaskEventType
|
||||
*
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type TaskEventType = _TaskEventType;
|
||||
|
||||
/**
|
||||
* SerializedTaskEvent
|
||||
*
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type SerializedTaskEvent = _SerializedTaskEvent;
|
||||
|
||||
/**
|
||||
* The result of `TaskBroker.dispatch`.
|
||||
*
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type TaskBrokerDispatchResult = _TaskBrokerDispatchResult;
|
||||
|
||||
/**
|
||||
* The options passed to `TaskBroker.dispatch`.
|
||||
* Currently a spec and optional secrets
|
||||
*
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type TaskBrokerDispatchOptions = _TaskBrokerDispatchOptions;
|
||||
|
||||
/**
|
||||
* Task
|
||||
*
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type TaskContext = _TaskContext;
|
||||
|
||||
/**
|
||||
* TaskBroker
|
||||
*
|
||||
* @public
|
||||
* @deprecated Import from `@backstage/plugin-scaffolder-node` instead.
|
||||
*/
|
||||
export type TaskBroker = _TaskBroker;
|
||||
|
||||
/**
|
||||
* TaskStoreEmitOptions
|
||||
*
|
||||
* @public
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
*/
|
||||
export type TaskStoreEmitOptions<TBody = JsonObject> = {
|
||||
taskId: string;
|
||||
@@ -117,6 +40,7 @@ export type TaskStoreEmitOptions<TBody = JsonObject> = {
|
||||
* TaskStoreListEventsOptions
|
||||
*
|
||||
* @public
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
*/
|
||||
export type TaskStoreListEventsOptions = {
|
||||
isTaskRecoverable?: boolean;
|
||||
@@ -128,6 +52,7 @@ export type TaskStoreListEventsOptions = {
|
||||
* TaskStoreShutDownTaskOptions
|
||||
*
|
||||
* @public
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
*/
|
||||
export type TaskStoreShutDownTaskOptions = {
|
||||
taskId: string;
|
||||
@@ -136,6 +61,7 @@ export type TaskStoreShutDownTaskOptions = {
|
||||
/**
|
||||
* The options passed to {@link TaskStore.createTask}
|
||||
* @public
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
*/
|
||||
export type TaskStoreCreateTaskOptions = {
|
||||
spec: TaskSpec;
|
||||
@@ -146,6 +72,7 @@ export type TaskStoreCreateTaskOptions = {
|
||||
/**
|
||||
* The options passed to {@link TaskStore.recoverTasks}
|
||||
* @public
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
*/
|
||||
export type TaskStoreRecoverTaskOptions = {
|
||||
timeout: HumanDuration;
|
||||
@@ -154,6 +81,7 @@ export type TaskStoreRecoverTaskOptions = {
|
||||
/**
|
||||
* The response from {@link TaskStore.createTask}
|
||||
* @public
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
*/
|
||||
export type TaskStoreCreateTaskResult = {
|
||||
taskId: string;
|
||||
@@ -163,6 +91,7 @@ export type TaskStoreCreateTaskResult = {
|
||||
* TaskStore
|
||||
*
|
||||
* @public
|
||||
* @deprecated this type is deprecated, and there will be a new way to create Workers in the next major version.
|
||||
*/
|
||||
export interface TaskStore {
|
||||
cancelTask?(options: TaskStoreEmitOptions): Promise<void>;
|
||||
|
||||
Reference in New Issue
Block a user