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