@backstage/plugin-scaffolder-backend 0.16.0 → 0.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/index.d.ts +577 -0
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 0.16.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix for the previous release with missing type declarations.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/backend-common@0.10.9
|
|
10
|
+
- @backstage/catalog-client@0.7.1
|
|
11
|
+
- @backstage/catalog-model@0.10.1
|
|
12
|
+
- @backstage/config@0.1.15
|
|
13
|
+
- @backstage/errors@0.2.2
|
|
14
|
+
- @backstage/integration@0.7.4
|
|
15
|
+
- @backstage/types@0.1.3
|
|
16
|
+
- @backstage/plugin-catalog-backend@0.21.5
|
|
17
|
+
- @backstage/plugin-scaffolder-backend-module-cookiecutter@0.2.1
|
|
18
|
+
- @backstage/plugin-scaffolder-common@0.2.1
|
|
19
|
+
|
|
3
20
|
## 0.16.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { ScmIntegrations, ScmIntegrationRegistry, GithubCredentialsProvider } from '@backstage/integration';
|
|
3
|
+
import { CatalogApi } from '@backstage/catalog-client';
|
|
4
|
+
import { Logger } from 'winston';
|
|
5
|
+
import { Writable } from 'stream';
|
|
6
|
+
import { JsonValue, JsonObject } from '@backstage/types';
|
|
7
|
+
import { Schema } from 'jsonschema';
|
|
8
|
+
import { TaskSpec, TemplateMetadata } from '@backstage/plugin-scaffolder-common';
|
|
9
|
+
export { TaskSpec, TaskSpecV1beta2, TaskSpecV1beta3, TemplateMetadata } from '@backstage/plugin-scaffolder-common';
|
|
10
|
+
import { Entity, LocationSpec } from '@backstage/catalog-model';
|
|
11
|
+
import { UrlReader, ContainerRunner, PluginDatabaseManager } from '@backstage/backend-common';
|
|
12
|
+
import { Config } from '@backstage/config';
|
|
13
|
+
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
|
14
|
+
import { Octokit } from 'octokit';
|
|
15
|
+
export { createFetchCookiecutterAction } from '@backstage/plugin-scaffolder-backend-module-cookiecutter';
|
|
16
|
+
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
17
|
+
import { Knex } from 'knex';
|
|
18
|
+
import express from 'express';
|
|
19
|
+
import { CatalogProcessor, CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
|
|
20
|
+
|
|
21
|
+
declare function createCatalogRegisterAction(options: {
|
|
22
|
+
catalogClient: CatalogApi;
|
|
23
|
+
integrations: ScmIntegrations;
|
|
24
|
+
}): TemplateAction<{
|
|
25
|
+
catalogInfoUrl: string;
|
|
26
|
+
optional?: boolean | undefined;
|
|
27
|
+
} | {
|
|
28
|
+
repoContentsUrl: string;
|
|
29
|
+
catalogInfoPath?: string | undefined;
|
|
30
|
+
optional?: boolean | undefined;
|
|
31
|
+
}>;
|
|
32
|
+
|
|
33
|
+
declare function createCatalogWriteAction(): TemplateAction<{
|
|
34
|
+
filePath?: string | undefined;
|
|
35
|
+
entity: Entity;
|
|
36
|
+
}>;
|
|
37
|
+
|
|
38
|
+
declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Status
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
declare type Status = 'open' | 'processing' | 'failed' | 'cancelled' | 'completed';
|
|
46
|
+
/**
|
|
47
|
+
* CompletedTaskState
|
|
48
|
+
*
|
|
49
|
+
* @public
|
|
50
|
+
*/
|
|
51
|
+
declare type CompletedTaskState = 'failed' | 'completed';
|
|
52
|
+
/**
|
|
53
|
+
* SerializedTask
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
*/
|
|
57
|
+
declare type SerializedTask = {
|
|
58
|
+
id: string;
|
|
59
|
+
spec: TaskSpec;
|
|
60
|
+
status: Status;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
lastHeartbeatAt?: string;
|
|
63
|
+
secrets?: TaskSecrets;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* TaskEventType
|
|
67
|
+
*
|
|
68
|
+
* @public
|
|
69
|
+
*/
|
|
70
|
+
declare type TaskEventType = 'completion' | 'log';
|
|
71
|
+
/**
|
|
72
|
+
* SerializedTaskEvent
|
|
73
|
+
*
|
|
74
|
+
* @public
|
|
75
|
+
*/
|
|
76
|
+
declare type SerializedTaskEvent = {
|
|
77
|
+
id: number;
|
|
78
|
+
taskId: string;
|
|
79
|
+
body: JsonObject;
|
|
80
|
+
type: TaskEventType;
|
|
81
|
+
createdAt: string;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* TaskSecrets
|
|
85
|
+
*
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
declare type TaskSecrets = Record<string, string> & {
|
|
89
|
+
backstageToken?: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* DispatchResult
|
|
93
|
+
*
|
|
94
|
+
* @public
|
|
95
|
+
*/
|
|
96
|
+
declare type DispatchResult = {
|
|
97
|
+
taskId: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Task
|
|
101
|
+
*
|
|
102
|
+
* @public
|
|
103
|
+
*/
|
|
104
|
+
interface TaskContext {
|
|
105
|
+
spec: TaskSpec;
|
|
106
|
+
secrets?: TaskSecrets;
|
|
107
|
+
done: boolean;
|
|
108
|
+
emitLog(message: string, metadata?: JsonValue): Promise<void>;
|
|
109
|
+
complete(result: CompletedTaskState, metadata?: JsonValue): Promise<void>;
|
|
110
|
+
getWorkspaceName(): Promise<string>;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* TaskBroker
|
|
114
|
+
*
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
interface TaskBroker {
|
|
118
|
+
claim(): Promise<TaskContext>;
|
|
119
|
+
dispatch(spec: TaskSpec, secrets?: TaskSecrets): Promise<DispatchResult>;
|
|
120
|
+
vacuumTasks(timeoutS: {
|
|
121
|
+
timeoutS: number;
|
|
122
|
+
}): Promise<void>;
|
|
123
|
+
observe(options: {
|
|
124
|
+
taskId: string;
|
|
125
|
+
after: number | undefined;
|
|
126
|
+
}, callback: (error: Error | undefined, result: {
|
|
127
|
+
events: SerializedTaskEvent[];
|
|
128
|
+
}) => void): {
|
|
129
|
+
unsubscribe: () => void;
|
|
130
|
+
};
|
|
131
|
+
get(taskId: string): Promise<SerializedTask>;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* TaskStoreEmitOptions
|
|
135
|
+
*
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
declare type TaskStoreEmitOptions = {
|
|
139
|
+
taskId: string;
|
|
140
|
+
body: JsonObject;
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* TaskStoreListEventsOptions
|
|
144
|
+
*
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
declare type TaskStoreListEventsOptions = {
|
|
148
|
+
taskId: string;
|
|
149
|
+
after?: number | undefined;
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
* TaskStore
|
|
153
|
+
*
|
|
154
|
+
* @public
|
|
155
|
+
*/
|
|
156
|
+
interface TaskStore {
|
|
157
|
+
createTask(task: TaskSpec, secrets?: TaskSecrets): Promise<{
|
|
158
|
+
taskId: string;
|
|
159
|
+
}>;
|
|
160
|
+
getTask(taskId: string): Promise<SerializedTask>;
|
|
161
|
+
claimTask(): Promise<SerializedTask | undefined>;
|
|
162
|
+
completeTask(options: {
|
|
163
|
+
taskId: string;
|
|
164
|
+
status: Status;
|
|
165
|
+
eventBody: JsonObject;
|
|
166
|
+
}): Promise<void>;
|
|
167
|
+
heartbeatTask(taskId: string): Promise<void>;
|
|
168
|
+
listStaleTasks(options: {
|
|
169
|
+
timeoutS: number;
|
|
170
|
+
}): Promise<{
|
|
171
|
+
tasks: {
|
|
172
|
+
taskId: string;
|
|
173
|
+
}[];
|
|
174
|
+
}>;
|
|
175
|
+
emitLogEvent({ taskId, body }: TaskStoreEmitOptions): Promise<void>;
|
|
176
|
+
listEvents({ taskId, after, }: TaskStoreListEventsOptions): Promise<{
|
|
177
|
+
events: SerializedTaskEvent[];
|
|
178
|
+
}>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
declare type ActionContext<Input extends JsonObject> = {
|
|
182
|
+
/**
|
|
183
|
+
* Base URL for the location of the task spec, typically the url of the source entity file.
|
|
184
|
+
*/
|
|
185
|
+
baseUrl?: string;
|
|
186
|
+
logger: Logger;
|
|
187
|
+
logStream: Writable;
|
|
188
|
+
secrets?: TaskSecrets;
|
|
189
|
+
workspacePath: string;
|
|
190
|
+
input: Input;
|
|
191
|
+
output(name: string, value: JsonValue): void;
|
|
192
|
+
/**
|
|
193
|
+
* Creates a temporary directory for use by the action, which is then cleaned up automatically.
|
|
194
|
+
*/
|
|
195
|
+
createTemporaryDirectory(): Promise<string>;
|
|
196
|
+
metadata?: TemplateMetadata;
|
|
197
|
+
};
|
|
198
|
+
declare type TemplateAction<Input extends JsonObject> = {
|
|
199
|
+
id: string;
|
|
200
|
+
description?: string;
|
|
201
|
+
schema?: {
|
|
202
|
+
input?: Schema;
|
|
203
|
+
output?: Schema;
|
|
204
|
+
};
|
|
205
|
+
handler: (ctx: ActionContext<Input>) => Promise<void>;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
declare const createBuiltinActions: (options: {
|
|
209
|
+
reader: UrlReader;
|
|
210
|
+
integrations: ScmIntegrations;
|
|
211
|
+
catalogClient: CatalogApi;
|
|
212
|
+
containerRunner?: ContainerRunner;
|
|
213
|
+
config: Config;
|
|
214
|
+
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
215
|
+
}) => TemplateAction<JsonObject>[];
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* This task is useful for local development and testing of both the scaffolder
|
|
219
|
+
* and scaffolder templates.
|
|
220
|
+
*/
|
|
221
|
+
declare function createDebugLogAction(): TemplateAction<{
|
|
222
|
+
message?: string | undefined;
|
|
223
|
+
listWorkspace?: boolean | undefined;
|
|
224
|
+
}>;
|
|
225
|
+
|
|
226
|
+
declare function createFetchPlainAction(options: {
|
|
227
|
+
reader: UrlReader;
|
|
228
|
+
integrations: ScmIntegrations;
|
|
229
|
+
}): TemplateAction<{
|
|
230
|
+
url: string;
|
|
231
|
+
targetPath?: string | undefined;
|
|
232
|
+
}>;
|
|
233
|
+
|
|
234
|
+
declare function createFetchTemplateAction(options: {
|
|
235
|
+
reader: UrlReader;
|
|
236
|
+
integrations: ScmIntegrations;
|
|
237
|
+
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
238
|
+
}): TemplateAction<{
|
|
239
|
+
url: string;
|
|
240
|
+
targetPath?: string | undefined;
|
|
241
|
+
values: any;
|
|
242
|
+
templateFileExtension?: string | boolean | undefined;
|
|
243
|
+
copyWithoutRender?: string[] | undefined;
|
|
244
|
+
cookiecutterCompat?: boolean | undefined;
|
|
245
|
+
}>;
|
|
246
|
+
|
|
247
|
+
declare function fetchContents({ reader, integrations, baseUrl, fetchUrl, outputPath, }: {
|
|
248
|
+
reader: UrlReader;
|
|
249
|
+
integrations: ScmIntegrations;
|
|
250
|
+
baseUrl?: string;
|
|
251
|
+
fetchUrl?: JsonValue;
|
|
252
|
+
outputPath: string;
|
|
253
|
+
}): Promise<void>;
|
|
254
|
+
|
|
255
|
+
declare const createFilesystemDeleteAction: () => TemplateAction<{
|
|
256
|
+
files: string[];
|
|
257
|
+
}>;
|
|
258
|
+
|
|
259
|
+
declare const createFilesystemRenameAction: () => TemplateAction<{
|
|
260
|
+
files: Array<{
|
|
261
|
+
from: string;
|
|
262
|
+
to: string;
|
|
263
|
+
overwrite?: boolean;
|
|
264
|
+
}>;
|
|
265
|
+
}>;
|
|
266
|
+
|
|
267
|
+
declare function createPublishAzureAction(options: {
|
|
268
|
+
integrations: ScmIntegrationRegistry;
|
|
269
|
+
config: Config;
|
|
270
|
+
}): TemplateAction<{
|
|
271
|
+
repoUrl: string;
|
|
272
|
+
description?: string | undefined;
|
|
273
|
+
defaultBranch?: string | undefined;
|
|
274
|
+
sourcePath?: string | undefined;
|
|
275
|
+
token?: string | undefined;
|
|
276
|
+
}>;
|
|
277
|
+
|
|
278
|
+
declare function createPublishBitbucketAction(options: {
|
|
279
|
+
integrations: ScmIntegrationRegistry;
|
|
280
|
+
config: Config;
|
|
281
|
+
}): TemplateAction<{
|
|
282
|
+
repoUrl: string;
|
|
283
|
+
description?: string | undefined;
|
|
284
|
+
defaultBranch?: string | undefined;
|
|
285
|
+
repoVisibility?: "private" | "public" | undefined;
|
|
286
|
+
sourcePath?: string | undefined;
|
|
287
|
+
enableLFS?: boolean | undefined;
|
|
288
|
+
token?: string | undefined;
|
|
289
|
+
}>;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* This task is useful for local development and testing of both the scaffolder
|
|
293
|
+
* and scaffolder templates.
|
|
294
|
+
*
|
|
295
|
+
* This action is not installed by default and should not be installed in
|
|
296
|
+
* production, as it writes the files to the local filesystem of the scaffolder.
|
|
297
|
+
*/
|
|
298
|
+
declare function createPublishFileAction(): TemplateAction<{
|
|
299
|
+
path: string;
|
|
300
|
+
}>;
|
|
301
|
+
|
|
302
|
+
declare function createPublishGithubAction(options: {
|
|
303
|
+
integrations: ScmIntegrationRegistry;
|
|
304
|
+
config: Config;
|
|
305
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
306
|
+
}): TemplateAction<{
|
|
307
|
+
repoUrl: string;
|
|
308
|
+
description?: string | undefined;
|
|
309
|
+
access?: string | undefined;
|
|
310
|
+
defaultBranch?: string | undefined;
|
|
311
|
+
sourcePath?: string | undefined;
|
|
312
|
+
requireCodeOwnerReviews?: boolean | undefined;
|
|
313
|
+
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
314
|
+
collaborators?: {
|
|
315
|
+
username: string;
|
|
316
|
+
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
317
|
+
}[] | undefined;
|
|
318
|
+
token?: string | undefined;
|
|
319
|
+
topics?: string[] | undefined;
|
|
320
|
+
}>;
|
|
321
|
+
|
|
322
|
+
declare type CreatePullRequestResponse = {
|
|
323
|
+
data: {
|
|
324
|
+
html_url: string;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
interface PullRequestCreator {
|
|
328
|
+
createPullRequest(options: createPullRequest.Options): Promise<CreatePullRequestResponse | null>;
|
|
329
|
+
}
|
|
330
|
+
declare type ClientFactoryInput = {
|
|
331
|
+
integrations: ScmIntegrationRegistry;
|
|
332
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
333
|
+
host: string;
|
|
334
|
+
owner: string;
|
|
335
|
+
repo: string;
|
|
336
|
+
token?: string;
|
|
337
|
+
};
|
|
338
|
+
interface CreateGithubPullRequestActionOptions {
|
|
339
|
+
integrations: ScmIntegrationRegistry;
|
|
340
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
341
|
+
clientFactory?: (input: ClientFactoryInput) => Promise<PullRequestCreator>;
|
|
342
|
+
}
|
|
343
|
+
declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction<{
|
|
344
|
+
title: string;
|
|
345
|
+
branchName: string;
|
|
346
|
+
description: string;
|
|
347
|
+
repoUrl: string;
|
|
348
|
+
targetPath?: string | undefined;
|
|
349
|
+
sourcePath?: string | undefined;
|
|
350
|
+
token?: string | undefined;
|
|
351
|
+
}>;
|
|
352
|
+
|
|
353
|
+
declare function createPublishGitlabAction(options: {
|
|
354
|
+
integrations: ScmIntegrationRegistry;
|
|
355
|
+
config: Config;
|
|
356
|
+
}): TemplateAction<{
|
|
357
|
+
repoUrl: string;
|
|
358
|
+
defaultBranch?: string | undefined;
|
|
359
|
+
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
360
|
+
sourcePath?: string | undefined;
|
|
361
|
+
token?: string | undefined;
|
|
362
|
+
}>;
|
|
363
|
+
|
|
364
|
+
declare const createPublishGitlabMergeRequestAction: (options: {
|
|
365
|
+
integrations: ScmIntegrationRegistry;
|
|
366
|
+
}) => TemplateAction<{
|
|
367
|
+
projectid: string;
|
|
368
|
+
repoUrl: string;
|
|
369
|
+
title: string;
|
|
370
|
+
description: string;
|
|
371
|
+
branchName: string;
|
|
372
|
+
targetPath: string;
|
|
373
|
+
token?: string | undefined;
|
|
374
|
+
}>;
|
|
375
|
+
|
|
376
|
+
declare function createGithubActionsDispatchAction(options: {
|
|
377
|
+
integrations: ScmIntegrations;
|
|
378
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
379
|
+
}): TemplateAction<{
|
|
380
|
+
repoUrl: string;
|
|
381
|
+
workflowId: string;
|
|
382
|
+
branchOrTagName: string;
|
|
383
|
+
workflowInputs?: {
|
|
384
|
+
[key: string]: string;
|
|
385
|
+
} | undefined;
|
|
386
|
+
token?: string | undefined;
|
|
387
|
+
}>;
|
|
388
|
+
|
|
389
|
+
declare function createGithubWebhookAction(options: {
|
|
390
|
+
integrations: ScmIntegrationRegistry;
|
|
391
|
+
defaultWebhookSecret?: string;
|
|
392
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
393
|
+
}): TemplateAction<{
|
|
394
|
+
repoUrl: string;
|
|
395
|
+
webhookUrl: string;
|
|
396
|
+
webhookSecret?: string | undefined;
|
|
397
|
+
events?: string[] | undefined;
|
|
398
|
+
active?: boolean | undefined;
|
|
399
|
+
contentType?: "form" | "json" | undefined;
|
|
400
|
+
insecureSsl?: boolean | undefined;
|
|
401
|
+
token?: string | undefined;
|
|
402
|
+
}>;
|
|
403
|
+
|
|
404
|
+
declare type OctokitIntegration = {
|
|
405
|
+
client: Octokit;
|
|
406
|
+
token: string;
|
|
407
|
+
owner: string;
|
|
408
|
+
repo: string;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* OctokitProvider provides Octokit client based on ScmIntegrationsRegistry configuration.
|
|
412
|
+
* OctokitProvider supports GitHub credentials caching out of the box.
|
|
413
|
+
*/
|
|
414
|
+
declare class OctokitProvider {
|
|
415
|
+
private readonly integrations;
|
|
416
|
+
private readonly githubCredentialsProvider;
|
|
417
|
+
constructor(integrations: ScmIntegrationRegistry, githubCredentialsProvider?: GithubCredentialsProvider);
|
|
418
|
+
/**
|
|
419
|
+
* gets standard Octokit client based on repository URL.
|
|
420
|
+
*
|
|
421
|
+
* @param repoUrl - Repository URL
|
|
422
|
+
*/
|
|
423
|
+
getOctokit(repoUrl: string, options?: {
|
|
424
|
+
token?: string;
|
|
425
|
+
}): Promise<OctokitIntegration>;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
declare type RunCommandOptions = {
|
|
429
|
+
/** command to run */
|
|
430
|
+
command: string;
|
|
431
|
+
/** arguments to pass the command */
|
|
432
|
+
args: string[];
|
|
433
|
+
/** options to pass to spawn */
|
|
434
|
+
options?: SpawnOptionsWithoutStdio;
|
|
435
|
+
/** stream to capture stdout and stderr output */
|
|
436
|
+
logStream?: Writable;
|
|
437
|
+
};
|
|
438
|
+
/**
|
|
439
|
+
* Run a command in a sub-process, normally a shell command.
|
|
440
|
+
*/
|
|
441
|
+
declare const runCommand: ({ command, args, logStream, options, }: RunCommandOptions) => Promise<void>;
|
|
442
|
+
|
|
443
|
+
declare class TemplateActionRegistry {
|
|
444
|
+
private readonly actions;
|
|
445
|
+
register<TInput extends JsonObject>(action: TemplateAction<TInput>): void;
|
|
446
|
+
get(actionId: string): TemplateAction<JsonObject>;
|
|
447
|
+
list(): TemplateAction<JsonObject>[];
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* DatabaseTaskStore
|
|
454
|
+
*
|
|
455
|
+
* @public
|
|
456
|
+
*/
|
|
457
|
+
declare type DatabaseTaskStoreOptions = {
|
|
458
|
+
database: Knex;
|
|
459
|
+
};
|
|
460
|
+
/**
|
|
461
|
+
* DatabaseTaskStore
|
|
462
|
+
*
|
|
463
|
+
* @public
|
|
464
|
+
*/
|
|
465
|
+
declare class DatabaseTaskStore implements TaskStore {
|
|
466
|
+
private readonly db;
|
|
467
|
+
static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
|
|
468
|
+
constructor(options: DatabaseTaskStoreOptions);
|
|
469
|
+
getTask(taskId: string): Promise<SerializedTask>;
|
|
470
|
+
createTask(spec: TaskSpec, secrets?: TaskSecrets): Promise<{
|
|
471
|
+
taskId: string;
|
|
472
|
+
}>;
|
|
473
|
+
claimTask(): Promise<SerializedTask | undefined>;
|
|
474
|
+
heartbeatTask(taskId: string): Promise<void>;
|
|
475
|
+
listStaleTasks({ timeoutS }: {
|
|
476
|
+
timeoutS: number;
|
|
477
|
+
}): Promise<{
|
|
478
|
+
tasks: {
|
|
479
|
+
taskId: string;
|
|
480
|
+
}[];
|
|
481
|
+
}>;
|
|
482
|
+
completeTask({ taskId, status, eventBody, }: {
|
|
483
|
+
taskId: string;
|
|
484
|
+
status: Status;
|
|
485
|
+
eventBody: JsonObject;
|
|
486
|
+
}): Promise<void>;
|
|
487
|
+
emitLogEvent({ taskId, body }: TaskStoreEmitOptions): Promise<void>;
|
|
488
|
+
listEvents({ taskId, after, }: TaskStoreListEventsOptions): Promise<{
|
|
489
|
+
events: SerializedTaskEvent[];
|
|
490
|
+
}>;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* TaskManager
|
|
495
|
+
*
|
|
496
|
+
* @public
|
|
497
|
+
*/
|
|
498
|
+
declare class TaskManager implements TaskContext {
|
|
499
|
+
private readonly state;
|
|
500
|
+
private readonly storage;
|
|
501
|
+
private readonly logger;
|
|
502
|
+
private isDone;
|
|
503
|
+
private heartbeatTimeoutId?;
|
|
504
|
+
static create(state: TaskState, storage: TaskStore, logger: Logger): TaskManager;
|
|
505
|
+
private constructor();
|
|
506
|
+
get spec(): TaskSpec;
|
|
507
|
+
get secrets(): TaskSecrets | undefined;
|
|
508
|
+
getWorkspaceName(): Promise<string>;
|
|
509
|
+
get done(): boolean;
|
|
510
|
+
emitLog(message: string, metadata?: JsonObject): Promise<void>;
|
|
511
|
+
complete(result: CompletedTaskState, metadata?: JsonObject): Promise<void>;
|
|
512
|
+
private startTimeout;
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* TaskState
|
|
516
|
+
*
|
|
517
|
+
* @public
|
|
518
|
+
*/
|
|
519
|
+
interface TaskState {
|
|
520
|
+
spec: TaskSpec;
|
|
521
|
+
taskId: string;
|
|
522
|
+
secrets?: TaskSecrets;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* CreateWorkerOptions
|
|
527
|
+
*
|
|
528
|
+
* @public
|
|
529
|
+
*/
|
|
530
|
+
declare type CreateWorkerOptions = {
|
|
531
|
+
taskBroker: TaskBroker;
|
|
532
|
+
actionRegistry: TemplateActionRegistry;
|
|
533
|
+
integrations: ScmIntegrations;
|
|
534
|
+
workingDirectory: string;
|
|
535
|
+
logger: Logger;
|
|
536
|
+
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
537
|
+
};
|
|
538
|
+
/**
|
|
539
|
+
* TaskWorker
|
|
540
|
+
*
|
|
541
|
+
* @public
|
|
542
|
+
*/
|
|
543
|
+
declare class TaskWorker {
|
|
544
|
+
private readonly options;
|
|
545
|
+
private constructor();
|
|
546
|
+
static create(options: CreateWorkerOptions): Promise<TaskWorker>;
|
|
547
|
+
start(): void;
|
|
548
|
+
runOneTask(task: TaskContext): Promise<void>;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* RouterOptions
|
|
553
|
+
*
|
|
554
|
+
* @public
|
|
555
|
+
*/
|
|
556
|
+
interface RouterOptions {
|
|
557
|
+
logger: Logger;
|
|
558
|
+
config: Config;
|
|
559
|
+
reader: UrlReader;
|
|
560
|
+
database: PluginDatabaseManager;
|
|
561
|
+
catalogClient: CatalogApi;
|
|
562
|
+
actions?: TemplateAction<any>[];
|
|
563
|
+
taskWorkers?: number;
|
|
564
|
+
containerRunner?: ContainerRunner;
|
|
565
|
+
taskBroker?: TaskBroker;
|
|
566
|
+
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
567
|
+
}
|
|
568
|
+
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
569
|
+
|
|
570
|
+
/** @public */
|
|
571
|
+
declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
|
|
572
|
+
private readonly validators;
|
|
573
|
+
validateEntityKind(entity: Entity): Promise<boolean>;
|
|
574
|
+
postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
export { ActionContext, CompletedTaskState, CreateWorkerOptions, DatabaseTaskStore, DispatchResult, OctokitProvider, RouterOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, Status, TaskBroker, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskState, TaskStore, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishFileAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, fetchContents, runCommand };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend",
|
|
3
3
|
"description": "The Backstage backend plugin that helps you create new things",
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.1",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"build:assets": "node scripts/build-nunjucks.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@backstage/backend-common": "^0.10.
|
|
38
|
-
"@backstage/catalog-client": "^0.7.
|
|
39
|
-
"@backstage/catalog-model": "^0.10.
|
|
40
|
-
"@backstage/config": "^0.1.
|
|
41
|
-
"@backstage/errors": "^0.2.
|
|
42
|
-
"@backstage/integration": "^0.7.
|
|
43
|
-
"@backstage/plugin-catalog-backend": "^0.21.
|
|
44
|
-
"@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.2.
|
|
45
|
-
"@backstage/plugin-scaffolder-common": "^0.2.
|
|
46
|
-
"@backstage/types": "^0.1.
|
|
37
|
+
"@backstage/backend-common": "^0.10.9",
|
|
38
|
+
"@backstage/catalog-client": "^0.7.1",
|
|
39
|
+
"@backstage/catalog-model": "^0.10.1",
|
|
40
|
+
"@backstage/config": "^0.1.15",
|
|
41
|
+
"@backstage/errors": "^0.2.2",
|
|
42
|
+
"@backstage/integration": "^0.7.4",
|
|
43
|
+
"@backstage/plugin-catalog-backend": "^0.21.5",
|
|
44
|
+
"@backstage/plugin-scaffolder-backend-module-cookiecutter": "^0.2.1",
|
|
45
|
+
"@backstage/plugin-scaffolder-common": "^0.2.1",
|
|
46
|
+
"@backstage/types": "^0.1.3",
|
|
47
47
|
"@gitbeaker/core": "^34.6.0",
|
|
48
48
|
"@gitbeaker/node": "^35.1.0",
|
|
49
49
|
"@octokit/webhooks": "^9.14.1",
|
|
@@ -97,5 +97,5 @@
|
|
|
97
97
|
"assets"
|
|
98
98
|
],
|
|
99
99
|
"configSchema": "config.d.ts",
|
|
100
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "e244b348c473700e7d5e5fbcef38bd9f9fd1d0ba"
|
|
101
101
|
}
|