@backstage/plugin-scaffolder-backend 1.10.0 → 1.11.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 +27 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +52 -92
- package/dist/index.beta.d.ts +49 -91
- package/dist/index.cjs.js +34 -33
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +49 -91
- package/package.json +12 -11
package/dist/index.beta.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
/// <reference types="node" />
|
|
8
8
|
|
|
9
|
+
import { ActionContext as ActionContext_2 } from '@backstage/plugin-scaffolder-node';
|
|
9
10
|
import { BackendFeature } from '@backstage/backend-plugin-api';
|
|
10
11
|
import { CatalogApi } from '@backstage/catalog-client';
|
|
11
12
|
import { CatalogProcessor } from '@backstage/plugin-catalog-backend';
|
|
@@ -25,52 +26,21 @@ import { Observable } from '@backstage/types';
|
|
|
25
26
|
import { Octokit } from 'octokit';
|
|
26
27
|
import { PluginDatabaseManager } from '@backstage/backend-common';
|
|
27
28
|
import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
|
28
|
-
import { Schema } from 'jsonschema';
|
|
29
29
|
import { ScmIntegrationRegistry } from '@backstage/integration';
|
|
30
30
|
import { ScmIntegrations } from '@backstage/integration';
|
|
31
31
|
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
32
|
+
import { TaskSecrets as TaskSecrets_2 } from '@backstage/plugin-scaffolder-node';
|
|
32
33
|
import { TaskSpec } from '@backstage/plugin-scaffolder-common';
|
|
33
34
|
import { TaskSpecV1beta3 } from '@backstage/plugin-scaffolder-common';
|
|
34
|
-
import {
|
|
35
|
+
import { TemplateAction as TemplateAction_2 } from '@backstage/plugin-scaffolder-node';
|
|
35
36
|
import { UrlReader } from '@backstage/backend-common';
|
|
36
|
-
import { UserEntity } from '@backstage/catalog-model';
|
|
37
37
|
import { Writable } from 'stream';
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
-
* ActionContext is passed into scaffolder actions.
|
|
41
40
|
* @public
|
|
41
|
+
* @deprecated Import from {@link @backstage/plugin-scaffolder-node#ActionContext} instead
|
|
42
42
|
*/
|
|
43
|
-
export declare type ActionContext<
|
|
44
|
-
logger: Logger;
|
|
45
|
-
logStream: Writable;
|
|
46
|
-
secrets?: TaskSecrets;
|
|
47
|
-
workspacePath: string;
|
|
48
|
-
input: Input;
|
|
49
|
-
output(name: string, value: JsonValue): void;
|
|
50
|
-
/**
|
|
51
|
-
* Creates a temporary directory for use by the action, which is then cleaned up automatically.
|
|
52
|
-
*/
|
|
53
|
-
createTemporaryDirectory(): Promise<string>;
|
|
54
|
-
templateInfo?: TemplateInfo;
|
|
55
|
-
/**
|
|
56
|
-
* Whether this action invocation is a dry-run or not.
|
|
57
|
-
* This will only ever be true if the actions as marked as supporting dry-runs.
|
|
58
|
-
*/
|
|
59
|
-
isDryRun?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* The user which triggered the action.
|
|
62
|
-
*/
|
|
63
|
-
user?: {
|
|
64
|
-
/**
|
|
65
|
-
* The decorated entity from the Catalog
|
|
66
|
-
*/
|
|
67
|
-
entity?: UserEntity;
|
|
68
|
-
/**
|
|
69
|
-
* An entity ref for the author of the task
|
|
70
|
-
*/
|
|
71
|
-
ref?: string;
|
|
72
|
-
};
|
|
73
|
-
};
|
|
43
|
+
export declare type ActionContext<TInput extends JsonObject> = ActionContext_2<TInput>;
|
|
74
44
|
|
|
75
45
|
/**
|
|
76
46
|
* A function to generate create a list of default actions that the scaffolder provides.
|
|
@@ -79,7 +49,7 @@ export declare type ActionContext<Input extends JsonObject> = {
|
|
|
79
49
|
* @public
|
|
80
50
|
* @returns A list of actions that can be used in the scaffolder
|
|
81
51
|
*/
|
|
82
|
-
export declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) =>
|
|
52
|
+
export declare const createBuiltinActions: (options: CreateBuiltInActionsOptions) => TemplateAction_2<JsonObject>[];
|
|
83
53
|
|
|
84
54
|
/**
|
|
85
55
|
* The options passed to {@link createBuiltinActions}
|
|
@@ -117,7 +87,7 @@ export declare interface CreateBuiltInActionsOptions {
|
|
|
117
87
|
export declare function createCatalogRegisterAction(options: {
|
|
118
88
|
catalogClient: CatalogApi;
|
|
119
89
|
integrations: ScmIntegrations;
|
|
120
|
-
}):
|
|
90
|
+
}): TemplateAction_2< {
|
|
121
91
|
catalogInfoUrl: string;
|
|
122
92
|
optional?: boolean | undefined;
|
|
123
93
|
} | {
|
|
@@ -130,7 +100,7 @@ optional?: boolean | undefined;
|
|
|
130
100
|
* Writes a catalog descriptor file containing the provided entity to a path in the workspace.
|
|
131
101
|
* @public
|
|
132
102
|
*/
|
|
133
|
-
export declare function createCatalogWriteAction():
|
|
103
|
+
export declare function createCatalogWriteAction(): TemplateAction_2< {
|
|
134
104
|
filePath?: string | undefined;
|
|
135
105
|
entity: Entity;
|
|
136
106
|
}>;
|
|
@@ -145,7 +115,7 @@ entity: Entity;
|
|
|
145
115
|
*
|
|
146
116
|
* @public
|
|
147
117
|
*/
|
|
148
|
-
export declare function createDebugLogAction():
|
|
118
|
+
export declare function createDebugLogAction(): TemplateAction_2< {
|
|
149
119
|
message?: string | undefined;
|
|
150
120
|
listWorkspace?: boolean | undefined;
|
|
151
121
|
}>;
|
|
@@ -156,7 +126,7 @@ listWorkspace?: boolean | undefined;
|
|
|
156
126
|
*/
|
|
157
127
|
export declare function createFetchCatalogEntityAction(options: {
|
|
158
128
|
catalogClient: CatalogApi;
|
|
159
|
-
}):
|
|
129
|
+
}): TemplateAction_2< {
|
|
160
130
|
entityRef: string;
|
|
161
131
|
optional?: boolean | undefined;
|
|
162
132
|
}>;
|
|
@@ -169,7 +139,7 @@ optional?: boolean | undefined;
|
|
|
169
139
|
export declare function createFetchPlainAction(options: {
|
|
170
140
|
reader: UrlReader;
|
|
171
141
|
integrations: ScmIntegrations;
|
|
172
|
-
}):
|
|
142
|
+
}): TemplateAction_2< {
|
|
173
143
|
url: string;
|
|
174
144
|
targetPath?: string | undefined;
|
|
175
145
|
}>;
|
|
@@ -186,7 +156,7 @@ export declare function createFetchTemplateAction(options: {
|
|
|
186
156
|
integrations: ScmIntegrations;
|
|
187
157
|
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
188
158
|
additionalTemplateGlobals?: Record<string, TemplateGlobal>;
|
|
189
|
-
}):
|
|
159
|
+
}): TemplateAction_2< {
|
|
190
160
|
url: string;
|
|
191
161
|
targetPath?: string | undefined;
|
|
192
162
|
values: any;
|
|
@@ -197,13 +167,14 @@ templateFileExtension?: string | boolean | undefined;
|
|
|
197
167
|
copyWithoutRender?: string[] | undefined;
|
|
198
168
|
copyWithoutTemplating?: string[] | undefined;
|
|
199
169
|
cookiecutterCompat?: boolean | undefined;
|
|
170
|
+
replace?: boolean | undefined;
|
|
200
171
|
}>;
|
|
201
172
|
|
|
202
173
|
/**
|
|
203
174
|
* Creates new action that enables deletion of files and directories in the workspace.
|
|
204
175
|
* @public
|
|
205
176
|
*/
|
|
206
|
-
export declare const createFilesystemDeleteAction: () =>
|
|
177
|
+
export declare const createFilesystemDeleteAction: () => TemplateAction_2< {
|
|
207
178
|
files: string[];
|
|
208
179
|
}>;
|
|
209
180
|
|
|
@@ -211,7 +182,7 @@ files: string[];
|
|
|
211
182
|
* Creates a new action that allows renames of files and directories in the workspace.
|
|
212
183
|
* @public
|
|
213
184
|
*/
|
|
214
|
-
export declare const createFilesystemRenameAction: () =>
|
|
185
|
+
export declare const createFilesystemRenameAction: () => TemplateAction_2< {
|
|
215
186
|
files: Array<{
|
|
216
187
|
from: string;
|
|
217
188
|
to: string;
|
|
@@ -226,7 +197,7 @@ overwrite?: boolean;
|
|
|
226
197
|
export declare function createGithubActionsDispatchAction(options: {
|
|
227
198
|
integrations: ScmIntegrations;
|
|
228
199
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
229
|
-
}):
|
|
200
|
+
}): TemplateAction_2< {
|
|
230
201
|
repoUrl: string;
|
|
231
202
|
workflowId: string;
|
|
232
203
|
branchOrTagName: string;
|
|
@@ -243,7 +214,7 @@ token?: string | undefined;
|
|
|
243
214
|
export declare function createGithubIssuesLabelAction(options: {
|
|
244
215
|
integrations: ScmIntegrationRegistry;
|
|
245
216
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
246
|
-
}):
|
|
217
|
+
}): TemplateAction_2< {
|
|
247
218
|
repoUrl: string;
|
|
248
219
|
number: number;
|
|
249
220
|
labels: string[];
|
|
@@ -290,7 +261,7 @@ export declare type CreateGithubPullRequestClientFactoryInput = {
|
|
|
290
261
|
export declare function createGithubRepoCreateAction(options: {
|
|
291
262
|
integrations: ScmIntegrationRegistry;
|
|
292
263
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
293
|
-
}):
|
|
264
|
+
}): TemplateAction_2< {
|
|
294
265
|
repoUrl: string;
|
|
295
266
|
description?: string | undefined;
|
|
296
267
|
homepage?: string | undefined;
|
|
@@ -349,7 +320,7 @@ export declare function createGithubRepoPushAction(options: {
|
|
|
349
320
|
integrations: ScmIntegrationRegistry;
|
|
350
321
|
config: Config;
|
|
351
322
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
352
|
-
}):
|
|
323
|
+
}): TemplateAction_2< {
|
|
353
324
|
repoUrl: string;
|
|
354
325
|
description?: string | undefined;
|
|
355
326
|
defaultBranch?: string | undefined;
|
|
@@ -387,7 +358,7 @@ export declare function createGithubWebhookAction(options: {
|
|
|
387
358
|
integrations: ScmIntegrationRegistry;
|
|
388
359
|
defaultWebhookSecret?: string;
|
|
389
360
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
390
|
-
}):
|
|
361
|
+
}): TemplateAction_2< {
|
|
391
362
|
repoUrl: string;
|
|
392
363
|
webhookUrl: string;
|
|
393
364
|
webhookSecret?: string | undefined;
|
|
@@ -406,7 +377,7 @@ token?: string | undefined;
|
|
|
406
377
|
export declare function createPublishAzureAction(options: {
|
|
407
378
|
integrations: ScmIntegrationRegistry;
|
|
408
379
|
config: Config;
|
|
409
|
-
}):
|
|
380
|
+
}): TemplateAction_2< {
|
|
410
381
|
repoUrl: string;
|
|
411
382
|
description?: string | undefined;
|
|
412
383
|
defaultBranch?: string | undefined;
|
|
@@ -426,7 +397,7 @@ gitAuthorEmail?: string | undefined;
|
|
|
426
397
|
export declare function createPublishBitbucketAction(options: {
|
|
427
398
|
integrations: ScmIntegrationRegistry;
|
|
428
399
|
config: Config;
|
|
429
|
-
}):
|
|
400
|
+
}): TemplateAction_2< {
|
|
430
401
|
repoUrl: string;
|
|
431
402
|
description?: string | undefined;
|
|
432
403
|
defaultBranch?: string | undefined;
|
|
@@ -447,7 +418,7 @@ gitAuthorEmail?: string | undefined;
|
|
|
447
418
|
export declare function createPublishBitbucketCloudAction(options: {
|
|
448
419
|
integrations: ScmIntegrationRegistry;
|
|
449
420
|
config: Config;
|
|
450
|
-
}):
|
|
421
|
+
}): TemplateAction_2< {
|
|
451
422
|
repoUrl: string;
|
|
452
423
|
description?: string | undefined;
|
|
453
424
|
defaultBranch?: string | undefined;
|
|
@@ -464,7 +435,7 @@ token?: string | undefined;
|
|
|
464
435
|
export declare function createPublishBitbucketServerAction(options: {
|
|
465
436
|
integrations: ScmIntegrationRegistry;
|
|
466
437
|
config: Config;
|
|
467
|
-
}):
|
|
438
|
+
}): TemplateAction_2< {
|
|
468
439
|
repoUrl: string;
|
|
469
440
|
description?: string | undefined;
|
|
470
441
|
defaultBranch?: string | undefined;
|
|
@@ -485,7 +456,7 @@ gitAuthorEmail?: string | undefined;
|
|
|
485
456
|
export declare function createPublishGerritAction(options: {
|
|
486
457
|
integrations: ScmIntegrationRegistry;
|
|
487
458
|
config: Config;
|
|
488
|
-
}):
|
|
459
|
+
}): TemplateAction_2< {
|
|
489
460
|
repoUrl: string;
|
|
490
461
|
description: string;
|
|
491
462
|
defaultBranch?: string | undefined;
|
|
@@ -502,7 +473,7 @@ sourcePath?: string | undefined;
|
|
|
502
473
|
export declare function createPublishGerritReviewAction(options: {
|
|
503
474
|
integrations: ScmIntegrationRegistry;
|
|
504
475
|
config: Config;
|
|
505
|
-
}):
|
|
476
|
+
}): TemplateAction_2< {
|
|
506
477
|
repoUrl: string;
|
|
507
478
|
branch?: string | undefined;
|
|
508
479
|
sourcePath?: string | undefined;
|
|
@@ -521,7 +492,7 @@ export declare function createPublishGithubAction(options: {
|
|
|
521
492
|
integrations: ScmIntegrationRegistry;
|
|
522
493
|
config: Config;
|
|
523
494
|
githubCredentialsProvider?: GithubCredentialsProvider;
|
|
524
|
-
}):
|
|
495
|
+
}): TemplateAction_2< {
|
|
525
496
|
repoUrl: string;
|
|
526
497
|
description?: string | undefined;
|
|
527
498
|
homepage?: string | undefined;
|
|
@@ -580,7 +551,7 @@ requiredCommitSigning?: boolean | undefined;
|
|
|
580
551
|
* Creates a Github Pull Request action.
|
|
581
552
|
* @public
|
|
582
553
|
*/
|
|
583
|
-
export declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) =>
|
|
554
|
+
export declare const createPublishGithubPullRequestAction: ({ integrations, githubCredentialsProvider, clientFactory, }: CreateGithubPullRequestActionOptions) => TemplateAction_2< {
|
|
584
555
|
title: string;
|
|
585
556
|
branchName: string;
|
|
586
557
|
description: string;
|
|
@@ -602,7 +573,7 @@ teamReviewers?: string[] | undefined;
|
|
|
602
573
|
export declare function createPublishGitlabAction(options: {
|
|
603
574
|
integrations: ScmIntegrationRegistry;
|
|
604
575
|
config: Config;
|
|
605
|
-
}):
|
|
576
|
+
}): TemplateAction_2< {
|
|
606
577
|
repoUrl: string;
|
|
607
578
|
defaultBranch?: string | undefined;
|
|
608
579
|
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
@@ -622,7 +593,7 @@ topics?: string[] | undefined;
|
|
|
622
593
|
*/
|
|
623
594
|
export declare const createPublishGitlabMergeRequestAction: (options: {
|
|
624
595
|
integrations: ScmIntegrationRegistry;
|
|
625
|
-
}) =>
|
|
596
|
+
}) => TemplateAction_2< {
|
|
626
597
|
repoUrl: string;
|
|
627
598
|
title: string;
|
|
628
599
|
description: string;
|
|
@@ -644,10 +615,10 @@ assignee?: string | undefined;
|
|
|
644
615
|
export declare function createRouter(options: RouterOptions): Promise<express.Router>;
|
|
645
616
|
|
|
646
617
|
/**
|
|
647
|
-
* This function is used to create new template actions to get type safety.
|
|
648
618
|
* @public
|
|
619
|
+
* @deprecated Use `createTemplateAction` from `@backstage/plugin-scaffolder-node` instead
|
|
649
620
|
*/
|
|
650
|
-
export declare const createTemplateAction: <TInput extends JsonObject>(templateAction:
|
|
621
|
+
export declare const createTemplateAction: <TInput extends JsonObject>(templateAction: TemplateAction_2<TInput>) => TemplateAction_2<TInput>;
|
|
651
622
|
|
|
652
623
|
/**
|
|
653
624
|
* CreateWorkerOptions
|
|
@@ -694,7 +665,7 @@ export declare interface CurrentClaimedTask {
|
|
|
694
665
|
/**
|
|
695
666
|
* The secrets that are stored with the task.
|
|
696
667
|
*/
|
|
697
|
-
secrets?:
|
|
668
|
+
secrets?: TaskSecrets_2;
|
|
698
669
|
/**
|
|
699
670
|
* The creator of the task.
|
|
700
671
|
*/
|
|
@@ -794,7 +765,7 @@ export declare interface RouterOptions {
|
|
|
794
765
|
database: PluginDatabaseManager;
|
|
795
766
|
catalogClient: CatalogApi;
|
|
796
767
|
scheduler?: PluginTaskScheduler;
|
|
797
|
-
actions?:
|
|
768
|
+
actions?: TemplateAction_2<any>[];
|
|
798
769
|
/**
|
|
799
770
|
* @deprecated taskWorkers is deprecated in favor of concurrentTasksLimit option with a single TaskWorker
|
|
800
771
|
* @defaultValue 1
|
|
@@ -849,7 +820,7 @@ export declare type SerializedTask = {
|
|
|
849
820
|
createdAt: string;
|
|
850
821
|
lastHeartbeatAt?: string;
|
|
851
822
|
createdBy?: string;
|
|
852
|
-
secrets?:
|
|
823
|
+
secrets?: TaskSecrets_2;
|
|
853
824
|
};
|
|
854
825
|
|
|
855
826
|
/**
|
|
@@ -898,7 +869,7 @@ export declare interface TaskBroker {
|
|
|
898
869
|
*/
|
|
899
870
|
export declare type TaskBrokerDispatchOptions = {
|
|
900
871
|
spec: TaskSpec;
|
|
901
|
-
secrets?:
|
|
872
|
+
secrets?: TaskSecrets_2;
|
|
902
873
|
createdBy?: string;
|
|
903
874
|
};
|
|
904
875
|
|
|
@@ -925,7 +896,7 @@ export declare type TaskCompletionState = 'failed' | 'completed';
|
|
|
925
896
|
*/
|
|
926
897
|
export declare interface TaskContext {
|
|
927
898
|
spec: TaskSpec;
|
|
928
|
-
secrets?:
|
|
899
|
+
secrets?: TaskSecrets_2;
|
|
929
900
|
createdBy?: string;
|
|
930
901
|
done: boolean;
|
|
931
902
|
isDryRun?: boolean;
|
|
@@ -955,7 +926,7 @@ export declare class TaskManager implements TaskContext {
|
|
|
955
926
|
static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
|
|
956
927
|
private constructor();
|
|
957
928
|
get spec(): TaskSpecV1beta3;
|
|
958
|
-
get secrets():
|
|
929
|
+
get secrets(): TaskSecrets_2 | undefined;
|
|
959
930
|
get createdBy(): string | undefined;
|
|
960
931
|
getWorkspaceName(): Promise<string>;
|
|
961
932
|
get done(): boolean;
|
|
@@ -965,13 +936,10 @@ export declare class TaskManager implements TaskContext {
|
|
|
965
936
|
}
|
|
966
937
|
|
|
967
938
|
/**
|
|
968
|
-
* TaskSecrets
|
|
969
|
-
*
|
|
970
939
|
* @public
|
|
940
|
+
* @deprecated Use `TaskSecrets` from `@backstage/plugin-scaffolder-node` instead
|
|
971
941
|
*/
|
|
972
|
-
export declare type TaskSecrets =
|
|
973
|
-
backstageToken?: string;
|
|
974
|
-
};
|
|
942
|
+
export declare type TaskSecrets = TaskSecrets_2;
|
|
975
943
|
|
|
976
944
|
/**
|
|
977
945
|
* The status of each step of the Task
|
|
@@ -1021,7 +989,7 @@ export declare interface TaskStore {
|
|
|
1021
989
|
export declare type TaskStoreCreateTaskOptions = {
|
|
1022
990
|
spec: TaskSpec;
|
|
1023
991
|
createdBy?: string;
|
|
1024
|
-
secrets?:
|
|
992
|
+
secrets?: TaskSecrets_2;
|
|
1025
993
|
};
|
|
1026
994
|
|
|
1027
995
|
/**
|
|
@@ -1076,21 +1044,11 @@ export declare class TaskWorker {
|
|
|
1076
1044
|
runOneTask(task: TaskContext): Promise<void>;
|
|
1077
1045
|
}
|
|
1078
1046
|
|
|
1079
|
-
/**
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
description: string;
|
|
1085
|
-
example: string;
|
|
1086
|
-
}[];
|
|
1087
|
-
supportsDryRun?: boolean;
|
|
1088
|
-
schema?: {
|
|
1089
|
-
input?: Schema;
|
|
1090
|
-
output?: Schema;
|
|
1091
|
-
};
|
|
1092
|
-
handler: (ctx: ActionContext<Input>) => Promise<void>;
|
|
1093
|
-
};
|
|
1047
|
+
/**
|
|
1048
|
+
* @public
|
|
1049
|
+
* @deprecated Use `TemplateAction` from `@backstage/plugin-scaffolder-node` instead
|
|
1050
|
+
*/
|
|
1051
|
+
export declare type TemplateAction<TInput extends JsonObject> = TemplateAction_2<TInput>;
|
|
1094
1052
|
|
|
1095
1053
|
/**
|
|
1096
1054
|
* Registry of all registered template actions.
|
|
@@ -1098,9 +1056,9 @@ export declare type TemplateAction<Input extends JsonObject> = {
|
|
|
1098
1056
|
*/
|
|
1099
1057
|
export declare class TemplateActionRegistry {
|
|
1100
1058
|
private readonly actions;
|
|
1101
|
-
register<TInput extends JsonObject>(action:
|
|
1102
|
-
get(actionId: string):
|
|
1103
|
-
list():
|
|
1059
|
+
register<TInput extends JsonObject>(action: TemplateAction_2<TInput>): void;
|
|
1060
|
+
get(actionId: string): TemplateAction_2<JsonObject>;
|
|
1061
|
+
list(): TemplateAction_2<JsonObject>[];
|
|
1104
1062
|
}
|
|
1105
1063
|
|
|
1106
1064
|
/** @public */
|
package/dist/index.cjs.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var errors = require('@backstage/errors');
|
|
6
6
|
var catalogModel = require('@backstage/catalog-model');
|
|
7
|
+
var pluginScaffolderNode = require('@backstage/plugin-scaffolder-node');
|
|
7
8
|
var yaml = require('yaml');
|
|
8
9
|
var fs = require('fs-extra');
|
|
9
10
|
var backendCommon = require('@backstage/backend-common');
|
|
@@ -78,10 +79,6 @@ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
|
|
|
78
79
|
var Router__default = /*#__PURE__*/_interopDefaultLegacy(Router);
|
|
79
80
|
var os__default = /*#__PURE__*/_interopDefaultLegacy(os);
|
|
80
81
|
|
|
81
|
-
const createTemplateAction = (templateAction) => {
|
|
82
|
-
return templateAction;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
82
|
const id$3 = "catalog:register";
|
|
86
83
|
const examples$3 = [
|
|
87
84
|
{
|
|
@@ -102,7 +99,7 @@ const examples$3 = [
|
|
|
102
99
|
];
|
|
103
100
|
function createCatalogRegisterAction(options) {
|
|
104
101
|
const { catalogClient, integrations } = options;
|
|
105
|
-
return createTemplateAction({
|
|
102
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
106
103
|
id: id$3,
|
|
107
104
|
description: "Registers entities from a catalog descriptor file in the workspace into the software catalog.",
|
|
108
105
|
examples: examples$3,
|
|
@@ -254,7 +251,7 @@ const examples$2 = [
|
|
|
254
251
|
}
|
|
255
252
|
];
|
|
256
253
|
function createCatalogWriteAction() {
|
|
257
|
-
return createTemplateAction({
|
|
254
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
258
255
|
id: id$2,
|
|
259
256
|
description: "Writes the catalog-info.yaml for your template",
|
|
260
257
|
examples: examples$2,
|
|
@@ -308,7 +305,7 @@ const examples$1 = [
|
|
|
308
305
|
];
|
|
309
306
|
function createFetchCatalogEntityAction(options) {
|
|
310
307
|
const { catalogClient } = options;
|
|
311
|
-
return createTemplateAction({
|
|
308
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
312
309
|
id: id$1,
|
|
313
310
|
description: "Returns entity from the catalog by entity reference",
|
|
314
311
|
examples: examples$1,
|
|
@@ -392,7 +389,7 @@ const examples = [
|
|
|
392
389
|
}
|
|
393
390
|
];
|
|
394
391
|
function createDebugLogAction() {
|
|
395
|
-
return createTemplateAction({
|
|
392
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
396
393
|
id,
|
|
397
394
|
description: "Writes a message into the log or lists all files in the workspace.",
|
|
398
395
|
examples,
|
|
@@ -480,7 +477,7 @@ async function fetchContents(options) {
|
|
|
480
477
|
|
|
481
478
|
function createFetchPlainAction(options) {
|
|
482
479
|
const { reader, integrations } = options;
|
|
483
|
-
return createTemplateAction({
|
|
480
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
484
481
|
id: "fetch:plain",
|
|
485
482
|
description: "Downloads content and places it in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.",
|
|
486
483
|
schema: {
|
|
@@ -665,7 +662,7 @@ function createFetchTemplateAction(options) {
|
|
|
665
662
|
additionalTemplateFilters,
|
|
666
663
|
additionalTemplateGlobals
|
|
667
664
|
} = options;
|
|
668
|
-
return createTemplateAction({
|
|
665
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
669
666
|
id: "fetch:template",
|
|
670
667
|
description: "Downloads a skeleton, templates variables into file and directory names and content, and places the result in the workspace, or optionally in a subdirectory specified by the `targetPath` input option.",
|
|
671
668
|
schema: {
|
|
@@ -713,6 +710,11 @@ function createFetchTemplateAction(options) {
|
|
|
713
710
|
title: "Template File Extension",
|
|
714
711
|
description: "If set, only files with the given extension will be templated. If set to `true`, the default extension `.njk` is used.",
|
|
715
712
|
type: ["string", "boolean"]
|
|
713
|
+
},
|
|
714
|
+
replace: {
|
|
715
|
+
title: "Replace files",
|
|
716
|
+
description: "If set, replace files in targetPath instead of skipping existing ones.",
|
|
717
|
+
type: "boolean"
|
|
716
718
|
}
|
|
717
719
|
}
|
|
718
720
|
}
|
|
@@ -821,7 +823,7 @@ function createFetchTemplateAction(options) {
|
|
|
821
823
|
continue;
|
|
822
824
|
}
|
|
823
825
|
const outputPath = backendCommon.resolveSafeChildPath(outputDir, localOutputPath);
|
|
824
|
-
if (fs__default["default"].existsSync(outputPath)) {
|
|
826
|
+
if (fs__default["default"].existsSync(outputPath) && !ctx.input.replace) {
|
|
825
827
|
continue;
|
|
826
828
|
}
|
|
827
829
|
if (!renderContents && !extension) {
|
|
@@ -865,7 +867,7 @@ function containsSkippedContent(localOutputPath) {
|
|
|
865
867
|
}
|
|
866
868
|
|
|
867
869
|
const createFilesystemDeleteAction = () => {
|
|
868
|
-
return createTemplateAction({
|
|
870
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
869
871
|
id: "fs:delete",
|
|
870
872
|
description: "Deletes files and directories from the workspace",
|
|
871
873
|
schema: {
|
|
@@ -905,7 +907,7 @@ const createFilesystemDeleteAction = () => {
|
|
|
905
907
|
};
|
|
906
908
|
|
|
907
909
|
const createFilesystemRenameAction = () => {
|
|
908
|
-
return createTemplateAction({
|
|
910
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
909
911
|
id: "fs:rename",
|
|
910
912
|
description: "Renames files and directories within the workspace",
|
|
911
913
|
schema: {
|
|
@@ -1428,7 +1430,7 @@ function extractCollaboratorName(collaborator) {
|
|
|
1428
1430
|
|
|
1429
1431
|
function createGithubActionsDispatchAction(options) {
|
|
1430
1432
|
const { integrations, githubCredentialsProvider } = options;
|
|
1431
|
-
return createTemplateAction({
|
|
1433
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
1432
1434
|
id: "github:actions:dispatch",
|
|
1433
1435
|
description: "Dispatches a GitHub Action workflow for a given branch or tag",
|
|
1434
1436
|
schema: {
|
|
@@ -1501,7 +1503,7 @@ function createGithubActionsDispatchAction(options) {
|
|
|
1501
1503
|
|
|
1502
1504
|
function createGithubIssuesLabelAction(options) {
|
|
1503
1505
|
const { integrations, githubCredentialsProvider } = options;
|
|
1504
|
-
return createTemplateAction({
|
|
1506
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
1505
1507
|
id: "github:issues:label",
|
|
1506
1508
|
description: "Adds labels to a pull request or issue on GitHub.",
|
|
1507
1509
|
schema: {
|
|
@@ -1814,7 +1816,7 @@ const repoContentsUrl = {
|
|
|
1814
1816
|
|
|
1815
1817
|
function createGithubRepoCreateAction(options) {
|
|
1816
1818
|
const { integrations, githubCredentialsProvider } = options;
|
|
1817
|
-
return createTemplateAction({
|
|
1819
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
1818
1820
|
id: "github:repo:create",
|
|
1819
1821
|
description: "Creates a GitHub repository.",
|
|
1820
1822
|
schema: {
|
|
@@ -1919,7 +1921,7 @@ function createGithubRepoCreateAction(options) {
|
|
|
1919
1921
|
|
|
1920
1922
|
function createGithubRepoPushAction(options) {
|
|
1921
1923
|
const { integrations, config, githubCredentialsProvider } = options;
|
|
1922
|
-
return createTemplateAction({
|
|
1924
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
1923
1925
|
id: "github:repo:push",
|
|
1924
1926
|
description: "Initializes a git repository of contents in workspace and publishes it to GitHub.",
|
|
1925
1927
|
schema: {
|
|
@@ -2024,7 +2026,7 @@ function createGithubRepoPushAction(options) {
|
|
|
2024
2026
|
function createGithubWebhookAction(options) {
|
|
2025
2027
|
const { integrations, defaultWebhookSecret, githubCredentialsProvider } = options;
|
|
2026
2028
|
const eventNames = webhooks.emitterEventNames.filter((event) => !event.includes("."));
|
|
2027
|
-
return createTemplateAction({
|
|
2029
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
2028
2030
|
id: "github:webhook",
|
|
2029
2031
|
description: "Creates webhook for a repository on GitHub.",
|
|
2030
2032
|
schema: {
|
|
@@ -2141,7 +2143,7 @@ function createGithubWebhookAction(options) {
|
|
|
2141
2143
|
|
|
2142
2144
|
function createPublishAzureAction(options) {
|
|
2143
2145
|
const { integrations, config } = options;
|
|
2144
|
-
return createTemplateAction({
|
|
2146
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
2145
2147
|
id: "publish:azure",
|
|
2146
2148
|
description: "Initializes a git repository of the content in the workspace, and publishes it to Azure.",
|
|
2147
2149
|
schema: {
|
|
@@ -2404,7 +2406,7 @@ const performEnableLFS$1 = async (opts) => {
|
|
|
2404
2406
|
};
|
|
2405
2407
|
function createPublishBitbucketAction(options) {
|
|
2406
2408
|
const { integrations, config } = options;
|
|
2407
|
-
return createTemplateAction({
|
|
2409
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
2408
2410
|
id: "publish:bitbucket",
|
|
2409
2411
|
description: "Initializes a git repository of the content in the workspace, and publishes it to Bitbucket.",
|
|
2410
2412
|
schema: {
|
|
@@ -2631,7 +2633,7 @@ const getAuthorizationHeader = (config) => {
|
|
|
2631
2633
|
};
|
|
2632
2634
|
function createPublishBitbucketCloudAction(options) {
|
|
2633
2635
|
const { integrations, config } = options;
|
|
2634
|
-
return createTemplateAction({
|
|
2636
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
2635
2637
|
id: "publish:bitbucketCloud",
|
|
2636
2638
|
description: "Initializes a git repository of the content in the workspace, and publishes it to Bitbucket Cloud.",
|
|
2637
2639
|
schema: {
|
|
@@ -2825,7 +2827,7 @@ const performEnableLFS = async (opts) => {
|
|
|
2825
2827
|
};
|
|
2826
2828
|
function createPublishBitbucketServerAction(options) {
|
|
2827
2829
|
const { integrations, config } = options;
|
|
2828
|
-
return createTemplateAction({
|
|
2830
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
2829
2831
|
id: "publish:bitbucketServer",
|
|
2830
2832
|
description: "Initializes a git repository of the content in the workspace, and publishes it to Bitbucket Server.",
|
|
2831
2833
|
schema: {
|
|
@@ -3005,7 +3007,7 @@ Change-Id: I${changeId}`;
|
|
|
3005
3007
|
};
|
|
3006
3008
|
function createPublishGerritAction(options) {
|
|
3007
3009
|
const { integrations, config } = options;
|
|
3008
|
-
return createTemplateAction({
|
|
3010
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
3009
3011
|
id: "publish:gerrit",
|
|
3010
3012
|
description: "Initializes a git repository of the content in the workspace, and publishes it to Gerrit.",
|
|
3011
3013
|
schema: {
|
|
@@ -3124,7 +3126,7 @@ const generateGerritChangeId = () => {
|
|
|
3124
3126
|
};
|
|
3125
3127
|
function createPublishGerritReviewAction(options) {
|
|
3126
3128
|
const { integrations, config } = options;
|
|
3127
|
-
return createTemplateAction({
|
|
3129
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
3128
3130
|
id: "publish:gerrit:review",
|
|
3129
3131
|
description: "Creates a new Gerrit review.",
|
|
3130
3132
|
schema: {
|
|
@@ -3229,7 +3231,7 @@ Change-Id: ${changeId}`;
|
|
|
3229
3231
|
|
|
3230
3232
|
function createPublishGithubAction(options) {
|
|
3231
3233
|
const { integrations, config, githubCredentialsProvider } = options;
|
|
3232
|
-
return createTemplateAction({
|
|
3234
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
3233
3235
|
id: "publish:github",
|
|
3234
3236
|
description: "Initializes a git repository of contents in workspace and publishes it to GitHub.",
|
|
3235
3237
|
schema: {
|
|
@@ -3478,7 +3480,7 @@ const createPublishGithubPullRequestAction = ({
|
|
|
3478
3480
|
githubCredentialsProvider,
|
|
3479
3481
|
clientFactory = defaultClientFactory
|
|
3480
3482
|
}) => {
|
|
3481
|
-
return createTemplateAction({
|
|
3483
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
3482
3484
|
id: "publish:github:pull-request",
|
|
3483
3485
|
schema: {
|
|
3484
3486
|
input: {
|
|
@@ -3680,7 +3682,7 @@ const createPublishGithubPullRequestAction = ({
|
|
|
3680
3682
|
|
|
3681
3683
|
function createPublishGitlabAction(options) {
|
|
3682
3684
|
const { integrations, config } = options;
|
|
3683
|
-
return createTemplateAction({
|
|
3685
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
3684
3686
|
id: "publish:gitlab",
|
|
3685
3687
|
description: "Initializes a git repository of the content in the workspace, and publishes it to GitLab.",
|
|
3686
3688
|
schema: {
|
|
@@ -3837,7 +3839,7 @@ function createPublishGitlabAction(options) {
|
|
|
3837
3839
|
|
|
3838
3840
|
const createPublishGitlabMergeRequestAction = (options) => {
|
|
3839
3841
|
const { integrations } = options;
|
|
3840
|
-
return createTemplateAction({
|
|
3842
|
+
return pluginScaffolderNode.createTemplateAction({
|
|
3841
3843
|
id: "publish:gitlab:merge-request",
|
|
3842
3844
|
schema: {
|
|
3843
3845
|
input: {
|
|
@@ -5055,7 +5057,7 @@ function createDryRunner(options) {
|
|
|
5055
5057
|
const workflowRunner = new NunjucksWorkflowRunner({
|
|
5056
5058
|
...options,
|
|
5057
5059
|
actionRegistry: new DecoratedActionsRegistry(options.actionRegistry, [
|
|
5058
|
-
createTemplateAction({
|
|
5060
|
+
pluginScaffolderNode.createTemplateAction({
|
|
5059
5061
|
id: "dry-run:extract",
|
|
5060
5062
|
supportsDryRun: true,
|
|
5061
5063
|
async handler(ctx) {
|
|
@@ -5661,16 +5663,13 @@ class ScaffolderActionsExtensionPointImpl {
|
|
|
5661
5663
|
}
|
|
5662
5664
|
}
|
|
5663
5665
|
_actions = new WeakMap();
|
|
5664
|
-
const scaffolderActionsExtensionPoint = backendPluginApi.createExtensionPoint({
|
|
5665
|
-
id: "scaffolder.actions"
|
|
5666
|
-
});
|
|
5667
5666
|
const scaffolderPlugin = backendPluginApi.createBackendPlugin(
|
|
5668
5667
|
(options) => ({
|
|
5669
5668
|
id: "scaffolder",
|
|
5670
5669
|
register(env) {
|
|
5671
5670
|
const actionsExtensions = new ScaffolderActionsExtensionPointImpl();
|
|
5672
5671
|
env.registerExtensionPoint(
|
|
5673
|
-
scaffolderActionsExtensionPoint,
|
|
5672
|
+
pluginScaffolderNode.scaffolderActionsExtensionPoint,
|
|
5674
5673
|
actionsExtensions
|
|
5675
5674
|
);
|
|
5676
5675
|
env.registerInit({
|
|
@@ -5732,6 +5731,8 @@ const scaffolderPlugin = backendPluginApi.createBackendPlugin(
|
|
|
5732
5731
|
})
|
|
5733
5732
|
);
|
|
5734
5733
|
|
|
5734
|
+
const createTemplateAction = pluginScaffolderNode.createTemplateAction;
|
|
5735
|
+
|
|
5735
5736
|
exports.DatabaseTaskStore = DatabaseTaskStore;
|
|
5736
5737
|
exports.ScaffolderEntitiesProcessor = ScaffolderEntitiesProcessor;
|
|
5737
5738
|
exports.TaskManager = TaskManager;
|