@backstage/plugin-scaffolder-backend 0.17.3 → 0.18.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 +41 -0
- package/dist/index.cjs.js +73 -297
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +11 -83
- package/migrations/20210120143715_init.js +1 -1
- package/package.json +10 -12
package/dist/index.d.ts
CHANGED
|
@@ -5,13 +5,12 @@ import { Logger } from 'winston';
|
|
|
5
5
|
import { Writable } from 'stream';
|
|
6
6
|
import { JsonValue, JsonObject, Observable } from '@backstage/types';
|
|
7
7
|
import { Schema } from 'jsonschema';
|
|
8
|
-
import
|
|
8
|
+
import * as _backstage_plugin_scaffolder_common from '@backstage/plugin-scaffolder-common';
|
|
9
|
+
import { TaskSpec, TemplateInfo } from '@backstage/plugin-scaffolder-common';
|
|
9
10
|
import { Entity } from '@backstage/catalog-model';
|
|
10
|
-
import { UrlReader,
|
|
11
|
+
import { UrlReader, PluginDatabaseManager } from '@backstage/backend-common';
|
|
11
12
|
import { Config } from '@backstage/config';
|
|
12
13
|
import { createPullRequest } from 'octokit-plugin-create-pull-request';
|
|
13
|
-
import { Octokit } from 'octokit';
|
|
14
|
-
export { createFetchCookiecutterAction } from '@backstage/plugin-scaffolder-backend-module-cookiecutter';
|
|
15
14
|
import { SpawnOptionsWithoutStdio } from 'child_process';
|
|
16
15
|
import { Knex } from 'knex';
|
|
17
16
|
import express from 'express';
|
|
@@ -51,26 +50,12 @@ declare type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
|
|
|
51
50
|
* @public
|
|
52
51
|
*/
|
|
53
52
|
declare type TaskStatus = 'open' | 'processing' | 'failed' | 'cancelled' | 'completed';
|
|
54
|
-
/**
|
|
55
|
-
* The status of each step of the Task
|
|
56
|
-
*
|
|
57
|
-
* @public
|
|
58
|
-
* @deprecated use TaskStatus instead
|
|
59
|
-
*/
|
|
60
|
-
declare type Status = TaskStatus;
|
|
61
53
|
/**
|
|
62
54
|
* The state of a completed task.
|
|
63
55
|
*
|
|
64
56
|
* @public
|
|
65
57
|
*/
|
|
66
58
|
declare type TaskCompletionState = 'failed' | 'completed';
|
|
67
|
-
/**
|
|
68
|
-
* The state of a completed task.
|
|
69
|
-
*
|
|
70
|
-
* @public
|
|
71
|
-
* @deprecated use TaskCompletionState instead
|
|
72
|
-
*/
|
|
73
|
-
declare type CompletedTaskState = TaskCompletionState;
|
|
74
59
|
/**
|
|
75
60
|
* SerializedTask
|
|
76
61
|
*
|
|
@@ -128,13 +113,6 @@ declare type TaskBrokerDispatchOptions = {
|
|
|
128
113
|
spec: TaskSpec;
|
|
129
114
|
secrets?: TaskSecrets;
|
|
130
115
|
};
|
|
131
|
-
/**
|
|
132
|
-
* DispatchResult
|
|
133
|
-
*
|
|
134
|
-
* @public
|
|
135
|
-
* @deprecated use TaskBrokerDispatchResult instead
|
|
136
|
-
*/
|
|
137
|
-
declare type DispatchResult = TaskBrokerDispatchResult;
|
|
138
116
|
/**
|
|
139
117
|
* Task
|
|
140
118
|
*
|
|
@@ -230,13 +208,9 @@ interface TaskStore {
|
|
|
230
208
|
|
|
231
209
|
/**
|
|
232
210
|
* ActionContext is passed into scaffolder actions.
|
|
233
|
-
* @public
|
|
211
|
+
* @public
|
|
212
|
+
*/
|
|
234
213
|
declare type ActionContext<Input extends JsonObject> = {
|
|
235
|
-
/**
|
|
236
|
-
* Base URL for the location of the task spec, typically the url of the source entity file.
|
|
237
|
-
* @deprecated please use templateInfo.baseUrl instead
|
|
238
|
-
*/
|
|
239
|
-
baseUrl?: string;
|
|
240
214
|
logger: Logger;
|
|
241
215
|
logStream: Writable;
|
|
242
216
|
secrets?: TaskSecrets;
|
|
@@ -247,10 +221,6 @@ declare type ActionContext<Input extends JsonObject> = {
|
|
|
247
221
|
* Creates a temporary directory for use by the action, which is then cleaned up automatically.
|
|
248
222
|
*/
|
|
249
223
|
createTemporaryDirectory(): Promise<string>;
|
|
250
|
-
/**
|
|
251
|
-
* @deprecated please use templateInfo instead
|
|
252
|
-
*/
|
|
253
|
-
metadata?: TemplateMetadata;
|
|
254
224
|
templateInfo?: TemplateInfo;
|
|
255
225
|
};
|
|
256
226
|
/** @public */
|
|
@@ -272,8 +242,6 @@ interface CreateBuiltInActionsOptions {
|
|
|
272
242
|
reader: UrlReader;
|
|
273
243
|
integrations: ScmIntegrations;
|
|
274
244
|
catalogClient: CatalogApi;
|
|
275
|
-
/** @deprecated when the cookiecutter action is removed this won't be necessary */
|
|
276
|
-
containerRunner?: ContainerRunner;
|
|
277
245
|
config: Config;
|
|
278
246
|
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
279
247
|
}
|
|
@@ -432,6 +400,10 @@ declare function createPublishGithubAction(options: {
|
|
|
432
400
|
description?: string | undefined;
|
|
433
401
|
access?: string | undefined;
|
|
434
402
|
defaultBranch?: string | undefined;
|
|
403
|
+
deleteBranchOnMerge?: boolean | undefined;
|
|
404
|
+
allowRebaseMerge?: boolean | undefined;
|
|
405
|
+
allowSquashMerge?: boolean | undefined;
|
|
406
|
+
allowMergeCommit?: boolean | undefined;
|
|
435
407
|
sourcePath?: string | undefined;
|
|
436
408
|
requireCodeOwnerReviews?: boolean | undefined;
|
|
437
409
|
repoVisibility?: "internal" | "private" | "public" | undefined;
|
|
@@ -550,36 +522,6 @@ declare function createGithubWebhookAction(options: {
|
|
|
550
522
|
token?: string | undefined;
|
|
551
523
|
}>;
|
|
552
524
|
|
|
553
|
-
declare type OctokitIntegration = {
|
|
554
|
-
client: Octokit;
|
|
555
|
-
token: string;
|
|
556
|
-
owner: string;
|
|
557
|
-
repo: string;
|
|
558
|
-
};
|
|
559
|
-
/**
|
|
560
|
-
* OctokitProvider provides Octokit client based on ScmIntegrationsRegistry configuration.
|
|
561
|
-
* OctokitProvider supports GitHub credentials caching out of the box.
|
|
562
|
-
*
|
|
563
|
-
* @deprecated we are no longer providing a way from the scaffolder to generate octokit instances.
|
|
564
|
-
* Implement your own if you're using this method from an external package, or use the internal `getOctokitOptions` function instead
|
|
565
|
-
*/
|
|
566
|
-
declare class OctokitProvider {
|
|
567
|
-
private readonly integrations;
|
|
568
|
-
private readonly githubCredentialsProvider;
|
|
569
|
-
constructor(integrations: ScmIntegrationRegistry, githubCredentialsProvider?: GithubCredentialsProvider);
|
|
570
|
-
/**
|
|
571
|
-
* gets standard Octokit client based on repository URL.
|
|
572
|
-
*
|
|
573
|
-
* @param repoUrl - Repository URL
|
|
574
|
-
*
|
|
575
|
-
* @deprecated we are no longer providing a way from the scaffolder to generate octokit instances.
|
|
576
|
-
* Implement your own if you're using this method from an external package, or use the internal `getOctokitOptions` function instead
|
|
577
|
-
*/
|
|
578
|
-
getOctokit(repoUrl: string, options?: {
|
|
579
|
-
token?: string;
|
|
580
|
-
}): Promise<OctokitIntegration>;
|
|
581
|
-
}
|
|
582
|
-
|
|
583
525
|
/** @public */
|
|
584
526
|
declare type RunCommandOptions = {
|
|
585
527
|
/** command to run */
|
|
@@ -597,12 +539,6 @@ declare type RunCommandOptions = {
|
|
|
597
539
|
* @public
|
|
598
540
|
*/
|
|
599
541
|
declare const executeShellCommand: (options: RunCommandOptions) => Promise<void>;
|
|
600
|
-
/**
|
|
601
|
-
* Run a command in a sub-process, normally a shell command.
|
|
602
|
-
* @public
|
|
603
|
-
* @deprecated use {@link executeShellCommand} instead
|
|
604
|
-
*/
|
|
605
|
-
declare const runCommand: (options: RunCommandOptions) => Promise<void>;
|
|
606
542
|
|
|
607
543
|
/**
|
|
608
544
|
* Registry of all registered template actions.
|
|
@@ -675,7 +611,7 @@ declare class TaskManager implements TaskContext {
|
|
|
675
611
|
private heartbeatTimeoutId?;
|
|
676
612
|
static create(task: CurrentClaimedTask, storage: TaskStore, logger: Logger): TaskManager;
|
|
677
613
|
private constructor();
|
|
678
|
-
get spec():
|
|
614
|
+
get spec(): _backstage_plugin_scaffolder_common.TaskSpecV1beta3;
|
|
679
615
|
get secrets(): TaskSecrets | undefined;
|
|
680
616
|
getWorkspaceName(): Promise<string>;
|
|
681
617
|
get done(): boolean;
|
|
@@ -693,13 +629,6 @@ interface CurrentClaimedTask {
|
|
|
693
629
|
taskId: string;
|
|
694
630
|
secrets?: TaskSecrets;
|
|
695
631
|
}
|
|
696
|
-
/**
|
|
697
|
-
* TaskState
|
|
698
|
-
*
|
|
699
|
-
* @public
|
|
700
|
-
* @deprecated use CurrentClaimedTask instead
|
|
701
|
-
*/
|
|
702
|
-
declare type TaskState = CurrentClaimedTask;
|
|
703
632
|
|
|
704
633
|
/**
|
|
705
634
|
* CreateWorkerOptions
|
|
@@ -740,7 +669,6 @@ interface RouterOptions {
|
|
|
740
669
|
catalogClient: CatalogApi;
|
|
741
670
|
actions?: TemplateAction<any>[];
|
|
742
671
|
taskWorkers?: number;
|
|
743
|
-
containerRunner?: ContainerRunner;
|
|
744
672
|
taskBroker?: TaskBroker;
|
|
745
673
|
additionalTemplateFilters?: Record<string, TemplateFilter>;
|
|
746
674
|
}
|
|
@@ -755,4 +683,4 @@ declare class ScaffolderEntitiesProcessor implements CatalogProcessor {
|
|
|
755
683
|
postProcessEntity(entity: Entity, _location: LocationSpec, emit: CatalogProcessorEmit): Promise<Entity>;
|
|
756
684
|
}
|
|
757
685
|
|
|
758
|
-
export { ActionContext,
|
|
686
|
+
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, TaskWorker, TemplateAction, TemplateActionRegistry, TemplateFilter, createBuiltinActions, createCatalogRegisterAction, createCatalogWriteAction, createDebugLogAction, createFetchPlainAction, createFetchTemplateAction, createFilesystemDeleteAction, createFilesystemRenameAction, createGithubActionsDispatchAction, createGithubWebhookAction, createPublishAzureAction, createPublishBitbucketAction, createPublishFileAction, createPublishGithubAction, createPublishGithubPullRequestAction, createPublishGitlabAction, createPublishGitlabMergeRequestAction, createRouter, createTemplateAction, executeShellCommand, fetchContents };
|
|
@@ -75,7 +75,7 @@ exports.up = async function up(knex) {
|
|
|
75
75
|
* @param {import('knex').Knex} knex
|
|
76
76
|
*/
|
|
77
77
|
exports.down = async function down(knex) {
|
|
78
|
-
if (knex.client.config.client
|
|
78
|
+
if (!knex.client.config.client.includes('sqlite3')) {
|
|
79
79
|
await knex.schema.alterTable('task_events', table => {
|
|
80
80
|
table.dropIndex([], 'task_events_task_id_idx');
|
|
81
81
|
});
|
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": "0.
|
|
4
|
+
"version": "0.18.0-next.0",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -34,15 +34,14 @@
|
|
|
34
34
|
"build:assets": "node scripts/build-nunjucks.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@backstage/backend-common": "^0.
|
|
38
|
-
"@backstage/catalog-client": "^0.
|
|
39
|
-
"@backstage/catalog-model": "^0.
|
|
37
|
+
"@backstage/backend-common": "^0.13.0-next.0",
|
|
38
|
+
"@backstage/catalog-client": "^0.9.0-next.0",
|
|
39
|
+
"@backstage/catalog-model": "^0.13.0-next.0",
|
|
40
40
|
"@backstage/config": "^0.1.15",
|
|
41
41
|
"@backstage/errors": "^0.2.2",
|
|
42
42
|
"@backstage/integration": "^0.8.0",
|
|
43
|
-
"@backstage/plugin-catalog-backend": "^0.
|
|
44
|
-
"@backstage/plugin-scaffolder-
|
|
45
|
-
"@backstage/plugin-scaffolder-common": "^0.2.3",
|
|
43
|
+
"@backstage/plugin-catalog-backend": "^0.24.0-next.0",
|
|
44
|
+
"@backstage/plugin-scaffolder-common": "^0.3.0-next.0",
|
|
46
45
|
"@backstage/types": "^0.1.3",
|
|
47
46
|
"@gitbeaker/core": "^34.6.0",
|
|
48
47
|
"@gitbeaker/node": "^35.1.0",
|
|
@@ -54,10 +53,9 @@
|
|
|
54
53
|
"cors": "^2.8.5",
|
|
55
54
|
"express": "^4.17.1",
|
|
56
55
|
"express-promise-router": "^4.1.0",
|
|
57
|
-
"fs-extra": "10.0.
|
|
56
|
+
"fs-extra": "10.0.1",
|
|
58
57
|
"git-url-parse": "^11.6.0",
|
|
59
58
|
"globby": "^11.0.0",
|
|
60
|
-
"handlebars": "^4.7.6",
|
|
61
59
|
"isbinaryfile": "^4.0.8",
|
|
62
60
|
"isomorphic-git": "^1.8.0",
|
|
63
61
|
"jsonschema": "^1.2.6",
|
|
@@ -76,8 +74,8 @@
|
|
|
76
74
|
"zen-observable": "^0.8.15"
|
|
77
75
|
},
|
|
78
76
|
"devDependencies": {
|
|
79
|
-
"@backstage/
|
|
80
|
-
"@backstage/
|
|
77
|
+
"@backstage/backend-test-utils": "^0.1.21-next.0",
|
|
78
|
+
"@backstage/cli": "^0.15.2-next.0",
|
|
81
79
|
"@types/command-exists": "^1.2.0",
|
|
82
80
|
"@types/fs-extra": "^9.0.1",
|
|
83
81
|
"@types/git-url-parse": "^9.0.0",
|
|
@@ -99,5 +97,5 @@
|
|
|
99
97
|
"assets"
|
|
100
98
|
],
|
|
101
99
|
"configSchema": "config.d.ts",
|
|
102
|
-
"gitHead": "
|
|
100
|
+
"gitHead": "e90d3ed129ebfce978f1adfa40c1dc2cef3f7e65"
|
|
103
101
|
}
|