@backstage/plugin-scaffolder-backend 0.0.0-nightly-20220713025014 → 0.0.0-nightly-20220716024822

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @backstage/plugin-scaffolder-backend
2
2
 
3
- ## 0.0.0-nightly-20220713025014
3
+ ## 0.0.0-nightly-20220716024822
4
4
 
5
5
  ### Minor Changes
6
6
 
@@ -10,7 +10,12 @@
10
10
 
11
11
  ### Patch Changes
12
12
 
13
+ - ff316b86d8: Add `copyWithoutTemplating` to the fetch template action input. `copyWithoutTemplating` also accepts an array of glob patterns. Contents of matched files or directories are copied without being processed, but paths are subject to rendering.
14
+
15
+ Deprecate `copyWithoutRender` in favor of `copyWithoutTemplating`.
16
+
13
17
  - 801d606909: Improve error messaging when passing in malformed auth
18
+ - 089d846962: Fix issues with optional directories and files
14
19
  - ea6dcb84a4: Don't resolve symlinks, treat them as binary files and copy them as-is
15
20
  - af02f54483: new setUserAsOwner flag for publish:gitlab action
16
21
 
@@ -19,6 +24,7 @@
19
24
  - a70869e775: Updated dependency `msw` to `^0.43.0`.
20
25
  - 4e9a90e307: Updated dependency `luxon` to `^3.0.0`.
21
26
  - 72622d9143: Updated dependency `yaml` to `^2.0.0`.
27
+ - 8006d0f9bf: Updated dependency `msw` to `^0.44.0`.
22
28
  - 679b32172e: Updated dependency `knex` to `^2.0.0`.
23
29
  - 511f49ee43: Updated dependency `octokit` to `^2.0.0`.
24
30
  - 735853353b: Updated dependency `@octokit/webhooks` to `^10.0.0`.
@@ -31,16 +37,18 @@
31
37
  - SNYK-JS-PARSEURL-2935947
32
38
  - SNYK-JS-PARSEURL-2936249
33
39
 
40
+ - 945a27fa6a: Add sourcePath option to publish:gerrit action
41
+ - 1764296a68: Allow to create Gerrit project using default owner
34
42
  - Updated dependencies
35
- - @backstage/backend-plugin-api@0.0.0-nightly-20220713025014
36
- - @backstage/plugin-catalog-backend@0.0.0-nightly-20220713025014
37
- - @backstage/backend-common@0.0.0-nightly-20220713025014
38
- - @backstage/catalog-model@0.0.0-nightly-20220713025014
39
- - @backstage/plugin-catalog-node@0.0.0-nightly-20220713025014
40
- - @backstage/catalog-client@0.0.0-nightly-20220713025014
41
- - @backstage/integration@0.0.0-nightly-20220713025014
42
- - @backstage/errors@0.0.0-nightly-20220713025014
43
- - @backstage/plugin-scaffolder-common@0.0.0-nightly-20220713025014
43
+ - @backstage/backend-plugin-api@0.0.0-nightly-20220716024822
44
+ - @backstage/plugin-catalog-backend@0.0.0-nightly-20220716024822
45
+ - @backstage/backend-common@0.0.0-nightly-20220716024822
46
+ - @backstage/catalog-model@0.0.0-nightly-20220716024822
47
+ - @backstage/plugin-catalog-node@0.0.0-nightly-20220716024822
48
+ - @backstage/integration@0.0.0-nightly-20220716024822
49
+ - @backstage/catalog-client@0.0.0-nightly-20220716024822
50
+ - @backstage/errors@0.0.0-nightly-20220716024822
51
+ - @backstage/plugin-scaffolder-common@0.0.0-nightly-20220716024822
44
52
 
45
53
  ## 1.4.0-next.3
46
54
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-backend",
3
- "version": "0.0.0-nightly-20220713025014",
3
+ "version": "0.0.0-nightly-20220716024822",
4
4
  "main": "../dist/index.cjs.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -161,7 +161,11 @@ url: string;
161
161
  targetPath?: string | undefined;
162
162
  values: any;
163
163
  templateFileExtension?: string | boolean | undefined;
164
+ /**
165
+ * @deprecated This field is deprecated in favor of copyWithoutTemplating.
166
+ */
164
167
  copyWithoutRender?: string[] | undefined;
168
+ copyWithoutTemplating?: string[] | undefined;
165
169
  cookiecutterCompat?: boolean | undefined;
166
170
  }>;
167
171
 
@@ -268,7 +272,7 @@ allowSquashMerge?: boolean | undefined;
268
272
  allowMergeCommit?: boolean | undefined;
269
273
  requireCodeOwnerReviews?: boolean | undefined;
270
274
  requiredStatusCheckContexts?: string[] | undefined;
271
- repoVisibility?: "private" | "public" | "internal" | undefined;
275
+ repoVisibility?: "public" | "private" | "internal" | undefined;
272
276
  collaborators?: ({
273
277
  user: string;
274
278
  access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
@@ -359,7 +363,7 @@ export declare function createPublishBitbucketAction(options: {
359
363
  repoUrl: string;
360
364
  description?: string | undefined;
361
365
  defaultBranch?: string | undefined;
362
- repoVisibility?: "private" | "public" | undefined;
366
+ repoVisibility?: "public" | "private" | undefined;
363
367
  sourcePath?: string | undefined;
364
368
  enableLFS?: boolean | undefined;
365
369
  token?: string | undefined;
@@ -380,7 +384,7 @@ export declare function createPublishBitbucketCloudAction(options: {
380
384
  repoUrl: string;
381
385
  description?: string | undefined;
382
386
  defaultBranch?: string | undefined;
383
- repoVisibility?: "private" | "public" | undefined;
387
+ repoVisibility?: "public" | "private" | undefined;
384
388
  sourcePath?: string | undefined;
385
389
  token?: string | undefined;
386
390
  }>;
@@ -397,7 +401,7 @@ export declare function createPublishBitbucketServerAction(options: {
397
401
  repoUrl: string;
398
402
  description?: string | undefined;
399
403
  defaultBranch?: string | undefined;
400
- repoVisibility?: "private" | "public" | undefined;
404
+ repoVisibility?: "public" | "private" | undefined;
401
405
  sourcePath?: string | undefined;
402
406
  enableLFS?: boolean | undefined;
403
407
  token?: string | undefined;
@@ -433,6 +437,7 @@ defaultBranch?: string | undefined;
433
437
  gitCommitMessage?: string | undefined;
434
438
  gitAuthorName?: string | undefined;
435
439
  gitAuthorEmail?: string | undefined;
440
+ sourcePath?: string | undefined;
436
441
  }>;
437
442
 
438
443
  /**
@@ -461,7 +466,7 @@ allowMergeCommit?: boolean | undefined;
461
466
  sourcePath?: string | undefined;
462
467
  requireCodeOwnerReviews?: boolean | undefined;
463
468
  requiredStatusCheckContexts?: string[] | undefined;
464
- repoVisibility?: "private" | "public" | "internal" | undefined;
469
+ repoVisibility?: "public" | "private" | "internal" | undefined;
465
470
  collaborators?: ({
466
471
  user: string;
467
472
  access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
@@ -504,7 +509,7 @@ export declare function createPublishGitlabAction(options: {
504
509
  }): TemplateAction< {
505
510
  repoUrl: string;
506
511
  defaultBranch?: string | undefined;
507
- repoVisibility?: "private" | "public" | "internal" | undefined;
512
+ repoVisibility?: "public" | "private" | "internal" | undefined;
508
513
  sourcePath?: string | undefined;
509
514
  token?: string | undefined;
510
515
  gitCommitMessage?: string | undefined;
@@ -161,7 +161,11 @@ url: string;
161
161
  targetPath?: string | undefined;
162
162
  values: any;
163
163
  templateFileExtension?: string | boolean | undefined;
164
+ /**
165
+ * @deprecated This field is deprecated in favor of copyWithoutTemplating.
166
+ */
164
167
  copyWithoutRender?: string[] | undefined;
168
+ copyWithoutTemplating?: string[] | undefined;
165
169
  cookiecutterCompat?: boolean | undefined;
166
170
  }>;
167
171
 
@@ -268,7 +272,7 @@ allowSquashMerge?: boolean | undefined;
268
272
  allowMergeCommit?: boolean | undefined;
269
273
  requireCodeOwnerReviews?: boolean | undefined;
270
274
  requiredStatusCheckContexts?: string[] | undefined;
271
- repoVisibility?: "private" | "public" | "internal" | undefined;
275
+ repoVisibility?: "public" | "private" | "internal" | undefined;
272
276
  collaborators?: ({
273
277
  user: string;
274
278
  access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
@@ -359,7 +363,7 @@ export declare function createPublishBitbucketAction(options: {
359
363
  repoUrl: string;
360
364
  description?: string | undefined;
361
365
  defaultBranch?: string | undefined;
362
- repoVisibility?: "private" | "public" | undefined;
366
+ repoVisibility?: "public" | "private" | undefined;
363
367
  sourcePath?: string | undefined;
364
368
  enableLFS?: boolean | undefined;
365
369
  token?: string | undefined;
@@ -380,7 +384,7 @@ export declare function createPublishBitbucketCloudAction(options: {
380
384
  repoUrl: string;
381
385
  description?: string | undefined;
382
386
  defaultBranch?: string | undefined;
383
- repoVisibility?: "private" | "public" | undefined;
387
+ repoVisibility?: "public" | "private" | undefined;
384
388
  sourcePath?: string | undefined;
385
389
  token?: string | undefined;
386
390
  }>;
@@ -397,7 +401,7 @@ export declare function createPublishBitbucketServerAction(options: {
397
401
  repoUrl: string;
398
402
  description?: string | undefined;
399
403
  defaultBranch?: string | undefined;
400
- repoVisibility?: "private" | "public" | undefined;
404
+ repoVisibility?: "public" | "private" | undefined;
401
405
  sourcePath?: string | undefined;
402
406
  enableLFS?: boolean | undefined;
403
407
  token?: string | undefined;
@@ -433,6 +437,7 @@ defaultBranch?: string | undefined;
433
437
  gitCommitMessage?: string | undefined;
434
438
  gitAuthorName?: string | undefined;
435
439
  gitAuthorEmail?: string | undefined;
440
+ sourcePath?: string | undefined;
436
441
  }>;
437
442
 
438
443
  /**
@@ -461,7 +466,7 @@ allowMergeCommit?: boolean | undefined;
461
466
  sourcePath?: string | undefined;
462
467
  requireCodeOwnerReviews?: boolean | undefined;
463
468
  requiredStatusCheckContexts?: string[] | undefined;
464
- repoVisibility?: "private" | "public" | "internal" | undefined;
469
+ repoVisibility?: "public" | "private" | "internal" | undefined;
465
470
  collaborators?: ({
466
471
  user: string;
467
472
  access: 'pull' | 'push' | 'admin' | 'maintain' | 'triage';
@@ -504,7 +509,7 @@ export declare function createPublishGitlabAction(options: {
504
509
  }): TemplateAction< {
505
510
  repoUrl: string;
506
511
  defaultBranch?: string | undefined;
507
- repoVisibility?: "private" | "public" | "internal" | undefined;
512
+ repoVisibility?: "public" | "private" | "internal" | undefined;
508
513
  sourcePath?: string | undefined;
509
514
  token?: string | undefined;
510
515
  gitCommitMessage?: string | undefined;
package/dist/index.cjs.js CHANGED
@@ -473,13 +473,21 @@ function createFetchTemplateAction(options) {
473
473
  type: "object"
474
474
  },
475
475
  copyWithoutRender: {
476
- title: "Copy Without Render",
476
+ title: "[Deprecated] Copy Without Render",
477
477
  description: "An array of glob patterns. Any files or directories which match are copied without being processed as templates.",
478
478
  type: "array",
479
479
  items: {
480
480
  type: "string"
481
481
  }
482
482
  },
483
+ copyWithoutTemplating: {
484
+ title: "Copy Without Templating",
485
+ description: "An array of glob patterns. Contents of matched files or directories are copied without being processed, but paths are subject to rendering.",
486
+ type: "array",
487
+ items: {
488
+ type: "string"
489
+ }
490
+ },
483
491
  cookiecutterCompat: {
484
492
  title: "Cookiecutter compatibility mode",
485
493
  description: "Enable features to maximise compatibility with templates built for fetch:cookiecutter",
@@ -501,11 +509,24 @@ function createFetchTemplateAction(options) {
501
509
  const templateDir = backendCommon.resolveSafeChildPath(workDir, "template");
502
510
  const targetPath = (_a = ctx.input.targetPath) != null ? _a : "./";
503
511
  const outputDir = backendCommon.resolveSafeChildPath(ctx.workspacePath, targetPath);
504
- if (ctx.input.copyWithoutRender && !Array.isArray(ctx.input.copyWithoutRender)) {
505
- throw new errors.InputError("Fetch action input copyWithoutRender must be an Array");
512
+ if (ctx.input.copyWithoutRender && ctx.input.copyWithoutTemplating) {
513
+ throw new errors.InputError("Fetch action input copyWithoutRender and copyWithoutTemplating can not be used at the same time");
506
514
  }
507
- if (ctx.input.templateFileExtension && (ctx.input.copyWithoutRender || ctx.input.cookiecutterCompat)) {
508
- throw new errors.InputError("Fetch action input extension incompatible with copyWithoutRender and cookiecutterCompat");
515
+ let copyOnlyPatterns;
516
+ let renderFilename;
517
+ if (ctx.input.copyWithoutRender) {
518
+ ctx.logger.warn("[Deprecated] Please use copyWithoutTemplating instead.");
519
+ copyOnlyPatterns = ctx.input.copyWithoutRender;
520
+ renderFilename = false;
521
+ } else {
522
+ copyOnlyPatterns = ctx.input.copyWithoutTemplating;
523
+ renderFilename = true;
524
+ }
525
+ if (copyOnlyPatterns && !Array.isArray(copyOnlyPatterns)) {
526
+ throw new errors.InputError("Fetch action input copyWithoutRender/copyWithoutTemplating must be an Array");
527
+ }
528
+ if (ctx.input.templateFileExtension && (copyOnlyPatterns || ctx.input.cookiecutterCompat)) {
529
+ throw new errors.InputError("Fetch action input extension incompatible with copyWithoutRender/copyWithoutTemplating and cookiecutterCompat");
509
530
  }
510
531
  let extension = false;
511
532
  if (ctx.input.templateFileExtension) {
@@ -529,7 +550,7 @@ function createFetchTemplateAction(options) {
529
550
  markDirectories: true,
530
551
  followSymbolicLinks: false
531
552
  });
532
- const nonTemplatedEntries = new Set((await Promise.all((ctx.input.copyWithoutRender || []).map((pattern) => globby__default["default"](pattern, {
553
+ const nonTemplatedEntries = new Set((await Promise.all((copyOnlyPatterns || []).map((pattern) => globby__default["default"](pattern, {
533
554
  cwd: templateDir,
534
555
  dot: true,
535
556
  onlyFiles: false,
@@ -546,23 +567,27 @@ function createFetchTemplateAction(options) {
546
567
  additionalTemplateFilters
547
568
  });
548
569
  for (const location of allEntriesInTemplate) {
549
- let renderFilename;
550
570
  let renderContents;
551
571
  let localOutputPath = location;
552
572
  if (extension) {
553
- renderFilename = true;
554
573
  renderContents = path.extname(localOutputPath) === extension;
555
574
  if (renderContents) {
556
575
  localOutputPath = localOutputPath.slice(0, -extension.length);
557
576
  }
577
+ localOutputPath = renderTemplate(localOutputPath, context);
558
578
  } else {
559
- renderFilename = renderContents = !nonTemplatedEntries.has(location);
579
+ renderContents = !nonTemplatedEntries.has(location);
580
+ if (renderFilename) {
581
+ localOutputPath = renderTemplate(localOutputPath, context);
582
+ } else {
583
+ localOutputPath = renderContents ? renderTemplate(localOutputPath, context) : localOutputPath;
584
+ }
560
585
  }
561
- if (renderFilename) {
562
- localOutputPath = renderTemplate(localOutputPath, context);
586
+ if (containsSkippedContent(localOutputPath)) {
587
+ continue;
563
588
  }
564
589
  const outputPath = backendCommon.resolveSafeChildPath(outputDir, localOutputPath);
565
- if (outputDir === outputPath) {
590
+ if (fs__default["default"].existsSync(outputPath)) {
566
591
  continue;
567
592
  }
568
593
  if (!renderContents && !extension) {
@@ -589,6 +614,9 @@ function createFetchTemplateAction(options) {
589
614
  }
590
615
  });
591
616
  }
617
+ function containsSkippedContent(localOutputPath) {
618
+ return localOutputPath === "" || path__default["default"].isAbsolute(localOutputPath) || localOutputPath.includes(`${path__default["default"].sep}${path__default["default"].sep}`);
619
+ }
592
620
 
593
621
  const createFilesystemDeleteAction = () => {
594
622
  return createTemplateAction({
@@ -729,7 +757,7 @@ const parseRepoUrl = (repoUrl, integrations) => {
729
757
  throw new errors.InputError(`Invalid repo URL passed to publisher: ${repoUrl}, missing project`);
730
758
  }
731
759
  } else {
732
- if (!owner) {
760
+ if (!owner && type !== "gerrit") {
733
761
  throw new errors.InputError(`Invalid repo URL passed to publisher: ${repoUrl}, missing owner`);
734
762
  }
735
763
  }
@@ -2282,7 +2310,7 @@ const createGerritProject = async (config, options) => {
2282
2310
  body: JSON.stringify({
2283
2311
  parent,
2284
2312
  description,
2285
- owners: [owner],
2313
+ owners: owner ? [owner] : [],
2286
2314
  create_empty_commit: false
2287
2315
  }),
2288
2316
  headers: {
@@ -2339,6 +2367,11 @@ function createPublishGerritAction(options) {
2339
2367
  title: "Default Author Email",
2340
2368
  type: "string",
2341
2369
  description: `Sets the default author email for the commit.`
2370
+ },
2371
+ sourcePath: {
2372
+ title: "Source Path",
2373
+ type: "string",
2374
+ description: `Path within the workspace that will be used as the repository root. If omitted, the entire workspace will be published as the repository.`
2342
2375
  }
2343
2376
  }
2344
2377
  },
@@ -2363,16 +2396,14 @@ function createPublishGerritAction(options) {
2363
2396
  defaultBranch = "master",
2364
2397
  gitAuthorName,
2365
2398
  gitAuthorEmail,
2366
- gitCommitMessage = "initial commit"
2399
+ gitCommitMessage = "initial commit",
2400
+ sourcePath
2367
2401
  } = ctx.input;
2368
2402
  const { repo, host, owner, workspace } = parseRepoUrl(repoUrl, integrations);
2369
2403
  const integrationConfig = integrations.gerrit.byHost(host);
2370
2404
  if (!integrationConfig) {
2371
2405
  throw new errors.InputError(`No matching integration configuration for host ${host}, please check your integrations config`);
2372
2406
  }
2373
- if (!owner) {
2374
- throw new errors.InputError(`Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing owner`);
2375
- }
2376
2407
  if (!workspace) {
2377
2408
  throw new errors.InputError(`Invalid URL provider was included in the repo URL to create ${ctx.input.repoUrl}, missing workspace`);
2378
2409
  }
@@ -2392,7 +2423,7 @@ function createPublishGerritAction(options) {
2392
2423
  };
2393
2424
  const remoteUrl = `${integrationConfig.config.cloneUrl}/a/${repo}`;
2394
2425
  await initRepoAndPush({
2395
- dir: getRepoSourceDirectory(ctx.workspacePath, void 0),
2426
+ dir: getRepoSourceDirectory(ctx.workspacePath, sourcePath),
2396
2427
  remoteUrl,
2397
2428
  auth,
2398
2429
  defaultBranch,