@backstage/plugin-scaffolder-backend 1.12.0 → 1.12.1-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 +24 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.cjs.js +347 -150
- package/dist/alpha.cjs.js.map +1 -1
- package/dist/index.cjs.js +348 -150
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +31 -7
- package/package.json +14 -11
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import { ScmIntegrations, ScmIntegrationRegistry, GithubCredentialsProvider } fr
|
|
|
5
5
|
import { CatalogApi } from '@backstage/catalog-client';
|
|
6
6
|
import { UrlReader, PluginDatabaseManager } from '@backstage/backend-common';
|
|
7
7
|
import { Config } from '@backstage/config';
|
|
8
|
-
import { JsonValue, JsonObject, Observable } from '@backstage/types';
|
|
8
|
+
import { JsonValue, HumanDuration, JsonObject, Observable } from '@backstage/types';
|
|
9
|
+
import { Duration } from 'luxon';
|
|
9
10
|
import { Octokit } from 'octokit';
|
|
10
11
|
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
|
11
12
|
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
@@ -18,7 +19,8 @@ import { PluginTaskScheduler } from '@backstage/backend-tasks';
|
|
|
18
19
|
import express from 'express';
|
|
19
20
|
import { IdentityApi } from '@backstage/plugin-auth-node';
|
|
20
21
|
import { Entity } from '@backstage/catalog-model';
|
|
21
|
-
import { CatalogProcessor,
|
|
22
|
+
import { CatalogProcessor, CatalogProcessorEmit } from '@backstage/plugin-catalog-node';
|
|
23
|
+
import { LocationSpec } from '@backstage/plugin-catalog-common';
|
|
22
24
|
import * as jsonschema from 'jsonschema';
|
|
23
25
|
import * as zod from 'zod';
|
|
24
26
|
|
|
@@ -117,6 +119,20 @@ declare function createDebugLogAction(): _backstage_plugin_scaffolder_node.Templ
|
|
|
117
119
|
listWorkspace?: boolean | undefined;
|
|
118
120
|
}>;
|
|
119
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Waits for a certain period of time.
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
*
|
|
127
|
+
* This task is useful to give some waiting time for manual intervention.
|
|
128
|
+
* Has to be used in a combination with other actions.
|
|
129
|
+
*
|
|
130
|
+
* @public
|
|
131
|
+
*/
|
|
132
|
+
declare function createWaitAction(options?: {
|
|
133
|
+
maxWaitTime?: Duration | HumanDuration;
|
|
134
|
+
}): _backstage_plugin_scaffolder_node.TemplateAction<HumanDuration>;
|
|
135
|
+
|
|
120
136
|
/**
|
|
121
137
|
* Downloads content and places it in the workspace, or optionally
|
|
122
138
|
* in a subdirectory specified by the 'targetPath' input option.
|
|
@@ -649,7 +665,7 @@ declare class TemplateActionRegistry {
|
|
|
649
665
|
*
|
|
650
666
|
* @public
|
|
651
667
|
*/
|
|
652
|
-
declare type TaskStatus = '
|
|
668
|
+
declare type TaskStatus = 'cancelled' | 'completed' | 'failed' | 'open' | 'processing';
|
|
653
669
|
/**
|
|
654
670
|
* The state of a completed task.
|
|
655
671
|
*
|
|
@@ -675,7 +691,7 @@ declare type SerializedTask = {
|
|
|
675
691
|
*
|
|
676
692
|
* @public
|
|
677
693
|
*/
|
|
678
|
-
declare type TaskEventType = 'completion' | 'log';
|
|
694
|
+
declare type TaskEventType = 'completion' | 'log' | 'cancelled';
|
|
679
695
|
/**
|
|
680
696
|
* SerializedTaskEvent
|
|
681
697
|
*
|
|
@@ -713,13 +729,14 @@ declare type TaskBrokerDispatchOptions = {
|
|
|
713
729
|
* @public
|
|
714
730
|
*/
|
|
715
731
|
interface TaskContext {
|
|
732
|
+
cancelSignal: AbortSignal;
|
|
716
733
|
spec: TaskSpec;
|
|
717
734
|
secrets?: TaskSecrets$1;
|
|
718
735
|
createdBy?: string;
|
|
719
736
|
done: boolean;
|
|
720
737
|
isDryRun?: boolean;
|
|
721
|
-
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
|
|
722
738
|
complete(result: TaskCompletionState, metadata?: JsonObject): Promise<void>;
|
|
739
|
+
emitLog(message: string, logMetadata?: JsonObject): Promise<void>;
|
|
723
740
|
getWorkspaceName(): Promise<string>;
|
|
724
741
|
}
|
|
725
742
|
/**
|
|
@@ -728,6 +745,7 @@ interface TaskContext {
|
|
|
728
745
|
* @public
|
|
729
746
|
*/
|
|
730
747
|
interface TaskBroker {
|
|
748
|
+
cancel?(taskId: string): Promise<void>;
|
|
731
749
|
claim(): Promise<TaskContext>;
|
|
732
750
|
dispatch(options: TaskBrokerDispatchOptions): Promise<TaskBrokerDispatchResult>;
|
|
733
751
|
vacuumTasks(options: {
|
|
@@ -794,6 +812,7 @@ declare type TaskStoreCreateTaskResult = {
|
|
|
794
812
|
* @public
|
|
795
813
|
*/
|
|
796
814
|
interface TaskStore {
|
|
815
|
+
cancelTask?(options: TaskStoreEmitOptions): Promise<void>;
|
|
797
816
|
createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
|
|
798
817
|
getTask(taskId: string): Promise<SerializedTask>;
|
|
799
818
|
claimTask(): Promise<SerializedTask | undefined>;
|
|
@@ -869,6 +888,9 @@ declare class DatabaseTaskStore implements TaskStore {
|
|
|
869
888
|
events: SerializedTaskEvent[];
|
|
870
889
|
}>;
|
|
871
890
|
shutdownTask(options: TaskStoreShutDownTaskOptions): Promise<void>;
|
|
891
|
+
cancelTask(options: TaskStoreEmitOptions<{
|
|
892
|
+
message: string;
|
|
893
|
+
} & JsonObject>): Promise<void>;
|
|
872
894
|
}
|
|
873
895
|
|
|
874
896
|
/**
|
|
@@ -879,12 +901,14 @@ declare class DatabaseTaskStore implements TaskStore {
|
|
|
879
901
|
declare class TaskManager implements TaskContext {
|
|
880
902
|
private readonly task;
|
|
881
903
|
private readonly storage;
|
|
904
|
+
private readonly signal;
|
|
882
905
|
private readonly logger;
|
|
883
906
|
private isDone;
|
|
884
907
|
private heartbeatTimeoutId?;
|
|
885
|
-
static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
|
|
908
|
+
static create(task: CurrentClaimedTask, storage: TaskStore, abortSignal: AbortSignal, logger: Logger): TaskManager;
|
|
886
909
|
private constructor();
|
|
887
910
|
get spec(): _backstage_plugin_scaffolder_common.TaskSpecV1beta3;
|
|
911
|
+
get cancelSignal(): AbortSignal;
|
|
888
912
|
get secrets(): TaskSecrets$1 | undefined;
|
|
889
913
|
get createdBy(): string | undefined;
|
|
890
914
|
getWorkspaceName(): Promise<string>;
|
|
@@ -1022,4 +1046,4 @@ declare type TaskSecrets = TaskSecrets$1;
|
|
|
1022
1046
|
*/
|
|
1023
1047
|
declare type TemplateAction<TInput extends JsonObject> = TemplateAction$1<TInput>;
|
|
1024
1048
|
|
|
1025
|
-
export { ActionContext, CreateBuiltInActionsOptions, CreateGithubPullRequestActionOptions, CreateGithubPullRequestClientFactoryInput, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DatabaseTaskStoreOptions, OctokitWithPullRequestPluginClient, RouterOptions, RunCommandOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskStatus, TaskStore, TaskStoreCreateTaskOptions, TaskStoreCreateTaskResult, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskStoreShutDownTaskOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, TemplateGlobal, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchCatalogEntityAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishBitbucketCloudAction, createPublishBitbucketServerAction, createPublishGerritAction, createPublishGerritReviewAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, executeShellCommand, fetchContents };
|
|
1049
|
+
export { ActionContext, CreateBuiltInActionsOptions, CreateGithubPullRequestActionOptions, CreateGithubPullRequestClientFactoryInput, CreateWorkerOptions, CurrentClaimedTask, DatabaseTaskStore, DatabaseTaskStoreOptions, OctokitWithPullRequestPluginClient, RouterOptions, RunCommandOptions, ScaffolderEntitiesProcessor, SerializedTask, SerializedTaskEvent, TaskBroker, TaskBrokerDispatchOptions, TaskBrokerDispatchResult, TaskCompletionState, TaskContext, TaskEventType, TaskManager, TaskSecrets, TaskStatus, TaskStore, TaskStoreCreateTaskOptions, TaskStoreCreateTaskResult, TaskStoreEmitOptions, TaskStoreListEventsOptions, TaskStoreShutDownTaskOptions, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, TemplateGlobal, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchCatalogEntityAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubIssuesLabelAction, createGithubRepoCreateAction, createGithubRepoPushAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishBitbucketCloudAction, createPublishBitbucketServerAction, createPublishGerritAction, createPublishGerritReviewAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, createWaitAction, executeShellCommand, fetchContents };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder-backend",
|
|
3
3
|
"description": "The Backstage backend plugin that helps you create new things",
|
|
4
|
-
"version": "1.12.0",
|
|
4
|
+
"version": "1.12.1-next.0",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -44,24 +44,26 @@
|
|
|
44
44
|
"build:assets": "node scripts/build-nunjucks.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@backstage/backend-common": "^0.18.
|
|
48
|
-
"@backstage/backend-plugin-api": "^0.5.0",
|
|
49
|
-
"@backstage/backend-tasks": "^0.5.0",
|
|
47
|
+
"@backstage/backend-common": "^0.18.4-next.0",
|
|
48
|
+
"@backstage/backend-plugin-api": "^0.5.1-next.0",
|
|
49
|
+
"@backstage/backend-tasks": "^0.5.1-next.0",
|
|
50
50
|
"@backstage/catalog-client": "^1.4.0",
|
|
51
51
|
"@backstage/catalog-model": "^1.2.1",
|
|
52
52
|
"@backstage/config": "^1.0.7",
|
|
53
53
|
"@backstage/errors": "^1.1.5",
|
|
54
54
|
"@backstage/integration": "^1.4.3",
|
|
55
|
-
"@backstage/plugin-auth-node": "^0.2.
|
|
56
|
-
"@backstage/plugin-catalog-backend": "^1.8.0",
|
|
57
|
-
"@backstage/plugin-catalog-
|
|
58
|
-
"@backstage/plugin-
|
|
59
|
-
"@backstage/plugin-scaffolder-
|
|
55
|
+
"@backstage/plugin-auth-node": "^0.2.13-next.0",
|
|
56
|
+
"@backstage/plugin-catalog-backend": "^1.8.1-next.0",
|
|
57
|
+
"@backstage/plugin-catalog-common": "^1.0.12",
|
|
58
|
+
"@backstage/plugin-catalog-node": "^1.3.5-next.0",
|
|
59
|
+
"@backstage/plugin-scaffolder-common": "^1.2.7-next.0",
|
|
60
|
+
"@backstage/plugin-scaffolder-node": "^0.1.2-next.0",
|
|
60
61
|
"@backstage/types": "^1.0.2",
|
|
61
62
|
"@gitbeaker/core": "^35.6.0",
|
|
62
63
|
"@gitbeaker/node": "^35.1.0",
|
|
63
64
|
"@octokit/webhooks": "^10.0.0",
|
|
64
65
|
"@types/express": "^4.17.6",
|
|
66
|
+
"@types/luxon": "^3.0.0",
|
|
65
67
|
"azure-devops-node-api": "^11.0.1",
|
|
66
68
|
"command-exists": "^1.2.9",
|
|
67
69
|
"compression": "^1.7.4",
|
|
@@ -93,8 +95,8 @@
|
|
|
93
95
|
"zod": "~3.18.0"
|
|
94
96
|
},
|
|
95
97
|
"devDependencies": {
|
|
96
|
-
"@backstage/backend-test-utils": "^0.1.
|
|
97
|
-
"@backstage/cli": "^0.22.
|
|
98
|
+
"@backstage/backend-test-utils": "^0.1.36-next.0",
|
|
99
|
+
"@backstage/cli": "^0.22.6-next.0",
|
|
98
100
|
"@types/command-exists": "^1.2.0",
|
|
99
101
|
"@types/fs-extra": "^9.0.1",
|
|
100
102
|
"@types/git-url-parse": "^9.0.0",
|
|
@@ -107,6 +109,7 @@
|
|
|
107
109
|
"mock-fs": "^5.1.0",
|
|
108
110
|
"msw": "^1.0.0",
|
|
109
111
|
"supertest": "^6.1.3",
|
|
112
|
+
"wait-for-expect": "^3.0.2",
|
|
110
113
|
"yaml": "^2.0.0"
|
|
111
114
|
},
|
|
112
115
|
"files": [
|