@intentius/chant-lexicon-pulumi 0.124.55 → 0.124.57

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.
Files changed (65) hide show
  1. package/README.md +1 -1
  2. package/dist/changed-units.d.ts +5 -0
  3. package/dist/changed-units.d.ts.map +1 -0
  4. package/dist/changed-units.js +101 -0
  5. package/dist/check-step.d.ts +61 -0
  6. package/dist/check-step.d.ts.map +1 -0
  7. package/dist/check-step.js +270 -0
  8. package/dist/composites/pulumi-adopt-op.d.ts.map +1 -1
  9. package/dist/composites/pulumi-adopt-op.js +4 -2
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +2 -0
  13. package/dist/integrity.json +2 -2
  14. package/dist/manifest.json +1 -1
  15. package/dist/member-outputs.d.ts +10 -3
  16. package/dist/member-outputs.d.ts.map +1 -1
  17. package/dist/member-outputs.js +11 -3
  18. package/dist/op/activities/pulumi-adopt.d.ts +5 -0
  19. package/dist/op/activities/pulumi-adopt.d.ts.map +1 -1
  20. package/dist/op/activities/pulumi-adopt.js +7 -2
  21. package/dist/op/activity-contracts.d.ts +2 -0
  22. package/dist/op/activity-contracts.d.ts.map +1 -1
  23. package/dist/op/activity-contracts.js +2 -2
  24. package/dist/planned-output-changes.d.ts +60 -0
  25. package/dist/planned-output-changes.d.ts.map +1 -0
  26. package/dist/planned-output-changes.js +94 -0
  27. package/dist/plugin.d.ts.map +1 -1
  28. package/dist/plugin.js +24 -0
  29. package/dist/preview-tips.d.ts +71 -0
  30. package/dist/preview-tips.d.ts.map +1 -0
  31. package/dist/preview-tips.js +76 -0
  32. package/dist/pulumi-up.d.ts +24 -1
  33. package/dist/pulumi-up.d.ts.map +1 -1
  34. package/dist/pulumi-up.js +64 -16
  35. package/dist/release-copy.d.ts +42 -2
  36. package/dist/release-copy.d.ts.map +1 -1
  37. package/dist/release-copy.js +96 -22
  38. package/dist/run.d.ts +27 -8
  39. package/dist/run.d.ts.map +1 -1
  40. package/dist/run.js +55 -14
  41. package/package.json +2 -2
  42. package/src/changed-units.test.ts +87 -0
  43. package/src/changed-units.ts +96 -0
  44. package/src/check-step.test.ts +191 -0
  45. package/src/check-step.ts +316 -0
  46. package/src/composites/pulumi-adopt-op.test.ts +35 -0
  47. package/src/composites/pulumi-adopt-op.ts +4 -2
  48. package/src/index.ts +2 -0
  49. package/src/member-outputs.test.ts +28 -6
  50. package/src/member-outputs.ts +22 -4
  51. package/src/op/activities/pulumi-adopt.ts +13 -2
  52. package/src/op/activity-contracts.ts +2 -2
  53. package/src/planned-output-changes.test.ts +85 -0
  54. package/src/planned-output-changes.ts +141 -0
  55. package/src/plugin.ts +26 -0
  56. package/src/preview-tips.test.ts +135 -0
  57. package/src/preview-tips.ts +128 -0
  58. package/src/pulumi-up.test.ts +100 -0
  59. package/src/pulumi-up.ts +84 -18
  60. package/src/release-copy.test.ts +90 -2
  61. package/src/release-copy.ts +103 -22
  62. package/src/run-plan-flags.test.ts +53 -0
  63. package/src/run.test.ts +1 -1
  64. package/src/run.ts +57 -14
  65. package/src/stack-export-snapshot.test.ts +3 -1
package/src/run.ts CHANGED
@@ -28,6 +28,12 @@
28
28
  * - for a review stack alone (`pr-<n>`, INTENTIUS/plywood#15), `stack
29
29
  * init`, `destroy --yes` and `stack rm --yes`, through
30
30
  * {@link runReviewStackPulumi} and {@link runReviewStackPlunge} only;
31
+ * - for the check stage (#4633, `./check-step.ts`), `pulumi install` and
32
+ * `pulumi about --json [--stack <stack>]`, or the same under `plunge`,
33
+ * through {@link runCheckPulumi} alone. The install fetches the program's
34
+ * dependencies and plugins; `about` reads the engine, plugins and backend.
35
+ * Neither writes a stack, and both run with no forge token or cloud
36
+ * credential in their environment;
31
37
  * - for a member on plunge, its engine graph (#4529, ruled on #4520), as
32
38
  * exactly one of `plunge graph --json`, `plunge graph --json --stack
33
39
  * <stack>`, `plunge graph --json --versions` and `plunge graph --json
@@ -294,14 +300,17 @@ export function engineRunnerAt(bin: string): PulumiRunner {
294
300
  * that is not empty and does not start with `-`; `[…]` is optional; `…`
295
301
  * repeats.
296
302
  *
297
- * `up` is refused with `--skip-preview`, `--refresh`, `--show-secrets`,
298
- * `--replace`, `--target-replace`, `--target-dependents`, `--exclude`,
299
- * `--remote`, `--continue-on-error`, `--config` and any flag not here, since
300
- * none of them is in the list.
303
+ * `up` is refused with `--skip-preview`, `--show-secrets`, `--replace`,
304
+ * `--target-replace`, `--exclude`, `--remote`, `--continue-on-error`,
305
+ * `--config` and any flag not here, since none of them is in the list.
306
+ * `--refresh` and `--target-dependents` (#4627) come in the tail's order,
307
+ * `--target-dependents` only after a `--target`. plunge's `up --plan`
308
+ * applies a saved plan whose preview did the refresh, so it takes no
309
+ * `--refresh`.
301
310
  */
302
311
  export const PULUMI_APPLY_COMMANDS: readonly string[] = [
303
- "plunge up --plan <file> --yes --json --stack <stack> [--config-file <file>] [--target <urn>]... [--policy-pack <dir> [--policy-pack-config <file>]]...",
304
- "pulumi up --yes --json --stack <stack> [--config-file <file>] [--target <urn>]... [--policy-pack <dir> [--policy-pack-config <file>]]...",
312
+ "plunge up --plan <file> --yes --json --stack <stack> [--config-file <file>] [--target <urn>... [--target-dependents]] [--policy-pack <dir> [--policy-pack-config <file>]]...",
313
+ "pulumi up --yes --json --stack <stack> [--config-file <file>] [--refresh] [--target <urn>... [--target-dependents]] [--policy-pack <dir> [--policy-pack-config <file>]]...",
305
314
  ];
306
315
 
307
316
  /** A CrossGuard pack the preview and `up` run (ruling 7: in the preview job, feeding chant's gate). */
@@ -317,13 +326,20 @@ export interface PulumiApplyTail {
317
326
  /** A scratch copy of the stack's config file, passed as `--config-file` (#4541): never `--config`, which writes the working tree's file. */
318
327
  configFile?: string;
319
328
  targets?: readonly string[];
329
+ /** `--refresh` (#4627): refresh the stack's state before the preview or `pulumi up`. */
330
+ refresh?: boolean;
331
+ /** `--target-dependents` (#4627): with `targets`, their dependents too. */
332
+ targetDependents?: boolean;
320
333
  policyPacks?: readonly PulumiPolicyPack[];
321
334
  }
322
335
 
323
336
  function tailArgs(t: PulumiApplyTail): string[] {
337
+ const targets = t.targets ?? [];
324
338
  return [
325
339
  ...(t.configFile ? ["--config-file", t.configFile] : []),
326
- ...(t.targets ?? []).flatMap((u) => ["--target", u]),
340
+ ...(t.refresh ? ["--refresh"] : []),
341
+ ...targets.flatMap((u) => ["--target", u]),
342
+ ...(t.targetDependents && targets.length > 0 ? ["--target-dependents"] : []),
327
343
  ...(t.policyPacks ?? []).flatMap((p) => ["--policy-pack", p.dir, ...(p.config ? ["--policy-pack-config", p.config] : [])]),
328
344
  ];
329
345
  }
@@ -350,17 +366,21 @@ export function pulumiUpArgs(opts: { stack: string } & PulumiApplyTail): string[
350
366
 
351
367
  const isValue = (v: string | undefined): v is string => typeof v === "string" && v.length > 0 && !v.startsWith("-");
352
368
 
353
- /** Whether `rest` is exactly an apply tail, in its order. */
354
- function wellFormedTail(rest: string[]): boolean {
369
+ /** Whether `rest` is exactly an apply tail, in its order; `refresh` says whether `--refresh` may stand in it (#4627). */
370
+ function wellFormedTail(rest: string[], refresh = true): boolean {
355
371
  let i = 0;
356
372
  if (rest[i] === "--config-file") {
357
373
  if (!isValue(rest[i + 1])) return false;
358
374
  i += 2;
359
375
  }
376
+ if (refresh && rest[i] === "--refresh") i += 1;
377
+ let targets = 0;
360
378
  while (rest[i] === "--target") {
361
379
  if (!isValue(rest[i + 1])) return false;
362
380
  i += 2;
381
+ targets++;
363
382
  }
383
+ if (targets > 0 && rest[i] === "--target-dependents") i += 1;
364
384
  while (rest[i] === "--policy-pack") {
365
385
  if (!isValue(rest[i + 1])) return false;
366
386
  i += 2;
@@ -382,7 +402,7 @@ function allowedPlungeUp(args: string[]): boolean {
382
402
  args[4] === "--json" &&
383
403
  args[5] === "--stack" &&
384
404
  isValue(args[6]) &&
385
- wellFormedTail(args.slice(7))
405
+ wellFormedTail(args.slice(7), false)
386
406
  );
387
407
  }
388
408
 
@@ -624,11 +644,11 @@ export async function runReviewStackPlunge(run: PulumiRunner, args: string[], cw
624
644
  }
625
645
 
626
646
  /**
627
- * The install chant runs in a release's recorded copy of a program (#4542),
647
+ * The install chant runs in a program's directory before its first engine
648
+ * run, a release's recorded copy (#4542) or a job's checkout (plywood#22),
628
649
  * for `./release-copy.ts` alone: exactly `pulumi install` or `plunge
629
- * install`, no flag. The cut records tracked files only, so the copy has no
630
- * `node_modules` or virtualenv; the CLI's install follows `Pulumi.yaml`'s
631
- * runtime options and the recorded lockfile.
650
+ * install`, no flag. Neither has `node_modules` or a virtualenv; the CLI's
651
+ * install follows `Pulumi.yaml`'s runtime options and the lockfile.
632
652
  */
633
653
  export const PULUMI_INSTALL_COMMANDS: readonly string[] = ["pulumi install", "plunge install"];
634
654
 
@@ -640,6 +660,29 @@ export async function runReleaseInstall(run: PulumiRunner, args: string[], cwd:
640
660
  return run(args, env ? { cwd, env } : { cwd });
641
661
  }
642
662
 
663
+ /**
664
+ * The two argv the check stage runs for a member (#4633, `./check-step.ts`):
665
+ * `install` with no flag, and `about --json`, optionally with `--stack
666
+ * <stack>`. Under `pulumi` or `plunge`; the runner picks the binary.
667
+ */
668
+ export const PULUMI_CHECK_COMMANDS: readonly string[] = ["pulumi install", "pulumi about --json [--stack <stack>]", "plunge install", "plunge about --json [--stack <stack>]"];
669
+
670
+ /** Whether `args` is one of {@link PULUMI_CHECK_COMMANDS}' argv. */
671
+ export function allowedCheck(args: readonly string[]): boolean {
672
+ if (args.length === 1) return args[0] === "install";
673
+ if (args[0] !== "about" || args[1] !== "--json") return false;
674
+ if (args.length === 2) return true;
675
+ return args.length === 4 && args[2] === "--stack" && isValue(args[3]);
676
+ }
677
+
678
+ /** Run a check-stage argv, refusing any other. The runner picks the binary. */
679
+ export async function runCheckPulumi(run: PulumiRunner, args: string[], cwd: string, env?: Record<string, string>): Promise<{ stdout: string }> {
680
+ if (!allowedCheck(args)) {
681
+ throw new Error(`the check stage runs only ${PULUMI_CHECK_COMMANDS.join(", ")} for a Pulumi member, not ${args.join(" ")}`);
682
+ }
683
+ return run(args, env ? { cwd, env } : { cwd });
684
+ }
685
+
643
686
  export { pulumiMemberEngine, readPlywoodEngine, type PulumiMemberEngine, type PulumiMemberEngineSource, type PulumiMemberEngineOptions } from "./member-engine";
644
687
 
645
688
  /** The argv chant runs for a member's applied outputs, after `pulumi` (#4455). Secrets stay blinded. */
@@ -9,7 +9,7 @@
9
9
  * `local` store in a temp directory, so no git ref is written, no engine
10
10
  * runs and nothing reaches a backend.
11
11
  */
12
- import { cpSync, mkdtempSync, readFileSync } from "node:fs";
12
+ import { cpSync, mkdirSync, mkdtempSync, readFileSync } from "node:fs";
13
13
  import { tmpdir } from "node:os";
14
14
  import { join } from "node:path";
15
15
  import { describe, expect, test } from "vitest";
@@ -42,6 +42,8 @@ const localStore = (): SnapshotStore => createSnapshotStore({ store: "local", di
42
42
  function unexportedStack(): string {
43
43
  const dir = tmp();
44
44
  cpSync(join(testdata, "pulumi-preview", "Pulumi.yaml"), join(dir, "Pulumi.yaml"));
45
+ // Installed, so the step runs no install before the preview (plywood#22).
46
+ mkdirSync(join(dir, "node_modules"));
45
47
  return dir;
46
48
  }
47
49