@backstage/plugin-scaffolder-backend 1.4.0-next.0 → 1.4.0-next.3
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 +64 -2
- package/alpha/package.json +6 -0
- package/dist/index.alpha.d.ts +959 -0
- package/dist/index.beta.d.ts +955 -0
- package/dist/index.cjs.js +1629 -1425
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +657 -553
- package/package.json +24 -20
package/dist/index.d.ts
CHANGED
|
@@ -1,231 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Backstage backend plugin that helps you create new things
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
/// <reference types="node" />
|
|
2
|
-
|
|
8
|
+
|
|
9
|
+
import { BackendRegistrable } from '@backstage/backend-plugin-api';
|
|
3
10
|
import { CatalogApi } from '@backstage/catalog-client';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { JsonValue, JsonObject, Observable } from '@backstage/types';
|
|
7
|
-
import { Schema } from 'jsonschema';
|
|
8
|
-
import * as _backstage_plugin_scaffolder_common from '@backstage/plugin-scaffolder-common';
|
|
9
|
-
import { TaskSpec, TemplateInfo } from '@backstage/plugin-scaffolder-common';
|
|
10
|
-
import { Entity } from '@backstage/catalog-model';
|
|
11
|
-
import { UrlReader, PluginDatabaseManager } from '@backstage/backend-common';
|
|
11
|
+
import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
|
|
12
|
+
import { CatalogProcessorEmit } from '@backstage/plugin-catalog-backend';
|
|
12
13
|
import { Config } from '@backstage/config';
|
|
13
14
|
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
|
14
|
-
import {
|
|
15
|
-
import { Knex } from 'knex';
|
|
15
|
+
import { Entity } from '@backstage/catalog-model';
|
|
16
16
|
import express from 'express';
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Writes a catalog descriptor file containing the provided entity to a path in the workspace.
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
|
-
declare function createCatalogWriteAction(): TemplateAction<{
|
|
40
|
-
filePath?: string | undefined;
|
|
41
|
-
entity: Entity;
|
|
42
|
-
}>;
|
|
43
|
-
|
|
44
|
-
/** @public */
|
|
45
|
-
declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* The status of each step of the Task
|
|
49
|
-
*
|
|
50
|
-
* @public
|
|
51
|
-
*/
|
|
52
|
-
declare type TaskStatus = 'open' | 'processing' | 'failed' | 'cancelled' | 'completed';
|
|
53
|
-
/**
|
|
54
|
-
* The state of a completed task.
|
|
55
|
-
*
|
|
56
|
-
* @public
|
|
57
|
-
*/
|
|
58
|
-
declare type TaskCompletionState = 'failed' | 'completed';
|
|
59
|
-
/**
|
|
60
|
-
* SerializedTask
|
|
61
|
-
*
|
|
62
|
-
* @public
|
|
63
|
-
*/
|
|
64
|
-
declare type SerializedTask = {
|
|
65
|
-
id: string;
|
|
66
|
-
spec: TaskSpec;
|
|
67
|
-
status: TaskStatus;
|
|
68
|
-
createdAt: string;
|
|
69
|
-
lastHeartbeatAt?: string;
|
|
70
|
-
createdBy?: string;
|
|
71
|
-
secrets?: TaskSecrets;
|
|
72
|
-
};
|
|
73
|
-
/**
|
|
74
|
-
* TaskEventType
|
|
75
|
-
*
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
|
-
declare type TaskEventType = 'completion' | 'log';
|
|
79
|
-
/**
|
|
80
|
-
* SerializedTaskEvent
|
|
81
|
-
*
|
|
82
|
-
* @public
|
|
83
|
-
*/
|
|
84
|
-
declare type SerializedTaskEvent = {
|
|
85
|
-
id: number;
|
|
86
|
-
taskId: string;
|
|
87
|
-
body: JsonObject;
|
|
88
|
-
type: TaskEventType;
|
|
89
|
-
createdAt: string;
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* TaskSecrets
|
|
93
|
-
*
|
|
94
|
-
* @public
|
|
95
|
-
*/
|
|
96
|
-
declare type TaskSecrets = Record<string, string> & {
|
|
97
|
-
backstageToken?: string;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* The result of {@link TaskBroker.dispatch}
|
|
101
|
-
*
|
|
102
|
-
* @public
|
|
103
|
-
*/
|
|
104
|
-
declare type TaskBrokerDispatchResult = {
|
|
105
|
-
taskId: string;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* The options passed to {@link TaskBroker.dispatch}
|
|
109
|
-
* Currently a spec and optional secrets
|
|
110
|
-
*
|
|
111
|
-
* @public
|
|
112
|
-
*/
|
|
113
|
-
declare type TaskBrokerDispatchOptions = {
|
|
114
|
-
spec: TaskSpec;
|
|
115
|
-
secrets?: TaskSecrets;
|
|
116
|
-
createdBy?: string;
|
|
117
|
-
};
|
|
118
|
-
/**
|
|
119
|
-
* Task
|
|
120
|
-
*
|
|
121
|
-
* @public
|
|
122
|
-
*/
|
|
123
|
-
interface TaskContext {
|
|
124
|
-
spec: TaskSpec;
|
|
125
|
-
secrets?: TaskSecrets;
|
|
126
|
-
createdBy?: string;
|
|
127
|
-
done: boolean;
|
|
128
|
-
isDryRun?: boolean;
|
|
129
|
-
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
|
|
130
|
-
complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
|
|
131
|
-
getWorkspaceName(): Promise<string>;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* TaskBroker
|
|
135
|
-
*
|
|
136
|
-
* @public
|
|
137
|
-
*/
|
|
138
|
-
interface TaskBroker {
|
|
139
|
-
claim(): Promise<TaskContext>;
|
|
140
|
-
dispatch(options: TaskBrokerDispatchOptions): Promise<TaskBrokerDispatchResult>;
|
|
141
|
-
vacuumTasks(options: {
|
|
142
|
-
timeoutS: number;
|
|
143
|
-
}): Promise<void>;
|
|
144
|
-
event$(options: {
|
|
145
|
-
taskId: string;
|
|
146
|
-
after: number | undefined;
|
|
147
|
-
}): Observable<{
|
|
148
|
-
events: SerializedTaskEvent[];
|
|
149
|
-
}>;
|
|
150
|
-
get(taskId: string): Promise<SerializedTask>;
|
|
151
|
-
list?(options?: {
|
|
152
|
-
createdBy?: string;
|
|
153
|
-
}): Promise<{
|
|
154
|
-
tasks: SerializedTask[];
|
|
155
|
-
}>;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* TaskStoreEmitOptions
|
|
159
|
-
*
|
|
160
|
-
* @public
|
|
161
|
-
*/
|
|
162
|
-
declare type TaskStoreEmitOptions<TBody = JsonObject> = {
|
|
163
|
-
taskId: string;
|
|
164
|
-
body: TBody;
|
|
165
|
-
};
|
|
166
|
-
/**
|
|
167
|
-
* TaskStoreListEventsOptions
|
|
168
|
-
*
|
|
169
|
-
* @public
|
|
170
|
-
*/
|
|
171
|
-
declare type TaskStoreListEventsOptions = {
|
|
172
|
-
taskId: string;
|
|
173
|
-
after?: number | undefined;
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* The options passed to {@link TaskStore.createTask}
|
|
177
|
-
* @public
|
|
178
|
-
*/
|
|
179
|
-
declare type TaskStoreCreateTaskOptions = {
|
|
180
|
-
spec: TaskSpec;
|
|
181
|
-
createdBy?: string;
|
|
182
|
-
secrets?: TaskSecrets;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* The response from {@link TaskStore.createTask}
|
|
186
|
-
* @public
|
|
187
|
-
*/
|
|
188
|
-
declare type TaskStoreCreateTaskResult = {
|
|
189
|
-
taskId: string;
|
|
190
|
-
};
|
|
191
|
-
/**
|
|
192
|
-
* TaskStore
|
|
193
|
-
*
|
|
194
|
-
* @public
|
|
195
|
-
*/
|
|
196
|
-
interface TaskStore {
|
|
197
|
-
createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
|
|
198
|
-
getTask(taskId: string): Promise<SerializedTask>;
|
|
199
|
-
claimTask(): Promise<SerializedTask | undefined>;
|
|
200
|
-
completeTask(options: {
|
|
201
|
-
taskId: string;
|
|
202
|
-
status: TaskStatus;
|
|
203
|
-
eventBody: JsonObject;
|
|
204
|
-
}): Promise<void>;
|
|
205
|
-
heartbeatTask(taskId: string): Promise<void>;
|
|
206
|
-
listStaleTasks(options: {
|
|
207
|
-
timeoutS: number;
|
|
208
|
-
}): Promise<{
|
|
209
|
-
tasks: {
|
|
210
|
-
taskId: string;
|
|
211
|
-
}[];
|
|
212
|
-
}>;
|
|
213
|
-
list?(options: {
|
|
214
|
-
createdBy?: string;
|
|
215
|
-
}): Promise<{
|
|
216
|
-
tasks: SerializedTask[];
|
|
217
|
-
}>;
|
|
218
|
-
emitLogEvent({ taskId, body }: TaskStoreEmitOptions): Promise<void>;
|
|
219
|
-
listEvents({ taskId, after, }: TaskStoreListEventsOptions): Promise<{
|
|
220
|
-
events: SerializedTaskEvent[];
|
|
221
|
-
}>;
|
|
222
|
-
}
|
|
17
|
+
import { GithubCredentialsProvider } from '@backstage/integration';
|
|
18
|
+
import { JsonObject } from '@backstage/types';
|
|
19
|
+
import { JsonValue } from '@backstage/types';
|
|
20
|
+
import { Knex } from 'knex';
|
|
21
|
+
import { LocationSpec } from '@backstage/plugin-catalog-backend';
|
|
22
|
+
import { Logger } from 'winston';
|
|
23
|
+
import { Observable } from '@backstage/types';
|
|
24
|
+
import { PluginDatabaseManager } from '@backstage/backend-common';
|
|
25
|
+
import { Schema } from 'jsonschema';
|
|
26
|
+
import { ScmIntegrationRegistry } from '@backstage/integration';
|
|
27
|
+
import { ScmIntegrations } from '@backstage/integration';
|
|
28
|
+
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
29
|
+
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
|
|
30
|
+
import { TaskSpecV1beta3 } from '@backstage/plugin-scaffolder-common';
|
|
31
|
+
import { TemplateInfo } from '@backstage/plugin-scaffolder-common';
|
|
32
|
+
import { UrlReader } from '@backstage/backend-common';
|
|
33
|
+
import { Writable } from 'stream';
|
|
223
34
|
|
|
224
35
|
/**
|
|
225
36
|
* ActionContext is passed into scaffolder actions.
|
|
226
37
|
* @public
|
|
227
38
|
*/
|
|
228
|
-
declare type ActionContext<Input extends JsonObject> = {
|
|
39
|
+
export declare type ActionContext<Input extends JsonObject> = {
|
|
229
40
|
logger: Logger;
|
|
230
41
|
logStream: Writable;
|
|
231
42
|
secrets?: TaskSecrets;
|
|
@@ -243,23 +54,21 @@ declare type ActionContext<Input extends JsonObject> = {
|
|
|
243
54
|
*/
|
|
244
55
|
isDryRun?: boolean;
|
|
245
56
|
};
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
handler: (ctx: ActionContext<Input>) => Promise<void>;
|
|
256
|
-
};
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A function to generate create a list of default actions that the scaffolder provides.
|
|
60
|
+
* Is called internally in the default setup, but can be used when adding your own actions or overriding the default ones
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
* @returns A list of actions that can be used in the scaffolder
|
|
64
|
+
*/
|
|
65
|
+
export declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction<JsonObject>[];
|
|
257
66
|
|
|
258
67
|
/**
|
|
259
68
|
* The options passed to {@link createBuiltinActions}
|
|
260
69
|
* @public
|
|
261
70
|
*/
|
|
262
|
-
interface CreateBuiltInActionsOptions {
|
|
71
|
+
export declare interface CreateBuiltInActionsOptions {
|
|
263
72
|
/**
|
|
264
73
|
* The {@link @backstage/backend-common#UrlReader} interface that will be used in the default actions.
|
|
265
74
|
*/
|
|
@@ -282,14 +91,31 @@ interface CreateBuiltInActionsOptions {
|
|
|
282
91
|
*/
|
|
283
92
|
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
284
93
|
}
|
|
94
|
+
|
|
285
95
|
/**
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
|
|
96
|
+
* Registers entities from a catalog descriptor file in the workspace into the software catalog.
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
export declare function createCatalogRegisterAction(options: {
|
|
100
|
+
catalogClient: CatalogApi;
|
|
101
|
+
integrations: ScmIntegrations;
|
|
102
|
+
}): TemplateAction< {
|
|
103
|
+
catalogInfoUrl: string;
|
|
104
|
+
optional?: boolean | undefined;
|
|
105
|
+
} | {
|
|
106
|
+
repoContentsUrl: string;
|
|
107
|
+
catalogInfoPath?: string | undefined;
|
|
108
|
+
optional?: boolean | undefined;
|
|
109
|
+
}>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Writes a catalog descriptor file containing the provided entity to a path in the workspace.
|
|
289
113
|
* @public
|
|
290
|
-
* @returns A list of actions that can be used in the scaffolder
|
|
291
114
|
*/
|
|
292
|
-
declare
|
|
115
|
+
export declare function createCatalogWriteAction(): TemplateAction< {
|
|
116
|
+
filePath?: string | undefined;
|
|
117
|
+
entity: Entity;
|
|
118
|
+
}>;
|
|
293
119
|
|
|
294
120
|
/**
|
|
295
121
|
* Writes a message into the log or lists all files in the workspace
|
|
@@ -301,9 +127,9 @@ declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => Te
|
|
|
301
127
|
*
|
|
302
128
|
* @public
|
|
303
129
|
*/
|
|
304
|
-
declare function createDebugLogAction(): TemplateAction<{
|
|
305
|
-
|
|
306
|
-
|
|
130
|
+
export declare function createDebugLogAction(): TemplateAction< {
|
|
131
|
+
message?: string | undefined;
|
|
132
|
+
listWorkspace?: boolean | undefined;
|
|
307
133
|
}>;
|
|
308
134
|
|
|
309
135
|
/**
|
|
@@ -311,12 +137,12 @@ declare function createDebugLogAction(): TemplateAction<{
|
|
|
311
137
|
* in a subdirectory specified by the 'targetPath' input option.
|
|
312
138
|
* @public
|
|
313
139
|
*/
|
|
314
|
-
declare function createFetchPlainAction(options: {
|
|
140
|
+
export declare function createFetchPlainAction(options: {
|
|
315
141
|
reader: UrlReader;
|
|
316
142
|
integrations: ScmIntegrations;
|
|
317
|
-
}): TemplateAction<{
|
|
318
|
-
|
|
319
|
-
|
|
143
|
+
}): TemplateAction< {
|
|
144
|
+
url: string;
|
|
145
|
+
targetPath?: string | undefined;
|
|
320
146
|
}>;
|
|
321
147
|
|
|
322
148
|
/**
|
|
@@ -326,394 +152,442 @@ declare function createFetchPlainAction(options: {
|
|
|
326
152
|
*
|
|
327
153
|
* @public
|
|
328
154
|
*/
|
|
329
|
-
declare function createFetchTemplateAction(options: {
|
|
155
|
+
export declare function createFetchTemplateAction(options: {
|
|
330
156
|
reader: UrlReader;
|
|
331
157
|
integrations: ScmIntegrations;
|
|
332
158
|
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
333
|
-
}): TemplateAction<{
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
159
|
+
}): TemplateAction< {
|
|
160
|
+
url: string;
|
|
161
|
+
targetPath?: string | undefined;
|
|
162
|
+
values: any;
|
|
163
|
+
templateFileExtension?: string | boolean | undefined;
|
|
164
|
+
copyWithoutRender?: string[] | undefined;
|
|
165
|
+
cookiecutterCompat?: boolean | undefined;
|
|
340
166
|
}>;
|
|
341
167
|
|
|
342
|
-
/**
|
|
343
|
-
* A helper function that reads the contents of a directory from the given URL.
|
|
344
|
-
* Can be used in your own actions, and also used behind fetch:template and fetch:plain
|
|
345
|
-
*
|
|
346
|
-
* @public
|
|
347
|
-
*/
|
|
348
|
-
declare function fetchContents({ reader, integrations, baseUrl, fetchUrl, outputPath, }: {
|
|
349
|
-
reader: UrlReader;
|
|
350
|
-
integrations: ScmIntegrations;
|
|
351
|
-
baseUrl?: string;
|
|
352
|
-
fetchUrl?: string;
|
|
353
|
-
outputPath: string;
|
|
354
|
-
}): Promise<void>;
|
|
355
|
-
|
|
356
168
|
/**
|
|
357
169
|
* Creates new action that enables deletion of files and directories in the workspace.
|
|
358
170
|
* @public
|
|
359
171
|
*/
|
|
360
|
-
declare const createFilesystemDeleteAction: () => TemplateAction<{
|
|
361
|
-
|
|
172
|
+
export declare const createFilesystemDeleteAction: () => TemplateAction< {
|
|
173
|
+
files: string[];
|
|
362
174
|
}>;
|
|
363
175
|
|
|
364
176
|
/**
|
|
365
177
|
* Creates a new action that allows renames of files and directories in the workspace.
|
|
366
178
|
* @public
|
|
367
179
|
*/
|
|
368
|
-
declare const createFilesystemRenameAction: () => TemplateAction<{
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
180
|
+
export declare const createFilesystemRenameAction: () => TemplateAction< {
|
|
181
|
+
files: Array<{
|
|
182
|
+
from: string;
|
|
183
|
+
to: string;
|
|
184
|
+
overwrite?: boolean;
|
|
185
|
+
}>;
|
|
374
186
|
}>;
|
|
375
187
|
|
|
376
188
|
/**
|
|
377
|
-
* Creates a new action that
|
|
378
|
-
* and publishes it to Azure.
|
|
189
|
+
* Creates a new action that dispatches a GitHub Action workflow for a given branch or tag.
|
|
379
190
|
* @public
|
|
380
191
|
*/
|
|
381
|
-
declare function
|
|
382
|
-
integrations:
|
|
383
|
-
|
|
384
|
-
}): TemplateAction<{
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
gitAuthorEmail?: string | undefined;
|
|
192
|
+
export declare function createGithubActionsDispatchAction(options: {
|
|
193
|
+
integrations: ScmIntegrations;
|
|
194
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
195
|
+
}): TemplateAction< {
|
|
196
|
+
repoUrl: string;
|
|
197
|
+
workflowId: string;
|
|
198
|
+
branchOrTagName: string;
|
|
199
|
+
workflowInputs?: {
|
|
200
|
+
[key: string]: string;
|
|
201
|
+
} | undefined;
|
|
202
|
+
token?: string | undefined;
|
|
393
203
|
}>;
|
|
394
204
|
|
|
395
205
|
/**
|
|
396
|
-
*
|
|
397
|
-
* and publishes it to Bitbucket.
|
|
206
|
+
* Adds labels to a pull request or issue on GitHub
|
|
398
207
|
* @public
|
|
399
|
-
* @deprecated in favor of createPublishBitbucketCloudAction and createPublishBitbucketServerAction
|
|
400
208
|
*/
|
|
401
|
-
declare function
|
|
209
|
+
export declare function createGithubIssuesLabelAction(options: {
|
|
402
210
|
integrations: ScmIntegrationRegistry;
|
|
403
|
-
|
|
404
|
-
}): TemplateAction<{
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
sourcePath?: string | undefined;
|
|
410
|
-
enableLFS?: boolean | undefined;
|
|
411
|
-
token?: string | undefined;
|
|
412
|
-
gitCommitMessage?: string | undefined;
|
|
413
|
-
gitAuthorName?: string | undefined;
|
|
414
|
-
gitAuthorEmail?: string | undefined;
|
|
211
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
212
|
+
}): TemplateAction< {
|
|
213
|
+
repoUrl: string;
|
|
214
|
+
number: number;
|
|
215
|
+
labels: string[];
|
|
216
|
+
token?: string | undefined;
|
|
415
217
|
}>;
|
|
416
218
|
|
|
417
219
|
/**
|
|
418
|
-
*
|
|
419
|
-
* and publishes it to Bitbucket Cloud.
|
|
220
|
+
* The options passed to {@link createPublishGithubPullRequestAction} method
|
|
420
221
|
* @public
|
|
421
222
|
*/
|
|
422
|
-
declare
|
|
223
|
+
export declare interface CreateGithubPullRequestActionOptions {
|
|
224
|
+
/**
|
|
225
|
+
* An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.
|
|
226
|
+
*/
|
|
423
227
|
integrations: ScmIntegrationRegistry;
|
|
424
|
-
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
228
|
+
/**
|
|
229
|
+
* An instance of {@link @backstage/integration#GithubCredentialsProvider} that will be used to get credentials for the action.
|
|
230
|
+
*/
|
|
231
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
232
|
+
/**
|
|
233
|
+
* A method to return the Octokit client with the Pull Request Plugin.
|
|
234
|
+
*/
|
|
235
|
+
clientFactory?: (input: CreateGithubPullRequestClientFactoryInput) => Promise<OctokitWithPullRequestPluginClient>;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* The options passed to the client factory function.
|
|
240
|
+
* @public
|
|
241
|
+
*/
|
|
242
|
+
export declare type CreateGithubPullRequestClientFactoryInput = {
|
|
243
|
+
integrations: ScmIntegrationRegistry;
|
|
244
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
245
|
+
host: string;
|
|
246
|
+
owner: string;
|
|
247
|
+
repo: string;
|
|
248
|
+
token?: string;
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Creates a new action that initializes a git repository
|
|
253
|
+
*
|
|
254
|
+
* @public
|
|
255
|
+
*/
|
|
256
|
+
export declare function createGithubRepoCreateAction(options: {
|
|
257
|
+
integrations: ScmIntegrationRegistry;
|
|
258
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
259
|
+
}): TemplateAction< {
|
|
260
|
+
repoUrl: string;
|
|
261
|
+
description?: string | undefined;
|
|
262
|
+
access?: string | undefined;
|
|
263
|
+
deleteBranchOnMerge?: boolean | undefined;
|
|
264
|
+
gitAuthorName?: string | undefined;
|
|
265
|
+
gitAuthorEmail?: string | undefined;
|
|
266
|
+
allowRebaseMerge?: boolean | undefined;
|
|
267
|
+
allowSquashMerge?: boolean | undefined;
|
|
268
|
+
allowMergeCommit?: boolean | undefined;
|
|
269
|
+
requireCodeOwnerReviews?: boolean | undefined;
|
|
270
|
+
requiredStatusCheckContexts?: string[] | undefined;
|
|
271
|
+
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
272
|
+
collaborators?: ({
|
|
273
|
+
user: string;
|
|
274
|
+
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
275
|
+
} | {
|
|
276
|
+
team: string;
|
|
277
|
+
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
278
|
+
} | {
|
|
279
|
+
/** @deprecated This field is deprecated in favor of team */
|
|
280
|
+
username: string;
|
|
281
|
+
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
282
|
+
})[] | undefined;
|
|
283
|
+
token?: string | undefined;
|
|
284
|
+
topics?: string[] | undefined;
|
|
432
285
|
}>;
|
|
433
286
|
|
|
434
287
|
/**
|
|
435
288
|
* Creates a new action that initializes a git repository of the content in the workspace
|
|
436
|
-
* and publishes it to
|
|
289
|
+
* and publishes it to GitHub.
|
|
290
|
+
*
|
|
437
291
|
* @public
|
|
438
292
|
*/
|
|
439
|
-
declare function
|
|
293
|
+
export declare function createGithubRepoPushAction(options: {
|
|
440
294
|
integrations: ScmIntegrationRegistry;
|
|
441
295
|
config: Config;
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
296
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
297
|
+
}): TemplateAction< {
|
|
298
|
+
repoUrl: string;
|
|
299
|
+
description?: string | undefined;
|
|
300
|
+
defaultBranch?: string | undefined;
|
|
301
|
+
protectDefaultBranch?: boolean | undefined;
|
|
302
|
+
gitCommitMessage?: string | undefined;
|
|
303
|
+
gitAuthorName?: string | undefined;
|
|
304
|
+
gitAuthorEmail?: string | undefined;
|
|
305
|
+
requireCodeOwnerReviews?: boolean | undefined;
|
|
306
|
+
requiredStatusCheckContexts?: string[] | undefined;
|
|
307
|
+
sourcePath?: string | undefined;
|
|
308
|
+
token?: string | undefined;
|
|
450
309
|
}>;
|
|
451
310
|
|
|
452
311
|
/**
|
|
453
|
-
*
|
|
454
|
-
* and scaffolder templates.
|
|
455
|
-
*
|
|
456
|
-
* @remarks
|
|
457
|
-
*
|
|
458
|
-
* This action is not installed by default and should not be installed in
|
|
459
|
-
* production, as it writes the files to the local filesystem of the scaffolder.
|
|
460
|
-
*
|
|
312
|
+
* Creates new action that creates a webhook for a repository on GitHub.
|
|
461
313
|
* @public
|
|
462
314
|
*/
|
|
463
|
-
declare function
|
|
464
|
-
|
|
315
|
+
export declare function createGithubWebhookAction(options: {
|
|
316
|
+
integrations: ScmIntegrationRegistry;
|
|
317
|
+
defaultWebhookSecret?: string;
|
|
318
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
319
|
+
}): TemplateAction< {
|
|
320
|
+
repoUrl: string;
|
|
321
|
+
webhookUrl: string;
|
|
322
|
+
webhookSecret?: string | undefined;
|
|
323
|
+
events?: string[] | undefined;
|
|
324
|
+
active?: boolean | undefined;
|
|
325
|
+
contentType?: "form" | "json" | undefined;
|
|
326
|
+
insecureSsl?: boolean | undefined;
|
|
327
|
+
token?: string | undefined;
|
|
465
328
|
}>;
|
|
466
329
|
|
|
467
330
|
/**
|
|
468
331
|
* Creates a new action that initializes a git repository of the content in the workspace
|
|
469
|
-
* and publishes it to
|
|
332
|
+
* and publishes it to Azure.
|
|
470
333
|
* @public
|
|
471
334
|
*/
|
|
472
|
-
declare function
|
|
335
|
+
export declare function createPublishAzureAction(options: {
|
|
473
336
|
integrations: ScmIntegrationRegistry;
|
|
474
337
|
config: Config;
|
|
475
|
-
}): TemplateAction<{
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
338
|
+
}): TemplateAction< {
|
|
339
|
+
repoUrl: string;
|
|
340
|
+
description?: string | undefined;
|
|
341
|
+
defaultBranch?: string | undefined;
|
|
342
|
+
sourcePath?: string | undefined;
|
|
343
|
+
token?: string | undefined;
|
|
344
|
+
gitCommitMessage?: string | undefined;
|
|
345
|
+
gitAuthorName?: string | undefined;
|
|
346
|
+
gitAuthorEmail?: string | undefined;
|
|
482
347
|
}>;
|
|
483
348
|
|
|
484
349
|
/**
|
|
485
350
|
* Creates a new action that initializes a git repository of the content in the workspace
|
|
486
|
-
* and publishes it to
|
|
487
|
-
*
|
|
351
|
+
* and publishes it to Bitbucket.
|
|
488
352
|
* @public
|
|
353
|
+
* @deprecated in favor of createPublishBitbucketCloudAction and createPublishBitbucketServerAction
|
|
489
354
|
*/
|
|
490
|
-
declare function
|
|
355
|
+
export declare function createPublishBitbucketAction(options: {
|
|
491
356
|
integrations: ScmIntegrationRegistry;
|
|
492
357
|
config: Config;
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
allowRebaseMerge?: boolean | undefined;
|
|
505
|
-
allowSquashMerge?: boolean | undefined;
|
|
506
|
-
allowMergeCommit?: boolean | undefined;
|
|
507
|
-
sourcePath?: string | undefined;
|
|
508
|
-
requireCodeOwnerReviews?: boolean | undefined;
|
|
509
|
-
requiredStatusCheckContexts?: string[] | undefined;
|
|
510
|
-
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
511
|
-
collaborators?: ({
|
|
512
|
-
user: string;
|
|
513
|
-
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
514
|
-
} | {
|
|
515
|
-
team: string;
|
|
516
|
-
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
517
|
-
} | {
|
|
518
|
-
/** @deprecated This field is deprecated in favor of team */
|
|
519
|
-
username: string;
|
|
520
|
-
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
521
|
-
})[] | undefined;
|
|
522
|
-
token?: string | undefined;
|
|
523
|
-
topics?: string[] | undefined;
|
|
358
|
+
}): TemplateAction< {
|
|
359
|
+
repoUrl: string;
|
|
360
|
+
description?: string | undefined;
|
|
361
|
+
defaultBranch?: string | undefined;
|
|
362
|
+
repoVisibility?: "private" | "public" | undefined;
|
|
363
|
+
sourcePath?: string | undefined;
|
|
364
|
+
enableLFS?: boolean | undefined;
|
|
365
|
+
token?: string | undefined;
|
|
366
|
+
gitCommitMessage?: string | undefined;
|
|
367
|
+
gitAuthorName?: string | undefined;
|
|
368
|
+
gitAuthorEmail?: string | undefined;
|
|
524
369
|
}>;
|
|
525
370
|
|
|
526
|
-
/** @public */
|
|
527
|
-
interface OctokitWithPullRequestPluginClient {
|
|
528
|
-
createPullRequest(options: createPullRequest.Options): Promise<{
|
|
529
|
-
data: {
|
|
530
|
-
html_url: string;
|
|
531
|
-
number: number;
|
|
532
|
-
};
|
|
533
|
-
} | null>;
|
|
534
|
-
}
|
|
535
371
|
/**
|
|
536
|
-
*
|
|
372
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
373
|
+
* and publishes it to Bitbucket Cloud.
|
|
537
374
|
* @public
|
|
538
375
|
*/
|
|
539
|
-
declare
|
|
376
|
+
export declare function createPublishBitbucketCloudAction(options: {
|
|
540
377
|
integrations: ScmIntegrationRegistry;
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
378
|
+
config: Config;
|
|
379
|
+
}): TemplateAction< {
|
|
380
|
+
repoUrl: string;
|
|
381
|
+
description?: string | undefined;
|
|
382
|
+
defaultBranch?: string | undefined;
|
|
383
|
+
repoVisibility?: "private" | "public" | undefined;
|
|
384
|
+
sourcePath?: string | undefined;
|
|
385
|
+
token?: string | undefined;
|
|
386
|
+
}>;
|
|
387
|
+
|
|
547
388
|
/**
|
|
548
|
-
*
|
|
389
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
390
|
+
* and publishes it to Bitbucket Server.
|
|
549
391
|
* @public
|
|
550
392
|
*/
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.
|
|
554
|
-
*/
|
|
393
|
+
export declare function createPublishBitbucketServerAction(options: {
|
|
555
394
|
integrations: ScmIntegrationRegistry;
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
395
|
+
config: Config;
|
|
396
|
+
}): TemplateAction< {
|
|
397
|
+
repoUrl: string;
|
|
398
|
+
description?: string | undefined;
|
|
399
|
+
defaultBranch?: string | undefined;
|
|
400
|
+
repoVisibility?: "private" | "public" | undefined;
|
|
401
|
+
sourcePath?: string | undefined;
|
|
402
|
+
enableLFS?: boolean | undefined;
|
|
403
|
+
token?: string | undefined;
|
|
404
|
+
}>;
|
|
405
|
+
|
|
565
406
|
/**
|
|
566
|
-
*
|
|
407
|
+
* This task is useful for local development and testing of both the scaffolder
|
|
408
|
+
* and scaffolder templates.
|
|
409
|
+
*
|
|
410
|
+
* @remarks
|
|
411
|
+
*
|
|
412
|
+
* This action is not installed by default and should not be installed in
|
|
413
|
+
* production, as it writes the files to the local filesystem of the scaffolder.
|
|
414
|
+
*
|
|
567
415
|
* @public
|
|
568
416
|
*/
|
|
569
|
-
declare
|
|
570
|
-
|
|
571
|
-
branchName: string;
|
|
572
|
-
description: string;
|
|
573
|
-
repoUrl: string;
|
|
574
|
-
draft?: boolean | undefined;
|
|
575
|
-
targetPath?: string | undefined;
|
|
576
|
-
sourcePath?: string | undefined;
|
|
577
|
-
token?: string | undefined;
|
|
417
|
+
export declare function createPublishFileAction(): TemplateAction< {
|
|
418
|
+
path: string;
|
|
578
419
|
}>;
|
|
579
420
|
|
|
580
421
|
/**
|
|
581
422
|
* Creates a new action that initializes a git repository of the content in the workspace
|
|
582
|
-
* and publishes it to
|
|
583
|
-
*
|
|
423
|
+
* and publishes it to a Gerrit instance.
|
|
584
424
|
* @public
|
|
585
425
|
*/
|
|
586
|
-
declare function
|
|
426
|
+
export declare function createPublishGerritAction(options: {
|
|
587
427
|
integrations: ScmIntegrationRegistry;
|
|
588
428
|
config: Config;
|
|
589
|
-
}): TemplateAction<{
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
gitAuthorName?: string | undefined;
|
|
597
|
-
gitAuthorEmail?: string | undefined;
|
|
429
|
+
}): TemplateAction< {
|
|
430
|
+
repoUrl: string;
|
|
431
|
+
description: string;
|
|
432
|
+
defaultBranch?: string | undefined;
|
|
433
|
+
gitCommitMessage?: string | undefined;
|
|
434
|
+
gitAuthorName?: string | undefined;
|
|
435
|
+
gitAuthorEmail?: string | undefined;
|
|
598
436
|
}>;
|
|
599
437
|
|
|
600
438
|
/**
|
|
601
|
-
*
|
|
439
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
440
|
+
* and publishes it to GitHub.
|
|
602
441
|
*
|
|
603
442
|
* @public
|
|
604
443
|
*/
|
|
605
|
-
declare
|
|
444
|
+
export declare function createPublishGithubAction(options: {
|
|
606
445
|
integrations: ScmIntegrationRegistry;
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
446
|
+
config: Config;
|
|
447
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
448
|
+
}): TemplateAction< {
|
|
449
|
+
repoUrl: string;
|
|
450
|
+
description?: string | undefined;
|
|
451
|
+
access?: string | undefined;
|
|
452
|
+
defaultBranch?: string | undefined;
|
|
453
|
+
protectDefaultBranch?: boolean | undefined;
|
|
454
|
+
deleteBranchOnMerge?: boolean | undefined;
|
|
455
|
+
gitCommitMessage?: string | undefined;
|
|
456
|
+
gitAuthorName?: string | undefined;
|
|
457
|
+
gitAuthorEmail?: string | undefined;
|
|
458
|
+
allowRebaseMerge?: boolean | undefined;
|
|
459
|
+
allowSquashMerge?: boolean | undefined;
|
|
460
|
+
allowMergeCommit?: boolean | undefined;
|
|
461
|
+
sourcePath?: string | undefined;
|
|
462
|
+
requireCodeOwnerReviews?: boolean | undefined;
|
|
463
|
+
requiredStatusCheckContexts?: string[] | undefined;
|
|
464
|
+
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
465
|
+
collaborators?: ({
|
|
466
|
+
user: string;
|
|
467
|
+
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
468
|
+
} | {
|
|
469
|
+
team: string;
|
|
470
|
+
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
471
|
+
} | {
|
|
472
|
+
/** @deprecated This field is deprecated in favor of team */
|
|
473
|
+
username: string;
|
|
474
|
+
access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
|
|
475
|
+
})[] | undefined;
|
|
476
|
+
token?: string | undefined;
|
|
477
|
+
topics?: string[] | undefined;
|
|
616
478
|
}>;
|
|
617
479
|
|
|
618
480
|
/**
|
|
619
|
-
* Creates a
|
|
481
|
+
* Creates a Github Pull Request action.
|
|
620
482
|
* @public
|
|
621
483
|
*/
|
|
622
|
-
declare
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
} | undefined;
|
|
632
|
-
token?: string | undefined;
|
|
484
|
+
export declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction< {
|
|
485
|
+
title: string;
|
|
486
|
+
branchName: string;
|
|
487
|
+
description: string;
|
|
488
|
+
repoUrl: string;
|
|
489
|
+
draft?: boolean | undefined;
|
|
490
|
+
targetPath?: string | undefined;
|
|
491
|
+
sourcePath?: string | undefined;
|
|
492
|
+
token?: string | undefined;
|
|
633
493
|
}>;
|
|
634
494
|
|
|
635
495
|
/**
|
|
636
|
-
* Creates new action that
|
|
496
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
497
|
+
* and publishes it to GitLab.
|
|
498
|
+
*
|
|
637
499
|
* @public
|
|
638
500
|
*/
|
|
639
|
-
declare function
|
|
501
|
+
export declare function createPublishGitlabAction(options: {
|
|
640
502
|
integrations: ScmIntegrationRegistry;
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
503
|
+
config: Config;
|
|
504
|
+
}): TemplateAction< {
|
|
505
|
+
repoUrl: string;
|
|
506
|
+
defaultBranch?: string | undefined;
|
|
507
|
+
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
508
|
+
sourcePath?: string | undefined;
|
|
509
|
+
token?: string | undefined;
|
|
510
|
+
gitCommitMessage?: string | undefined;
|
|
511
|
+
gitAuthorName?: string | undefined;
|
|
512
|
+
gitAuthorEmail?: string | undefined;
|
|
513
|
+
setUserAsOwner?: boolean | undefined;
|
|
652
514
|
}>;
|
|
653
515
|
|
|
654
516
|
/**
|
|
655
|
-
*
|
|
517
|
+
* Create a new action that creates a gitlab merge request.
|
|
518
|
+
*
|
|
656
519
|
* @public
|
|
657
520
|
*/
|
|
658
|
-
declare
|
|
521
|
+
export declare const createPublishGitlabMergeRequestAction: (options: {
|
|
659
522
|
integrations: ScmIntegrationRegistry;
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
523
|
+
}) => TemplateAction< {
|
|
524
|
+
repoUrl: string;
|
|
525
|
+
title: string;
|
|
526
|
+
description: string;
|
|
527
|
+
branchName: string;
|
|
528
|
+
targetPath: string;
|
|
529
|
+
token?: string | undefined;
|
|
530
|
+
/** @deprecated Use projectPath instead */
|
|
531
|
+
projectid?: string | undefined;
|
|
532
|
+
removeSourceBranch?: boolean | undefined;
|
|
666
533
|
}>;
|
|
667
534
|
|
|
668
|
-
/** @public */
|
|
669
|
-
declare type RunCommandOptions = {
|
|
670
|
-
/** command to run */
|
|
671
|
-
command: string;
|
|
672
|
-
/** arguments to pass the command */
|
|
673
|
-
args: string[];
|
|
674
|
-
/** options to pass to spawn */
|
|
675
|
-
options?: SpawnOptionsWithoutStdio;
|
|
676
|
-
/** stream to capture stdout and stderr output */
|
|
677
|
-
logStream?: Writable;
|
|
678
|
-
};
|
|
679
535
|
/**
|
|
680
|
-
*
|
|
681
|
-
*
|
|
536
|
+
* A method to create a router for the scaffolder backend plugin.
|
|
682
537
|
* @public
|
|
683
538
|
*/
|
|
684
|
-
declare
|
|
539
|
+
export declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
685
540
|
|
|
686
541
|
/**
|
|
687
|
-
*
|
|
542
|
+
* This function is used to create new template actions to get type safety.
|
|
688
543
|
* @public
|
|
689
544
|
*/
|
|
690
|
-
declare
|
|
691
|
-
private readonly actions;
|
|
692
|
-
register<TInput extends JsonObject>(action: TemplateAction<TInput>): void;
|
|
693
|
-
get(actionId: string): TemplateAction<JsonObject>;
|
|
694
|
-
list(): TemplateAction<JsonObject>[];
|
|
695
|
-
}
|
|
545
|
+
export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
|
|
696
546
|
|
|
697
547
|
/**
|
|
698
|
-
*
|
|
548
|
+
* CreateWorkerOptions
|
|
549
|
+
*
|
|
699
550
|
* @public
|
|
700
551
|
*/
|
|
701
|
-
declare
|
|
552
|
+
export declare type CreateWorkerOptions = {
|
|
553
|
+
taskBroker: TaskBroker;
|
|
554
|
+
actionRegistry: TemplateActionRegistry;
|
|
555
|
+
integrations: ScmIntegrations;
|
|
556
|
+
workingDirectory: string;
|
|
557
|
+
logger: Logger;
|
|
558
|
+
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
559
|
+
};
|
|
702
560
|
|
|
703
561
|
/**
|
|
704
|
-
*
|
|
562
|
+
* Stores the state of the current claimed task passed to the TaskContext
|
|
705
563
|
*
|
|
706
564
|
* @public
|
|
707
565
|
*/
|
|
708
|
-
declare
|
|
709
|
-
|
|
710
|
-
|
|
566
|
+
export declare interface CurrentClaimedTask {
|
|
567
|
+
/**
|
|
568
|
+
* The TaskSpec of the current claimed task.
|
|
569
|
+
*/
|
|
570
|
+
spec: TaskSpec;
|
|
571
|
+
/**
|
|
572
|
+
* The uuid of the current claimed task.
|
|
573
|
+
*/
|
|
574
|
+
taskId: string;
|
|
575
|
+
/**
|
|
576
|
+
* The secrets that are stored with the task.
|
|
577
|
+
*/
|
|
578
|
+
secrets?: TaskSecrets;
|
|
579
|
+
/**
|
|
580
|
+
* The creator of the task.
|
|
581
|
+
*/
|
|
582
|
+
createdBy?: string;
|
|
583
|
+
}
|
|
584
|
+
|
|
711
585
|
/**
|
|
712
586
|
* DatabaseTaskStore
|
|
713
587
|
*
|
|
714
588
|
* @public
|
|
715
589
|
*/
|
|
716
|
-
declare class DatabaseTaskStore implements TaskStore {
|
|
590
|
+
export declare class DatabaseTaskStore implements TaskStore {
|
|
717
591
|
private readonly db;
|
|
718
592
|
static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
|
|
719
593
|
private constructor();
|
|
@@ -746,12 +620,195 @@ declare class DatabaseTaskStore implements TaskStore {
|
|
|
746
620
|
}>;
|
|
747
621
|
}
|
|
748
622
|
|
|
623
|
+
/**
|
|
624
|
+
* DatabaseTaskStore
|
|
625
|
+
*
|
|
626
|
+
* @public
|
|
627
|
+
*/
|
|
628
|
+
export declare type DatabaseTaskStoreOptions = {
|
|
629
|
+
database: Knex;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Run a command in a sub-process, normally a shell command.
|
|
634
|
+
*
|
|
635
|
+
* @public
|
|
636
|
+
*/
|
|
637
|
+
export declare const executeShellCommand: (options: RunCommandOptions) => Promise<void>;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* A helper function that reads the contents of a directory from the given URL.
|
|
641
|
+
* Can be used in your own actions, and also used behind fetch:template and fetch:plain
|
|
642
|
+
*
|
|
643
|
+
* @public
|
|
644
|
+
*/
|
|
645
|
+
export declare function fetchContents({ reader, integrations, baseUrl, fetchUrl, outputPath, }: {
|
|
646
|
+
reader: UrlReader;
|
|
647
|
+
integrations: ScmIntegrations;
|
|
648
|
+
baseUrl?: string;
|
|
649
|
+
fetchUrl?: string;
|
|
650
|
+
outputPath: string;
|
|
651
|
+
}): Promise<void>;
|
|
652
|
+
|
|
653
|
+
/** @public */
|
|
654
|
+
export declare interface OctokitWithPullRequestPluginClient {
|
|
655
|
+
createPullRequest(options: createPullRequest.Options): Promise<{
|
|
656
|
+
data: {
|
|
657
|
+
html_url: string;
|
|
658
|
+
number: number;
|
|
659
|
+
};
|
|
660
|
+
} | null>;
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
/**
|
|
664
|
+
* RouterOptions
|
|
665
|
+
*
|
|
666
|
+
* @public
|
|
667
|
+
*/
|
|
668
|
+
export declare interface RouterOptions {
|
|
669
|
+
logger: Logger;
|
|
670
|
+
config: Config;
|
|
671
|
+
reader: UrlReader;
|
|
672
|
+
database: PluginDatabaseManager;
|
|
673
|
+
catalogClient: CatalogApi;
|
|
674
|
+
actions?: TemplateAction<any>[];
|
|
675
|
+
taskWorkers?: number;
|
|
676
|
+
taskBroker?: TaskBroker;
|
|
677
|
+
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
/** @public */
|
|
681
|
+
export declare type RunCommandOptions = {
|
|
682
|
+
/** command to run */
|
|
683
|
+
command: string;
|
|
684
|
+
/** arguments to pass the command */
|
|
685
|
+
args: string[];
|
|
686
|
+
/** options to pass to spawn */
|
|
687
|
+
options?: SpawnOptionsWithoutStdio;
|
|
688
|
+
/** stream to capture stdout and stderr output */
|
|
689
|
+
logStream?: Writable;
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
/* Excluded from this release type: scaffolderCatalogModule */
|
|
693
|
+
|
|
694
|
+
/** @public */
|
|
695
|
+
export declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
|
|
696
|
+
getProcessorName(): string;
|
|
697
|
+
private readonly validators;
|
|
698
|
+
validateEntityKind(entity: Entity): Promise<boolean>;
|
|
699
|
+
postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* SerializedTask
|
|
704
|
+
*
|
|
705
|
+
* @public
|
|
706
|
+
*/
|
|
707
|
+
export declare type SerializedTask = {
|
|
708
|
+
id: string;
|
|
709
|
+
spec: TaskSpec;
|
|
710
|
+
status: TaskStatus;
|
|
711
|
+
createdAt: string;
|
|
712
|
+
lastHeartbeatAt?: string;
|
|
713
|
+
createdBy?: string;
|
|
714
|
+
secrets?: TaskSecrets;
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
/**
|
|
718
|
+
* SerializedTaskEvent
|
|
719
|
+
*
|
|
720
|
+
* @public
|
|
721
|
+
*/
|
|
722
|
+
export declare type SerializedTaskEvent = {
|
|
723
|
+
id: number;
|
|
724
|
+
taskId: string;
|
|
725
|
+
body: JsonObject;
|
|
726
|
+
type: TaskEventType;
|
|
727
|
+
createdAt: string;
|
|
728
|
+
};
|
|
729
|
+
|
|
730
|
+
/**
|
|
731
|
+
* TaskBroker
|
|
732
|
+
*
|
|
733
|
+
* @public
|
|
734
|
+
*/
|
|
735
|
+
export declare interface TaskBroker {
|
|
736
|
+
claim(): Promise<TaskContext>;
|
|
737
|
+
dispatch(options: TaskBrokerDispatchOptions): Promise<TaskBrokerDispatchResult>;
|
|
738
|
+
vacuumTasks(options: {
|
|
739
|
+
timeoutS: number;
|
|
740
|
+
}): Promise<void>;
|
|
741
|
+
event$(options: {
|
|
742
|
+
taskId: string;
|
|
743
|
+
after: number | undefined;
|
|
744
|
+
}): Observable<{
|
|
745
|
+
events: SerializedTaskEvent[];
|
|
746
|
+
}>;
|
|
747
|
+
get(taskId: string): Promise<SerializedTask>;
|
|
748
|
+
list?(options?: {
|
|
749
|
+
createdBy?: string;
|
|
750
|
+
}): Promise<{
|
|
751
|
+
tasks: SerializedTask[];
|
|
752
|
+
}>;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* The options passed to {@link TaskBroker.dispatch}
|
|
757
|
+
* Currently a spec and optional secrets
|
|
758
|
+
*
|
|
759
|
+
* @public
|
|
760
|
+
*/
|
|
761
|
+
export declare type TaskBrokerDispatchOptions = {
|
|
762
|
+
spec: TaskSpec;
|
|
763
|
+
secrets?: TaskSecrets;
|
|
764
|
+
createdBy?: string;
|
|
765
|
+
};
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* The result of {@link TaskBroker.dispatch}
|
|
769
|
+
*
|
|
770
|
+
* @public
|
|
771
|
+
*/
|
|
772
|
+
export declare type TaskBrokerDispatchResult = {
|
|
773
|
+
taskId: string;
|
|
774
|
+
};
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* The state of a completed task.
|
|
778
|
+
*
|
|
779
|
+
* @public
|
|
780
|
+
*/
|
|
781
|
+
export declare type TaskCompletionState = 'failed' | 'completed';
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Task
|
|
785
|
+
*
|
|
786
|
+
* @public
|
|
787
|
+
*/
|
|
788
|
+
export declare interface TaskContext {
|
|
789
|
+
spec: TaskSpec;
|
|
790
|
+
secrets?: TaskSecrets;
|
|
791
|
+
createdBy?: string;
|
|
792
|
+
done: boolean;
|
|
793
|
+
isDryRun?: boolean;
|
|
794
|
+
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
|
|
795
|
+
complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
|
|
796
|
+
getWorkspaceName(): Promise<string>;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* TaskEventType
|
|
801
|
+
*
|
|
802
|
+
* @public
|
|
803
|
+
*/
|
|
804
|
+
export declare type TaskEventType = 'completion' | 'log';
|
|
805
|
+
|
|
749
806
|
/**
|
|
750
807
|
* TaskManager
|
|
751
808
|
*
|
|
752
809
|
* @public
|
|
753
810
|
*/
|
|
754
|
-
declare class TaskManager implements TaskContext {
|
|
811
|
+
export declare class TaskManager implements TaskContext {
|
|
755
812
|
private readonly task;
|
|
756
813
|
private readonly storage;
|
|
757
814
|
private readonly logger;
|
|
@@ -759,7 +816,7 @@ declare class TaskManager implements TaskContext {
|
|
|
759
816
|
private heartbeatTimeoutId?;
|
|
760
817
|
static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
|
|
761
818
|
private constructor();
|
|
762
|
-
get spec():
|
|
819
|
+
get spec(): TaskSpecV1beta3;
|
|
763
820
|
get secrets(): TaskSecrets | undefined;
|
|
764
821
|
get createdBy(): string | undefined;
|
|
765
822
|
getWorkspaceName(): Promise<string>;
|
|
@@ -768,49 +825,100 @@ declare class TaskManager implements TaskContext {
|
|
|
768
825
|
complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
|
|
769
826
|
private startTimeout;
|
|
770
827
|
}
|
|
828
|
+
|
|
771
829
|
/**
|
|
772
|
-
*
|
|
830
|
+
* TaskSecrets
|
|
773
831
|
*
|
|
774
832
|
* @public
|
|
775
833
|
*/
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
834
|
+
export declare type TaskSecrets = Record<string, string> & {
|
|
835
|
+
backstageToken?: string;
|
|
836
|
+
};
|
|
837
|
+
|
|
838
|
+
/**
|
|
839
|
+
* The status of each step of the Task
|
|
840
|
+
*
|
|
841
|
+
* @public
|
|
842
|
+
*/
|
|
843
|
+
export declare type TaskStatus = 'open' | 'processing' | 'failed' | 'cancelled' | 'completed';
|
|
844
|
+
|
|
845
|
+
/**
|
|
846
|
+
* TaskStore
|
|
847
|
+
*
|
|
848
|
+
* @public
|
|
849
|
+
*/
|
|
850
|
+
export declare interface TaskStore {
|
|
851
|
+
createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
|
|
852
|
+
getTask(taskId: string): Promise<SerializedTask>;
|
|
853
|
+
claimTask(): Promise<SerializedTask | undefined>;
|
|
854
|
+
completeTask(options: {
|
|
855
|
+
taskId: string;
|
|
856
|
+
status: TaskStatus;
|
|
857
|
+
eventBody: JsonObject;
|
|
858
|
+
}): Promise<void>;
|
|
859
|
+
heartbeatTask(taskId: string): Promise<void>;
|
|
860
|
+
listStaleTasks(options: {
|
|
861
|
+
timeoutS: number;
|
|
862
|
+
}): Promise<{
|
|
863
|
+
tasks: {
|
|
864
|
+
taskId: string;
|
|
865
|
+
}[];
|
|
866
|
+
}>;
|
|
867
|
+
list?(options: {
|
|
868
|
+
createdBy?: string;
|
|
869
|
+
}): Promise<{
|
|
870
|
+
tasks: SerializedTask[];
|
|
871
|
+
}>;
|
|
872
|
+
emitLogEvent({ taskId, body }: TaskStoreEmitOptions): Promise<void>;
|
|
873
|
+
listEvents({ taskId, after, }: TaskStoreListEventsOptions): Promise<{
|
|
874
|
+
events: SerializedTaskEvent[];
|
|
875
|
+
}>;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
/**
|
|
879
|
+
* The options passed to {@link TaskStore.createTask}
|
|
880
|
+
* @public
|
|
881
|
+
*/
|
|
882
|
+
export declare type TaskStoreCreateTaskOptions = {
|
|
780
883
|
spec: TaskSpec;
|
|
781
|
-
/**
|
|
782
|
-
* The uuid of the current claimed task.
|
|
783
|
-
*/
|
|
784
|
-
taskId: string;
|
|
785
|
-
/**
|
|
786
|
-
* The secrets that are stored with the task.
|
|
787
|
-
*/
|
|
788
|
-
secrets?: TaskSecrets;
|
|
789
|
-
/**
|
|
790
|
-
* The creator of the task.
|
|
791
|
-
*/
|
|
792
884
|
createdBy?: string;
|
|
793
|
-
|
|
885
|
+
secrets?: TaskSecrets;
|
|
886
|
+
};
|
|
794
887
|
|
|
795
888
|
/**
|
|
796
|
-
*
|
|
889
|
+
* The response from {@link TaskStore.createTask}
|
|
890
|
+
* @public
|
|
891
|
+
*/
|
|
892
|
+
export declare type TaskStoreCreateTaskResult = {
|
|
893
|
+
taskId: string;
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* TaskStoreEmitOptions
|
|
797
898
|
*
|
|
798
899
|
* @public
|
|
799
900
|
*/
|
|
800
|
-
declare type
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
901
|
+
export declare type TaskStoreEmitOptions<TBody = JsonObject> = {
|
|
902
|
+
taskId: string;
|
|
903
|
+
body: TBody;
|
|
904
|
+
};
|
|
905
|
+
|
|
906
|
+
/**
|
|
907
|
+
* TaskStoreListEventsOptions
|
|
908
|
+
*
|
|
909
|
+
* @public
|
|
910
|
+
*/
|
|
911
|
+
export declare type TaskStoreListEventsOptions = {
|
|
912
|
+
taskId: string;
|
|
913
|
+
after?: number | undefined;
|
|
807
914
|
};
|
|
915
|
+
|
|
808
916
|
/**
|
|
809
917
|
* TaskWorker
|
|
810
918
|
*
|
|
811
919
|
* @public
|
|
812
920
|
*/
|
|
813
|
-
declare class TaskWorker {
|
|
921
|
+
export declare class TaskWorker {
|
|
814
922
|
private readonly options;
|
|
815
923
|
private constructor();
|
|
816
924
|
static create(options: CreateWorkerOptions): Promise<TaskWorker>;
|
|
@@ -818,34 +926,30 @@ declare class TaskWorker {
|
|
|
818
926
|
runOneTask(task: TaskContext): Promise<void>;
|
|
819
927
|
}
|
|
820
928
|
|
|
929
|
+
/** @public */
|
|
930
|
+
export declare type TemplateAction<Input extends JsonObject> = {
|
|
931
|
+
id: string;
|
|
932
|
+
description?: string;
|
|
933
|
+
supportsDryRun?: boolean;
|
|
934
|
+
schema?: {
|
|
935
|
+
input?: Schema;
|
|
936
|
+
output?: Schema;
|
|
937
|
+
};
|
|
938
|
+
handler: (ctx: ActionContext<Input>) => Promise<void>;
|
|
939
|
+
};
|
|
940
|
+
|
|
821
941
|
/**
|
|
822
|
-
*
|
|
823
|
-
*
|
|
942
|
+
* Registry of all registered template actions.
|
|
824
943
|
* @public
|
|
825
944
|
*/
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
catalogClient: CatalogApi;
|
|
832
|
-
actions?: TemplateAction<any>[];
|
|
833
|
-
taskWorkers?: number;
|
|
834
|
-
taskBroker?: TaskBroker;
|
|
835
|
-
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
945
|
+
export declare class TemplateActionRegistry {
|
|
946
|
+
private readonly actions;
|
|
947
|
+
register<TInput extends JsonObject>(action: TemplateAction<TInput>): void;
|
|
948
|
+
get(actionId: string): TemplateAction<JsonObject>;
|
|
949
|
+
list(): TemplateAction<JsonObject>[];
|
|
836
950
|
}
|
|
837
|
-
/**
|
|
838
|
-
* A method to create a router for the scaffolder backend plugin.
|
|
839
|
-
* @public
|
|
840
|
-
*/
|
|
841
|
-
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
842
951
|
|
|
843
952
|
/** @public */
|
|
844
|
-
declare
|
|
845
|
-
getProcessorName(): string;
|
|
846
|
-
private readonly validators;
|
|
847
|
-
validateEntityKind(entity: Entity): Promise<boolean>;
|
|
848
|
-
postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
|
|
849
|
-
}
|
|
953
|
+
export declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
|
|
850
954
|
|
|
851
|
-
export {
|
|
955
|
+
export { }
|