@backstage/plugin-scaffolder-backend 1.4.0-next.2 → 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 +28 -4
- 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 +38 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +647 -604
- package/package.json +21 -17
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,159 +152,136 @@ 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
|
-
|
|
432
|
-
}
|
|
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
|
+
}
|
|
433
237
|
|
|
434
238
|
/**
|
|
435
|
-
*
|
|
436
|
-
* and publishes it to Bitbucket Server.
|
|
239
|
+
* The options passed to the client factory function.
|
|
437
240
|
* @public
|
|
438
241
|
*/
|
|
439
|
-
declare
|
|
242
|
+
export declare type CreateGithubPullRequestClientFactoryInput = {
|
|
440
243
|
integrations: ScmIntegrationRegistry;
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
sourcePath?: string | undefined;
|
|
448
|
-
enableLFS?: boolean | undefined;
|
|
449
|
-
token?: string | undefined;
|
|
450
|
-
}>;
|
|
244
|
+
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
245
|
+
host: string;
|
|
246
|
+
owner: string;
|
|
247
|
+
repo: string;
|
|
248
|
+
token?: string;
|
|
249
|
+
};
|
|
451
250
|
|
|
452
251
|
/**
|
|
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.
|
|
252
|
+
* Creates a new action that initializes a git repository
|
|
460
253
|
*
|
|
461
254
|
* @public
|
|
462
255
|
*/
|
|
463
|
-
declare function
|
|
464
|
-
path: string;
|
|
465
|
-
}>;
|
|
466
|
-
|
|
467
|
-
/**
|
|
468
|
-
* Creates a new action that initializes a git repository of the content in the workspace
|
|
469
|
-
* and publishes it to a Gerrit instance.
|
|
470
|
-
* @public
|
|
471
|
-
*/
|
|
472
|
-
declare function createPublishGerritAction(options: {
|
|
256
|
+
export declare function createGithubRepoCreateAction(options: {
|
|
473
257
|
integrations: ScmIntegrationRegistry;
|
|
474
|
-
|
|
475
|
-
}): TemplateAction<{
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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;
|
|
482
285
|
}>;
|
|
483
286
|
|
|
484
287
|
/**
|
|
@@ -487,294 +290,304 @@ declare function createPublishGerritAction(options: {
|
|
|
487
290
|
*
|
|
488
291
|
* @public
|
|
489
292
|
*/
|
|
490
|
-
declare function
|
|
293
|
+
export declare function createGithubRepoPushAction(options: {
|
|
491
294
|
integrations: ScmIntegrationRegistry;
|
|
492
295
|
config: Config;
|
|
493
296
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
494
|
-
}): TemplateAction<{
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
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;
|
|
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;
|
|
524
309
|
}>;
|
|
525
310
|
|
|
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
311
|
/**
|
|
536
|
-
*
|
|
312
|
+
* Creates new action that creates a webhook for a repository on GitHub.
|
|
537
313
|
* @public
|
|
538
314
|
*/
|
|
539
|
-
declare
|
|
315
|
+
export declare function createGithubWebhookAction(options: {
|
|
540
316
|
integrations: ScmIntegrationRegistry;
|
|
317
|
+
defaultWebhookSecret?: string;
|
|
541
318
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
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;
|
|
328
|
+
}>;
|
|
329
|
+
|
|
547
330
|
/**
|
|
548
|
-
*
|
|
331
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
332
|
+
* and publishes it to Azure.
|
|
549
333
|
* @public
|
|
550
334
|
*/
|
|
551
|
-
|
|
552
|
-
/**
|
|
553
|
-
* An instance of {@link @backstage/integration#ScmIntegrationRegistry} that will be used in the action.
|
|
554
|
-
*/
|
|
335
|
+
export declare function createPublishAzureAction(options: {
|
|
555
336
|
integrations: ScmIntegrationRegistry;
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
337
|
+
config: Config;
|
|
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;
|
|
347
|
+
}>;
|
|
348
|
+
|
|
565
349
|
/**
|
|
566
|
-
* Creates a
|
|
350
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
351
|
+
* and publishes it to Bitbucket.
|
|
567
352
|
* @public
|
|
353
|
+
* @deprecated in favor of createPublishBitbucketCloudAction and createPublishBitbucketServerAction
|
|
568
354
|
*/
|
|
569
|
-
declare
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
355
|
+
export declare function createPublishBitbucketAction(options: {
|
|
356
|
+
integrations: ScmIntegrationRegistry;
|
|
357
|
+
config: Config;
|
|
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;
|
|
578
369
|
}>;
|
|
579
370
|
|
|
580
371
|
/**
|
|
581
372
|
* Creates a new action that initializes a git repository of the content in the workspace
|
|
582
|
-
* and publishes it to
|
|
583
|
-
*
|
|
373
|
+
* and publishes it to Bitbucket Cloud.
|
|
584
374
|
* @public
|
|
585
375
|
*/
|
|
586
|
-
declare function
|
|
376
|
+
export declare function createPublishBitbucketCloudAction(options: {
|
|
587
377
|
integrations: ScmIntegrationRegistry;
|
|
588
378
|
config: Config;
|
|
589
|
-
}): TemplateAction<{
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
gitAuthorName?: string | undefined;
|
|
597
|
-
gitAuthorEmail?: string | undefined;
|
|
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;
|
|
598
386
|
}>;
|
|
599
387
|
|
|
600
388
|
/**
|
|
601
|
-
*
|
|
602
|
-
*
|
|
389
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
390
|
+
* and publishes it to Bitbucket Server.
|
|
603
391
|
* @public
|
|
604
392
|
*/
|
|
605
|
-
declare
|
|
393
|
+
export declare function createPublishBitbucketServerAction(options: {
|
|
606
394
|
integrations: ScmIntegrationRegistry;
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
removeSourceBranch?: boolean | undefined;
|
|
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;
|
|
617
404
|
}>;
|
|
618
405
|
|
|
619
406
|
/**
|
|
620
|
-
*
|
|
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
|
+
*
|
|
621
415
|
* @public
|
|
622
416
|
*/
|
|
623
|
-
declare function
|
|
624
|
-
|
|
625
|
-
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
626
|
-
}): TemplateAction<{
|
|
627
|
-
repoUrl: string;
|
|
628
|
-
workflowId: string;
|
|
629
|
-
branchOrTagName: string;
|
|
630
|
-
workflowInputs?: {
|
|
631
|
-
[key: string]: string;
|
|
632
|
-
} | undefined;
|
|
633
|
-
token?: string | undefined;
|
|
417
|
+
export declare function createPublishFileAction(): TemplateAction< {
|
|
418
|
+
path: string;
|
|
634
419
|
}>;
|
|
635
420
|
|
|
636
421
|
/**
|
|
637
|
-
*
|
|
422
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
423
|
+
* and publishes it to a Gerrit instance.
|
|
638
424
|
* @public
|
|
639
425
|
*/
|
|
640
|
-
declare function
|
|
426
|
+
export declare function createPublishGerritAction(options: {
|
|
641
427
|
integrations: ScmIntegrationRegistry;
|
|
642
|
-
|
|
643
|
-
}): TemplateAction<{
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
428
|
+
config: Config;
|
|
429
|
+
}): TemplateAction< {
|
|
430
|
+
repoUrl: string;
|
|
431
|
+
description: string;
|
|
432
|
+
defaultBranch?: string | undefined;
|
|
433
|
+
gitCommitMessage?: string | undefined;
|
|
434
|
+
gitAuthorName?: string | undefined;
|
|
435
|
+
gitAuthorEmail?: string | undefined;
|
|
648
436
|
}>;
|
|
649
437
|
|
|
650
438
|
/**
|
|
651
|
-
* Creates a new action that initializes a git repository
|
|
439
|
+
* Creates a new action that initializes a git repository of the content in the workspace
|
|
440
|
+
* and publishes it to GitHub.
|
|
652
441
|
*
|
|
653
442
|
* @public
|
|
654
443
|
*/
|
|
655
|
-
declare function
|
|
444
|
+
export declare function createPublishGithubAction(options: {
|
|
656
445
|
integrations: ScmIntegrationRegistry;
|
|
446
|
+
config: Config;
|
|
657
447
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
658
|
-
}): TemplateAction<{
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
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;
|
|
478
|
+
}>;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Creates a Github Pull Request action.
|
|
482
|
+
* @public
|
|
483
|
+
*/
|
|
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;
|
|
684
493
|
}>;
|
|
685
494
|
|
|
686
495
|
/**
|
|
687
496
|
* Creates a new action that initializes a git repository of the content in the workspace
|
|
688
|
-
* and publishes it to
|
|
497
|
+
* and publishes it to GitLab.
|
|
689
498
|
*
|
|
690
499
|
* @public
|
|
691
500
|
*/
|
|
692
|
-
declare function
|
|
501
|
+
export declare function createPublishGitlabAction(options: {
|
|
693
502
|
integrations: ScmIntegrationRegistry;
|
|
694
503
|
config: Config;
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
requiredStatusCheckContexts?: string[] | undefined;
|
|
706
|
-
sourcePath?: string | undefined;
|
|
707
|
-
token?: string | undefined;
|
|
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;
|
|
708
514
|
}>;
|
|
709
515
|
|
|
710
516
|
/**
|
|
711
|
-
*
|
|
517
|
+
* Create a new action that creates a gitlab merge request.
|
|
518
|
+
*
|
|
712
519
|
* @public
|
|
713
520
|
*/
|
|
714
|
-
declare
|
|
521
|
+
export declare const createPublishGitlabMergeRequestAction: (options: {
|
|
715
522
|
integrations: ScmIntegrationRegistry;
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
token?: string | undefined;
|
|
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;
|
|
727
533
|
}>;
|
|
728
534
|
|
|
729
|
-
/** @public */
|
|
730
|
-
declare type RunCommandOptions = {
|
|
731
|
-
/** command to run */
|
|
732
|
-
command: string;
|
|
733
|
-
/** arguments to pass the command */
|
|
734
|
-
args: string[];
|
|
735
|
-
/** options to pass to spawn */
|
|
736
|
-
options?: SpawnOptionsWithoutStdio;
|
|
737
|
-
/** stream to capture stdout and stderr output */
|
|
738
|
-
logStream?: Writable;
|
|
739
|
-
};
|
|
740
535
|
/**
|
|
741
|
-
*
|
|
742
|
-
*
|
|
536
|
+
* A method to create a router for the scaffolder backend plugin.
|
|
743
537
|
* @public
|
|
744
538
|
*/
|
|
745
|
-
declare
|
|
539
|
+
export declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
746
540
|
|
|
747
541
|
/**
|
|
748
|
-
*
|
|
542
|
+
* This function is used to create new template actions to get type safety.
|
|
749
543
|
* @public
|
|
750
544
|
*/
|
|
751
|
-
declare
|
|
752
|
-
private readonly actions;
|
|
753
|
-
register<TInput extends JsonObject>(action: TemplateAction<TInput>): void;
|
|
754
|
-
get(actionId: string): TemplateAction<JsonObject>;
|
|
755
|
-
list(): TemplateAction<JsonObject>[];
|
|
756
|
-
}
|
|
545
|
+
export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction<TInput>) => TemplateAction<TInput>;
|
|
757
546
|
|
|
758
547
|
/**
|
|
759
|
-
*
|
|
548
|
+
* CreateWorkerOptions
|
|
549
|
+
*
|
|
760
550
|
* @public
|
|
761
551
|
*/
|
|
762
|
-
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
|
+
};
|
|
763
560
|
|
|
764
561
|
/**
|
|
765
|
-
*
|
|
562
|
+
* Stores the state of the current claimed task passed to the TaskContext
|
|
766
563
|
*
|
|
767
564
|
* @public
|
|
768
565
|
*/
|
|
769
|
-
declare
|
|
770
|
-
|
|
771
|
-
|
|
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
|
+
|
|
772
585
|
/**
|
|
773
586
|
* DatabaseTaskStore
|
|
774
587
|
*
|
|
775
588
|
* @public
|
|
776
589
|
*/
|
|
777
|
-
declare class DatabaseTaskStore implements TaskStore {
|
|
590
|
+
export declare class DatabaseTaskStore implements TaskStore {
|
|
778
591
|
private readonly db;
|
|
779
592
|
static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
|
|
780
593
|
private constructor();
|
|
@@ -807,12 +620,195 @@ declare class DatabaseTaskStore implements TaskStore {
|
|
|
807
620
|
}>;
|
|
808
621
|
}
|
|
809
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
|
+
|
|
810
806
|
/**
|
|
811
807
|
* TaskManager
|
|
812
808
|
*
|
|
813
809
|
* @public
|
|
814
810
|
*/
|
|
815
|
-
declare class TaskManager implements TaskContext {
|
|
811
|
+
export declare class TaskManager implements TaskContext {
|
|
816
812
|
private readonly task;
|
|
817
813
|
private readonly storage;
|
|
818
814
|
private readonly logger;
|
|
@@ -820,7 +816,7 @@ declare class TaskManager implements TaskContext {
|
|
|
820
816
|
private heartbeatTimeoutId?;
|
|
821
817
|
static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
|
|
822
818
|
private constructor();
|
|
823
|
-
get spec():
|
|
819
|
+
get spec(): TaskSpecV1beta3;
|
|
824
820
|
get secrets(): TaskSecrets | undefined;
|
|
825
821
|
get createdBy(): string | undefined;
|
|
826
822
|
getWorkspaceName(): Promise<string>;
|
|
@@ -829,49 +825,100 @@ declare class TaskManager implements TaskContext {
|
|
|
829
825
|
complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
|
|
830
826
|
private startTimeout;
|
|
831
827
|
}
|
|
828
|
+
|
|
832
829
|
/**
|
|
833
|
-
*
|
|
830
|
+
* TaskSecrets
|
|
834
831
|
*
|
|
835
832
|
* @public
|
|
836
833
|
*/
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
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 = {
|
|
841
883
|
spec: TaskSpec;
|
|
842
|
-
/**
|
|
843
|
-
* The uuid of the current claimed task.
|
|
844
|
-
*/
|
|
845
|
-
taskId: string;
|
|
846
|
-
/**
|
|
847
|
-
* The secrets that are stored with the task.
|
|
848
|
-
*/
|
|
849
|
-
secrets?: TaskSecrets;
|
|
850
|
-
/**
|
|
851
|
-
* The creator of the task.
|
|
852
|
-
*/
|
|
853
884
|
createdBy?: string;
|
|
854
|
-
|
|
885
|
+
secrets?: TaskSecrets;
|
|
886
|
+
};
|
|
855
887
|
|
|
856
888
|
/**
|
|
857
|
-
*
|
|
889
|
+
* The response from {@link TaskStore.createTask}
|
|
890
|
+
* @public
|
|
891
|
+
*/
|
|
892
|
+
export declare type TaskStoreCreateTaskResult = {
|
|
893
|
+
taskId: string;
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* TaskStoreEmitOptions
|
|
858
898
|
*
|
|
859
899
|
* @public
|
|
860
900
|
*/
|
|
861
|
-
declare type
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
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;
|
|
868
914
|
};
|
|
915
|
+
|
|
869
916
|
/**
|
|
870
917
|
* TaskWorker
|
|
871
918
|
*
|
|
872
919
|
* @public
|
|
873
920
|
*/
|
|
874
|
-
declare class TaskWorker {
|
|
921
|
+
export declare class TaskWorker {
|
|
875
922
|
private readonly options;
|
|
876
923
|
private constructor();
|
|
877
924
|
static create(options: CreateWorkerOptions): Promise<TaskWorker>;
|
|
@@ -879,34 +926,30 @@ declare class TaskWorker {
|
|
|
879
926
|
runOneTask(task: TaskContext): Promise<void>;
|
|
880
927
|
}
|
|
881
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
|
+
|
|
882
941
|
/**
|
|
883
|
-
*
|
|
884
|
-
*
|
|
942
|
+
* Registry of all registered template actions.
|
|
885
943
|
* @public
|
|
886
944
|
*/
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
catalogClient: CatalogApi;
|
|
893
|
-
actions?: TemplateAction<any>[];
|
|
894
|
-
taskWorkers?: number;
|
|
895
|
-
taskBroker?: TaskBroker;
|
|
896
|
-
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>[];
|
|
897
950
|
}
|
|
898
|
-
/**
|
|
899
|
-
* A method to create a router for the scaffolder backend plugin.
|
|
900
|
-
* @public
|
|
901
|
-
*/
|
|
902
|
-
declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
903
951
|
|
|
904
952
|
/** @public */
|
|
905
|
-
declare
|
|
906
|
-
getProcessorName(): string;
|
|
907
|
-
private readonly validators;
|
|
908
|
-
validateEntityKind(entity: Entity): Promise<boolean>;
|
|
909
|
-
postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
|
|
910
|
-
}
|
|
953
|
+
export declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
|
|
911
954
|
|
|
912
|
-
export {
|
|
955
|
+
export { }
|