@backstage/plugin-scaffolder-backend 1.5.0 → 1.6.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 +34 -0
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +9 -21
- package/dist/index.beta.d.ts +9 -21
- package/dist/index.cjs.js +57 -62
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +9 -21
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder-backend
|
|
2
2
|
|
|
3
|
+
## 1.6.0-next.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ea2eee9e6a: Add the option for a homepage when using the `github:publish` action
|
|
8
|
+
- 8872cc735d: Fixed a bug in plugin-scaffolder-backend where it ignores the skip migration database options.
|
|
9
|
+
|
|
10
|
+
To use this new implementation you need to create the instance of `DatabaseTaskStore` using the `PluginDatabaseManager` instead of `Knex`;
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
import { DatabaseManager, getRootLogger, loadBackendConfig } from '@backstage/backend-common';
|
|
14
|
+
import { DatabaseTaskStore } from '@backstage/plugin-scaffolder-backend';
|
|
15
|
+
|
|
16
|
+
const config = await loadBackendConfig({ argv: process.argv, logger: getRootLogger() });
|
|
17
|
+
const databaseManager = DatabaseManager.fromConfig(config, { migrations: { skip: true } });
|
|
18
|
+
const databaseTaskStore = await DatabaseTaskStore.create(databaseManager);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- 1ff817b3f0: add entity metadata to the template info type
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- bf5e9030eb: Updated dependency `msw` to `^0.45.0`.
|
|
26
|
+
- 2df9955f4a: Removed the depreacated `publish:file` action, use the template editor to test templates instead.
|
|
27
|
+
- ef9ab322de: Minor API signatures cleanup
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @backstage/backend-common@0.15.1-next.0
|
|
30
|
+
- @backstage/plugin-catalog-backend@1.3.2-next.0
|
|
31
|
+
- @backstage/backend-plugin-api@0.1.2-next.0
|
|
32
|
+
- @backstage/catalog-client@1.0.5-next.0
|
|
33
|
+
- @backstage/integration@1.3.1-next.0
|
|
34
|
+
- @backstage/plugin-scaffolder-common@1.2.0-next.0
|
|
35
|
+
- @backstage/plugin-catalog-node@1.0.2-next.0
|
|
36
|
+
|
|
3
37
|
## 1.5.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -264,6 +264,7 @@ export declare function createGithubRepoCreateAction(options: {
|
|
|
264
264
|
}): TemplateAction< {
|
|
265
265
|
repoUrl: string;
|
|
266
266
|
description?: string | undefined;
|
|
267
|
+
homepage?: string | undefined;
|
|
267
268
|
access?: string | undefined;
|
|
268
269
|
deleteBranchOnMerge?: boolean | undefined;
|
|
269
270
|
gitAuthorName?: string | undefined;
|
|
@@ -409,22 +410,6 @@ enableLFS?: boolean | undefined;
|
|
|
409
410
|
token?: string | undefined;
|
|
410
411
|
}>;
|
|
411
412
|
|
|
412
|
-
/**
|
|
413
|
-
* This task is useful for local development and testing of both the scaffolder
|
|
414
|
-
* and scaffolder templates.
|
|
415
|
-
*
|
|
416
|
-
* @remarks
|
|
417
|
-
*
|
|
418
|
-
* This action is not installed by default and should not be installed in
|
|
419
|
-
* production, as it writes the files to the local filesystem of the scaffolder.
|
|
420
|
-
*
|
|
421
|
-
* @public
|
|
422
|
-
* @deprecated This action will be removed, prefer testing templates using the template editor instead.
|
|
423
|
-
*/
|
|
424
|
-
export declare function createPublishFileAction(): TemplateAction< {
|
|
425
|
-
path: string;
|
|
426
|
-
}>;
|
|
427
|
-
|
|
428
413
|
/**
|
|
429
414
|
* Creates a new action that initializes a git repository of the content in the workspace
|
|
430
415
|
* and publishes it to a Gerrit instance.
|
|
@@ -472,6 +457,7 @@ export declare function createPublishGithubAction(options: {
|
|
|
472
457
|
}): TemplateAction< {
|
|
473
458
|
repoUrl: string;
|
|
474
459
|
description?: string | undefined;
|
|
460
|
+
homepage?: string | undefined;
|
|
475
461
|
access?: string | undefined;
|
|
476
462
|
defaultBranch?: string | undefined;
|
|
477
463
|
protectDefaultBranch?: boolean | undefined;
|
|
@@ -619,6 +605,8 @@ export declare interface CurrentClaimedTask {
|
|
|
619
605
|
export declare class DatabaseTaskStore implements TaskStore {
|
|
620
606
|
private readonly db;
|
|
621
607
|
static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
|
|
608
|
+
private static getClient;
|
|
609
|
+
private static runMigrations;
|
|
622
610
|
private constructor();
|
|
623
611
|
list(options: {
|
|
624
612
|
createdBy?: string;
|
|
@@ -629,14 +617,14 @@ export declare class DatabaseTaskStore implements TaskStore {
|
|
|
629
617
|
createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
|
|
630
618
|
claimTask(): Promise<SerializedTask | undefined>;
|
|
631
619
|
heartbeatTask(taskId: string): Promise<void>;
|
|
632
|
-
listStaleTasks(
|
|
620
|
+
listStaleTasks(options: {
|
|
633
621
|
timeoutS: number;
|
|
634
622
|
}): Promise<{
|
|
635
623
|
tasks: {
|
|
636
624
|
taskId: string;
|
|
637
625
|
}[];
|
|
638
626
|
}>;
|
|
639
|
-
completeTask(
|
|
627
|
+
completeTask(options: {
|
|
640
628
|
taskId: string;
|
|
641
629
|
status: TaskStatus;
|
|
642
630
|
eventBody: JsonObject;
|
|
@@ -644,7 +632,7 @@ export declare class DatabaseTaskStore implements TaskStore {
|
|
|
644
632
|
emitLogEvent(options: TaskStoreEmitOptions<{
|
|
645
633
|
message: string;
|
|
646
634
|
} & JsonObject>): Promise<void>;
|
|
647
|
-
listEvents(
|
|
635
|
+
listEvents(options: TaskStoreListEventsOptions): Promise<{
|
|
648
636
|
events: SerializedTaskEvent[];
|
|
649
637
|
}>;
|
|
650
638
|
}
|
|
@@ -655,7 +643,7 @@ export declare class DatabaseTaskStore implements TaskStore {
|
|
|
655
643
|
* @public
|
|
656
644
|
*/
|
|
657
645
|
export declare type DatabaseTaskStoreOptions = {
|
|
658
|
-
database: Knex;
|
|
646
|
+
database: PluginDatabaseManager | Knex;
|
|
659
647
|
};
|
|
660
648
|
|
|
661
649
|
/**
|
|
@@ -671,7 +659,7 @@ export declare const executeShellCommand: (options: RunCommandOptions) => Promis
|
|
|
671
659
|
*
|
|
672
660
|
* @public
|
|
673
661
|
*/
|
|
674
|
-
export declare function fetchContents(
|
|
662
|
+
export declare function fetchContents(options: {
|
|
675
663
|
reader: UrlReader;
|
|
676
664
|
integrations: ScmIntegrations;
|
|
677
665
|
baseUrl?: string;
|
package/dist/index.beta.d.ts
CHANGED
|
@@ -264,6 +264,7 @@ export declare function createGithubRepoCreateAction(options: {
|
|
|
264
264
|
}): TemplateAction< {
|
|
265
265
|
repoUrl: string;
|
|
266
266
|
description?: string | undefined;
|
|
267
|
+
homepage?: string | undefined;
|
|
267
268
|
access?: string | undefined;
|
|
268
269
|
deleteBranchOnMerge?: boolean | undefined;
|
|
269
270
|
gitAuthorName?: string | undefined;
|
|
@@ -409,22 +410,6 @@ enableLFS?: boolean | undefined;
|
|
|
409
410
|
token?: string | undefined;
|
|
410
411
|
}>;
|
|
411
412
|
|
|
412
|
-
/**
|
|
413
|
-
* This task is useful for local development and testing of both the scaffolder
|
|
414
|
-
* and scaffolder templates.
|
|
415
|
-
*
|
|
416
|
-
* @remarks
|
|
417
|
-
*
|
|
418
|
-
* This action is not installed by default and should not be installed in
|
|
419
|
-
* production, as it writes the files to the local filesystem of the scaffolder.
|
|
420
|
-
*
|
|
421
|
-
* @public
|
|
422
|
-
* @deprecated This action will be removed, prefer testing templates using the template editor instead.
|
|
423
|
-
*/
|
|
424
|
-
export declare function createPublishFileAction(): TemplateAction< {
|
|
425
|
-
path: string;
|
|
426
|
-
}>;
|
|
427
|
-
|
|
428
413
|
/**
|
|
429
414
|
* Creates a new action that initializes a git repository of the content in the workspace
|
|
430
415
|
* and publishes it to a Gerrit instance.
|
|
@@ -472,6 +457,7 @@ export declare function createPublishGithubAction(options: {
|
|
|
472
457
|
}): TemplateAction< {
|
|
473
458
|
repoUrl: string;
|
|
474
459
|
description?: string | undefined;
|
|
460
|
+
homepage?: string | undefined;
|
|
475
461
|
access?: string | undefined;
|
|
476
462
|
defaultBranch?: string | undefined;
|
|
477
463
|
protectDefaultBranch?: boolean | undefined;
|
|
@@ -619,6 +605,8 @@ export declare interface CurrentClaimedTask {
|
|
|
619
605
|
export declare class DatabaseTaskStore implements TaskStore {
|
|
620
606
|
private readonly db;
|
|
621
607
|
static create(options: DatabaseTaskStoreOptions): Promise<DatabaseTaskStore>;
|
|
608
|
+
private static getClient;
|
|
609
|
+
private static runMigrations;
|
|
622
610
|
private constructor();
|
|
623
611
|
list(options: {
|
|
624
612
|
createdBy?: string;
|
|
@@ -629,14 +617,14 @@ export declare class DatabaseTaskStore implements TaskStore {
|
|
|
629
617
|
createTask(options: TaskStoreCreateTaskOptions): Promise<TaskStoreCreateTaskResult>;
|
|
630
618
|
claimTask(): Promise<SerializedTask | undefined>;
|
|
631
619
|
heartbeatTask(taskId: string): Promise<void>;
|
|
632
|
-
listStaleTasks(
|
|
620
|
+
listStaleTasks(options: {
|
|
633
621
|
timeoutS: number;
|
|
634
622
|
}): Promise<{
|
|
635
623
|
tasks: {
|
|
636
624
|
taskId: string;
|
|
637
625
|
}[];
|
|
638
626
|
}>;
|
|
639
|
-
completeTask(
|
|
627
|
+
completeTask(options: {
|
|
640
628
|
taskId: string;
|
|
641
629
|
status: TaskStatus;
|
|
642
630
|
eventBody: JsonObject;
|
|
@@ -644,7 +632,7 @@ export declare class DatabaseTaskStore implements TaskStore {
|
|
|
644
632
|
emitLogEvent(options: TaskStoreEmitOptions<{
|
|
645
633
|
message: string;
|
|
646
634
|
} & JsonObject>): Promise<void>;
|
|
647
|
-
listEvents(
|
|
635
|
+
listEvents(options: TaskStoreListEventsOptions): Promise<{
|
|
648
636
|
events: SerializedTaskEvent[];
|
|
649
637
|
}>;
|
|
650
638
|
}
|
|
@@ -655,7 +643,7 @@ export declare class DatabaseTaskStore implements TaskStore {
|
|
|
655
643
|
* @public
|
|
656
644
|
*/
|
|
657
645
|
export declare type DatabaseTaskStoreOptions = {
|
|
658
|
-
database: Knex;
|
|
646
|
+
database: PluginDatabaseManager | Knex;
|
|
659
647
|
};
|
|
660
648
|
|
|
661
649
|
/**
|
|
@@ -671,7 +659,7 @@ export declare const executeShellCommand: (options: RunCommandOptions) => Promis
|
|
|
671
659
|
*
|
|
672
660
|
* @public
|
|
673
661
|
*/
|
|
674
|
-
export declare function fetchContents(
|
|
662
|
+
export declare function fetchContents(options: {
|
|
675
663
|
reader: UrlReader;
|
|
676
664
|
integrations: ScmIntegrations;
|
|
677
665
|
baseUrl?: string;
|
package/dist/index.cjs.js
CHANGED
|
@@ -283,13 +283,8 @@ async function recursiveReadDir(dir) {
|
|
|
283
283
|
return files.reduce((a, f) => a.concat(f), []);
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
async function fetchContents({
|
|
287
|
-
reader,
|
|
288
|
-
integrations,
|
|
289
|
-
baseUrl,
|
|
290
|
-
fetchUrl = ".",
|
|
291
|
-
outputPath
|
|
292
|
-
}) {
|
|
286
|
+
async function fetchContents(options) {
|
|
287
|
+
const { reader, integrations, baseUrl, fetchUrl = ".", outputPath } = options;
|
|
293
288
|
let fetchUrlIsAbsolute = false;
|
|
294
289
|
try {
|
|
295
290
|
new URL(fetchUrl);
|
|
@@ -1043,7 +1038,7 @@ async function getOctokitOptions(options) {
|
|
|
1043
1038
|
previews: ["nebula-preview"]
|
|
1044
1039
|
};
|
|
1045
1040
|
}
|
|
1046
|
-
async function createGithubRepoWithCollaboratorsAndTopics(client, repo, owner, repoVisibility, description, deleteBranchOnMerge, allowMergeCommit, allowSquashMerge, allowRebaseMerge, access, collaborators, topics, logger) {
|
|
1041
|
+
async function createGithubRepoWithCollaboratorsAndTopics(client, repo, owner, repoVisibility, description, homepage, deleteBranchOnMerge, allowMergeCommit, allowSquashMerge, allowRebaseMerge, access, collaborators, topics, logger) {
|
|
1047
1042
|
const user = await client.rest.users.getByUsername({
|
|
1048
1043
|
username: owner
|
|
1049
1044
|
});
|
|
@@ -1056,7 +1051,8 @@ async function createGithubRepoWithCollaboratorsAndTopics(client, repo, owner, r
|
|
|
1056
1051
|
delete_branch_on_merge: deleteBranchOnMerge,
|
|
1057
1052
|
allow_merge_commit: allowMergeCommit,
|
|
1058
1053
|
allow_squash_merge: allowSquashMerge,
|
|
1059
|
-
allow_rebase_merge: allowRebaseMerge
|
|
1054
|
+
allow_rebase_merge: allowRebaseMerge,
|
|
1055
|
+
homepage
|
|
1060
1056
|
}) : client.rest.repos.createForAuthenticatedUser({
|
|
1061
1057
|
name: repo,
|
|
1062
1058
|
private: repoVisibility === "private",
|
|
@@ -1064,7 +1060,8 @@ async function createGithubRepoWithCollaboratorsAndTopics(client, repo, owner, r
|
|
|
1064
1060
|
delete_branch_on_merge: deleteBranchOnMerge,
|
|
1065
1061
|
allow_merge_commit: allowMergeCommit,
|
|
1066
1062
|
allow_squash_merge: allowSquashMerge,
|
|
1067
|
-
allow_rebase_merge: allowRebaseMerge
|
|
1063
|
+
allow_rebase_merge: allowRebaseMerge,
|
|
1064
|
+
homepage
|
|
1068
1065
|
});
|
|
1069
1066
|
let newRepo;
|
|
1070
1067
|
try {
|
|
@@ -1335,6 +1332,10 @@ const description = {
|
|
|
1335
1332
|
title: "Repository Description",
|
|
1336
1333
|
type: "string"
|
|
1337
1334
|
};
|
|
1335
|
+
const homepage = {
|
|
1336
|
+
title: "Repository Homepage",
|
|
1337
|
+
type: "string"
|
|
1338
|
+
};
|
|
1338
1339
|
const access = {
|
|
1339
1340
|
title: "Repository Access",
|
|
1340
1341
|
description: `Sets an admin collaborator on the repository. Can either be a user reference different from 'owner' in 'repoUrl' or team reference, eg. 'org/team-name'`,
|
|
@@ -1473,6 +1474,7 @@ function createGithubRepoCreateAction(options) {
|
|
|
1473
1474
|
properties: {
|
|
1474
1475
|
repoUrl: repoUrl,
|
|
1475
1476
|
description: description,
|
|
1477
|
+
homepage: homepage,
|
|
1476
1478
|
access: access,
|
|
1477
1479
|
requireCodeOwnerReviews: requireCodeOwnerReviews,
|
|
1478
1480
|
requiredStatusCheckContexts: requiredStatusCheckContexts,
|
|
@@ -1498,6 +1500,7 @@ function createGithubRepoCreateAction(options) {
|
|
|
1498
1500
|
const {
|
|
1499
1501
|
repoUrl,
|
|
1500
1502
|
description,
|
|
1503
|
+
homepage,
|
|
1501
1504
|
access,
|
|
1502
1505
|
repoVisibility = "private",
|
|
1503
1506
|
deleteBranchOnMerge = false,
|
|
@@ -1525,6 +1528,7 @@ function createGithubRepoCreateAction(options) {
|
|
|
1525
1528
|
owner,
|
|
1526
1529
|
repoVisibility,
|
|
1527
1530
|
description,
|
|
1531
|
+
homepage,
|
|
1528
1532
|
deleteBranchOnMerge,
|
|
1529
1533
|
allowMergeCommit,
|
|
1530
1534
|
allowSquashMerge,
|
|
@@ -2544,37 +2548,6 @@ function createPublishBitbucketServerAction(options) {
|
|
|
2544
2548
|
});
|
|
2545
2549
|
}
|
|
2546
2550
|
|
|
2547
|
-
function createPublishFileAction() {
|
|
2548
|
-
return createTemplateAction({
|
|
2549
|
-
id: "publish:file",
|
|
2550
|
-
description: "Writes contents of the workspace to a local directory",
|
|
2551
|
-
schema: {
|
|
2552
|
-
input: {
|
|
2553
|
-
type: "object",
|
|
2554
|
-
required: ["path"],
|
|
2555
|
-
properties: {
|
|
2556
|
-
path: {
|
|
2557
|
-
title: "Path to a directory where the output will be written",
|
|
2558
|
-
type: "string"
|
|
2559
|
-
}
|
|
2560
|
-
}
|
|
2561
|
-
}
|
|
2562
|
-
},
|
|
2563
|
-
async handler(ctx) {
|
|
2564
|
-
ctx.logger.warn(
|
|
2565
|
-
"[DEPRECATED] This action will be removed, prefer testing templates using the template editor instead."
|
|
2566
|
-
);
|
|
2567
|
-
const { path: path$1 } = ctx.input;
|
|
2568
|
-
const exists = await fs__default["default"].pathExists(path$1);
|
|
2569
|
-
if (exists) {
|
|
2570
|
-
throw new errors.InputError("Output path already exists");
|
|
2571
|
-
}
|
|
2572
|
-
await fs__default["default"].ensureDir(path.dirname(path$1));
|
|
2573
|
-
await fs__default["default"].copy(ctx.workspacePath, path$1);
|
|
2574
|
-
}
|
|
2575
|
-
});
|
|
2576
|
-
}
|
|
2577
|
-
|
|
2578
2551
|
const createGerritProject = async (config, options) => {
|
|
2579
2552
|
const { projectName, parent, owner, description } = options;
|
|
2580
2553
|
const fetchOptions = {
|
|
@@ -2843,6 +2816,7 @@ function createPublishGithubAction(options) {
|
|
|
2843
2816
|
properties: {
|
|
2844
2817
|
repoUrl: repoUrl,
|
|
2845
2818
|
description: description,
|
|
2819
|
+
homepage: homepage,
|
|
2846
2820
|
access: access,
|
|
2847
2821
|
requireCodeOwnerReviews: requireCodeOwnerReviews,
|
|
2848
2822
|
requiredStatusCheckContexts: requiredStatusCheckContexts,
|
|
@@ -2875,6 +2849,7 @@ function createPublishGithubAction(options) {
|
|
|
2875
2849
|
const {
|
|
2876
2850
|
repoUrl,
|
|
2877
2851
|
description,
|
|
2852
|
+
homepage,
|
|
2878
2853
|
access,
|
|
2879
2854
|
requireCodeOwnerReviews = false,
|
|
2880
2855
|
requiredStatusCheckContexts = [],
|
|
@@ -2910,6 +2885,7 @@ function createPublishGithubAction(options) {
|
|
|
2910
2885
|
owner,
|
|
2911
2886
|
repoVisibility,
|
|
2912
2887
|
description,
|
|
2888
|
+
homepage,
|
|
2913
2889
|
deleteBranchOnMerge,
|
|
2914
2890
|
allowMergeCommit,
|
|
2915
2891
|
allowSquashMerge,
|
|
@@ -3639,6 +3615,9 @@ const migrationsDir = backendCommon.resolvePackagePath(
|
|
|
3639
3615
|
"@backstage/plugin-scaffolder-backend",
|
|
3640
3616
|
"migrations"
|
|
3641
3617
|
);
|
|
3618
|
+
function isPluginDatabaseManager(opt) {
|
|
3619
|
+
return opt.getClient !== void 0;
|
|
3620
|
+
}
|
|
3642
3621
|
const parseSqlDateToIsoString = (input) => {
|
|
3643
3622
|
if (typeof input === "string") {
|
|
3644
3623
|
return luxon.DateTime.fromSQL(input, { zone: "UTC" }).toISO();
|
|
@@ -3647,13 +3626,33 @@ const parseSqlDateToIsoString = (input) => {
|
|
|
3647
3626
|
};
|
|
3648
3627
|
class DatabaseTaskStore {
|
|
3649
3628
|
static async create(options) {
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
return new DatabaseTaskStore(
|
|
3629
|
+
const { database } = options;
|
|
3630
|
+
const client = await this.getClient(database);
|
|
3631
|
+
await this.runMigrations(database, client);
|
|
3632
|
+
return new DatabaseTaskStore(client);
|
|
3654
3633
|
}
|
|
3655
|
-
|
|
3656
|
-
|
|
3634
|
+
static async getClient(database) {
|
|
3635
|
+
if (isPluginDatabaseManager(database)) {
|
|
3636
|
+
return database.getClient();
|
|
3637
|
+
}
|
|
3638
|
+
return database;
|
|
3639
|
+
}
|
|
3640
|
+
static async runMigrations(database, client) {
|
|
3641
|
+
var _a;
|
|
3642
|
+
if (!isPluginDatabaseManager(database)) {
|
|
3643
|
+
await client.migrate.latest({
|
|
3644
|
+
directory: migrationsDir
|
|
3645
|
+
});
|
|
3646
|
+
return;
|
|
3647
|
+
}
|
|
3648
|
+
if (!((_a = database.migrations) == null ? void 0 : _a.skip)) {
|
|
3649
|
+
await client.migrate.latest({
|
|
3650
|
+
directory: migrationsDir
|
|
3651
|
+
});
|
|
3652
|
+
}
|
|
3653
|
+
}
|
|
3654
|
+
constructor(client) {
|
|
3655
|
+
this.db = client;
|
|
3657
3656
|
}
|
|
3658
3657
|
async list(options) {
|
|
3659
3658
|
const queryBuilder = this.db("tasks");
|
|
@@ -3752,7 +3751,8 @@ class DatabaseTaskStore {
|
|
|
3752
3751
|
throw new errors.ConflictError(`No running task with taskId ${taskId} found`);
|
|
3753
3752
|
}
|
|
3754
3753
|
}
|
|
3755
|
-
async listStaleTasks(
|
|
3754
|
+
async listStaleTasks(options) {
|
|
3755
|
+
const { timeoutS } = options;
|
|
3756
3756
|
const rawRows = await this.db("tasks").where("status", "processing").andWhere(
|
|
3757
3757
|
"last_heartbeat_at",
|
|
3758
3758
|
"<=",
|
|
@@ -3766,11 +3766,8 @@ class DatabaseTaskStore {
|
|
|
3766
3766
|
}));
|
|
3767
3767
|
return { tasks };
|
|
3768
3768
|
}
|
|
3769
|
-
async completeTask({
|
|
3770
|
-
taskId,
|
|
3771
|
-
status,
|
|
3772
|
-
eventBody
|
|
3773
|
-
}) {
|
|
3769
|
+
async completeTask(options) {
|
|
3770
|
+
const { taskId, status, eventBody } = options;
|
|
3774
3771
|
let oldStatus;
|
|
3775
3772
|
if (status === "failed" || status === "completed") {
|
|
3776
3773
|
oldStatus = "processing";
|
|
@@ -3818,10 +3815,8 @@ class DatabaseTaskStore {
|
|
|
3818
3815
|
body: serializedBody
|
|
3819
3816
|
});
|
|
3820
3817
|
}
|
|
3821
|
-
async listEvents({
|
|
3822
|
-
taskId,
|
|
3823
|
-
after
|
|
3824
|
-
}) {
|
|
3818
|
+
async listEvents(options) {
|
|
3819
|
+
const { taskId, after } = options;
|
|
3825
3820
|
const rawEvents = await this.db("task_events").where({
|
|
3826
3821
|
task_id: taskId
|
|
3827
3822
|
}).andWhere((builder) => {
|
|
@@ -4468,9 +4463,7 @@ async function createRouter(options) {
|
|
|
4468
4463
|
const integrations = integration.ScmIntegrations.fromConfig(config);
|
|
4469
4464
|
let taskBroker;
|
|
4470
4465
|
if (!options.taskBroker) {
|
|
4471
|
-
const databaseTaskStore = await DatabaseTaskStore.create({
|
|
4472
|
-
database: await database.getClient()
|
|
4473
|
-
});
|
|
4466
|
+
const databaseTaskStore = await DatabaseTaskStore.create({ database });
|
|
4474
4467
|
taskBroker = new StorageTaskBroker(databaseTaskStore, logger);
|
|
4475
4468
|
} else {
|
|
4476
4469
|
taskBroker = options.taskBroker;
|
|
@@ -4604,7 +4597,10 @@ async function createRouter(options) {
|
|
|
4604
4597
|
namespace,
|
|
4605
4598
|
name: (_c = template.metadata) == null ? void 0 : _c.name
|
|
4606
4599
|
}),
|
|
4607
|
-
baseUrl
|
|
4600
|
+
baseUrl,
|
|
4601
|
+
entity: {
|
|
4602
|
+
metadata: template.metadata
|
|
4603
|
+
}
|
|
4608
4604
|
}
|
|
4609
4605
|
};
|
|
4610
4606
|
const result = await taskBroker.dispatch({
|
|
@@ -4890,7 +4886,6 @@ exports.createPublishAzureAction = createPublishAzureAction;
|
|
|
4890
4886
|
exports.createPublishBitbucketAction = createPublishBitbucketAction;
|
|
4891
4887
|
exports.createPublishBitbucketCloudAction = createPublishBitbucketCloudAction;
|
|
4892
4888
|
exports.createPublishBitbucketServerAction = createPublishBitbucketServerAction;
|
|
4893
|
-
exports.createPublishFileAction = createPublishFileAction;
|
|
4894
4889
|
exports.createPublishGerritAction = createPublishGerritAction;
|
|
4895
4890
|
exports.createPublishGerritReviewAction = createPublishGerritReviewAction;
|
|
4896
4891
|
exports.createPublishGithubAction = createPublishGithubAction;
|