@intentius/chant-lexicon-pulumi 0.124.54 → 0.124.55
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/README.md +42 -3
- package/dist/adopt.d.ts +68 -0
- package/dist/adopt.d.ts.map +1 -0
- package/dist/adopt.js +162 -0
- package/dist/capability-plugin.d.ts +3 -0
- package/dist/capability-plugin.d.ts.map +1 -1
- package/dist/capability-plugin.js +8 -1
- package/dist/change-set.d.ts +27 -4
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +15 -5
- package/dist/ci-setup.d.ts +53 -0
- package/dist/ci-setup.d.ts.map +1 -0
- package/dist/ci-setup.js +146 -0
- package/dist/composites/pulumi-adopt-op.d.ts +106 -0
- package/dist/composites/pulumi-adopt-op.d.ts.map +1 -0
- package/dist/composites/pulumi-adopt-op.js +132 -0
- package/dist/engine-events.d.ts +222 -0
- package/dist/engine-events.d.ts.map +1 -0
- package/dist/engine-events.js +280 -0
- package/dist/exit-codes.d.ts +53 -0
- package/dist/exit-codes.d.ts.map +1 -0
- package/dist/exit-codes.js +67 -0
- package/dist/index.d.ts +12 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -2
- package/dist/init-templates.d.ts.map +1 -1
- package/dist/init-templates.js +5 -3
- package/dist/integrity.json +3 -3
- package/dist/lint/post-synth/pul015.d.ts +2 -1
- package/dist/lint/post-synth/pul015.d.ts.map +1 -1
- package/dist/lock-rows.d.ts +32 -0
- package/dist/lock-rows.d.ts.map +1 -0
- package/dist/lock-rows.js +36 -0
- package/dist/manifest.json +1 -1
- package/dist/member-engine.d.ts +27 -2
- package/dist/member-engine.d.ts.map +1 -1
- package/dist/member-engine.js +58 -7
- package/dist/member-outputs.d.ts.map +1 -1
- package/dist/member-outputs.js +4 -4
- package/dist/op/activities/index.d.ts +9 -1
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/index.js +8 -1
- package/dist/op/activities/pulumi-adopt.d.ts +104 -0
- package/dist/op/activities/pulumi-adopt.d.ts.map +1 -0
- package/dist/op/activities/pulumi-adopt.js +216 -0
- package/dist/op/activities/pulumi.d.ts.map +1 -1
- package/dist/op/activities/pulumi.js +2 -1
- package/dist/op/activity-contracts.d.ts +73 -0
- package/dist/op/activity-contracts.d.ts.map +1 -1
- package/dist/op/activity-contracts.js +49 -0
- package/dist/op/builders.d.ts +9 -0
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/op/builders.js +20 -0
- package/dist/plan-shape.d.ts +47 -0
- package/dist/plan-shape.d.ts.map +1 -0
- package/dist/plan-shape.js +94 -0
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +25 -4
- package/dist/plunge-timings.d.ts +43 -0
- package/dist/plunge-timings.d.ts.map +1 -0
- package/dist/plunge-timings.js +106 -0
- package/dist/pulumi-up.d.ts +376 -0
- package/dist/pulumi-up.d.ts.map +1 -0
- package/dist/pulumi-up.js +823 -0
- package/dist/release-copy.d.ts +47 -0
- package/dist/release-copy.d.ts.map +1 -0
- package/dist/release-copy.js +131 -0
- package/dist/review-stack.d.ts +92 -0
- package/dist/review-stack.d.ts.map +1 -0
- package/dist/review-stack.js +222 -0
- package/dist/rules/pul015.ts +2 -1
- package/dist/run.d.ts +250 -7
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +432 -26
- package/dist/stack-export-snapshot.d.ts +125 -0
- package/dist/stack-export-snapshot.d.ts.map +1 -0
- package/dist/stack-export-snapshot.js +233 -0
- package/dist/stack-ops.d.ts +175 -0
- package/dist/stack-ops.d.ts.map +1 -0
- package/dist/stack-ops.js +400 -0
- package/dist/stack-references.d.ts +46 -0
- package/dist/stack-references.d.ts.map +1 -0
- package/dist/stack-references.js +88 -0
- package/dist/trace-facts.d.ts +34 -0
- package/dist/trace-facts.d.ts.map +1 -0
- package/dist/trace-facts.js +81 -0
- package/dist/workspace-member.d.ts +13 -2
- package/dist/workspace-member.d.ts.map +1 -1
- package/dist/workspace-member.js +14 -9
- package/package.json +2 -2
- package/src/adopt.ts +202 -0
- package/src/capability-plugin.ts +15 -6
- package/src/change-set.ts +29 -5
- package/src/ci-setup.test.ts +123 -0
- package/src/ci-setup.ts +176 -0
- package/src/composites/pulumi-adopt-op.test.ts +223 -0
- package/src/composites/pulumi-adopt-op.ts +191 -0
- package/src/composites/pulumi-watch-op.test.ts +2 -2
- package/src/engine-events.test.ts +134 -0
- package/src/engine-events.ts +390 -0
- package/src/engine-graph.test.ts +1 -1
- package/src/exit-codes.test.ts +21 -0
- package/src/exit-codes.ts +71 -0
- package/src/index.ts +75 -1
- package/src/init-templates.ts +5 -3
- package/src/lint/post-synth/pul015.ts +2 -1
- package/src/lock-rows.test.ts +60 -0
- package/src/lock-rows.ts +56 -0
- package/src/member-engine.test.ts +112 -0
- package/src/member-engine.ts +73 -6
- package/src/member-outputs.test.ts +2 -2
- package/src/member-outputs.ts +9 -8
- package/src/op/activities/index.ts +19 -1
- package/src/op/activities/pulumi-adopt.ts +334 -0
- package/src/op/activities/pulumi.ts +2 -1
- package/src/op/activity-contracts.ts +75 -0
- package/src/op/builders.ts +37 -0
- package/src/plan-shape.test.ts +91 -0
- package/src/plan-shape.ts +105 -0
- package/src/plugin.test.ts +1 -1
- package/src/plugin.ts +28 -4
- package/src/plunge-timings.test.ts +241 -0
- package/src/plunge-timings.ts +115 -0
- package/src/plunge-up-failed.test.ts +54 -0
- package/src/pr-note.test.ts +87 -0
- package/src/pulumi-up.test.ts +470 -0
- package/src/pulumi-up.ts +1032 -0
- package/src/release-copy.test.ts +74 -0
- package/src/release-copy.ts +142 -0
- package/src/review-stack.test.ts +254 -0
- package/src/review-stack.ts +266 -0
- package/src/run.test.ts +176 -3
- package/src/run.ts +501 -30
- package/src/stack-export-snapshot.test.ts +190 -0
- package/src/stack-export-snapshot.ts +312 -0
- package/src/stack-ops.test.ts +286 -0
- package/src/stack-ops.ts +552 -0
- package/src/stack-references.test.ts +96 -0
- package/src/stack-references.ts +110 -0
- package/src/testdata/pulumi-stream/README.md +16 -0
- package/src/testdata/pulumi-stream/preview-stream.ndjson +42 -0
- package/src/testdata/pulumi-stream/up-failed-plunge.ndjson +5 -0
- package/src/trace-facts.test.ts +38 -0
- package/src/trace-facts.ts +83 -0
- package/src/workspace-member.test.ts +2 -1
- package/src/workspace-member.ts +30 -12
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The engine event stream of `pulumi up --json`, and of `pulumi preview
|
|
3
|
+
* --json` run with `PULUMI_ENABLE_STREAMING_JSON_PREVIEW=true` (#4541,
|
|
4
|
+
* ruling C): one `apitype.EngineEvent` per line, the same shape for stock
|
|
5
|
+
* Pulumi and plunge (`sdk/go/common/apitype/events.go`).
|
|
6
|
+
*
|
|
7
|
+
* The printed preview document drops policy events
|
|
8
|
+
* (`pkg/backend/display/json.go` `ShowPreviewDigest`), so the pulumi-up
|
|
9
|
+
* capability previews with the stream instead, and reads both the change set
|
|
10
|
+
* and CrossGuard's verdict from one engine run:
|
|
11
|
+
*
|
|
12
|
+
* - {@link pulumiStreamPreview}: the stream turned back into the document
|
|
13
|
+
* `pulumiPreviewPart` and `pulumiPreviewDigest` read (`./change-set.ts`).
|
|
14
|
+
* Steps come from `resourcePreEvent`, filtered as the printed document
|
|
15
|
+
* filters them (`shouldShow`: a non-logical replacement step is left out,
|
|
16
|
+
* and `same` steps are kept, since chant always passes `--show-sames`).
|
|
17
|
+
* Each state is normalized to the printed form: a blinded secret envelope
|
|
18
|
+
* becomes `"[secret]"`, an empty `inputs` or `outputs` map and an empty
|
|
19
|
+
* `id` are left out, and `detailedDiff`'s `diffKind` is read as `kind`.
|
|
20
|
+
* The digest of the result equals the digest of the printed document for
|
|
21
|
+
* the same preview (checked against `testdata/pulumi-stream`).
|
|
22
|
+
* - {@link pulumiPolicyEvents} and {@link pulumiPolicyFindings}: the
|
|
23
|
+
* `policyEvent` lines, as `@intentius/chant/gate-policy` findings. A
|
|
24
|
+
* `mandatory` violation denies; `advisory` ones are warnings; `disabled`
|
|
25
|
+
* ones are dropped.
|
|
26
|
+
* - {@link pulumiStreamSummary}: the `summaryEvent`, and plunge's
|
|
27
|
+
* per-resource timings (INTENTIUS/plunge#55) when the steps carry them.
|
|
28
|
+
* - {@link pulumiStreamTimings}: those timings alone, by URN. plunge puts
|
|
29
|
+
* `metadata.plungeTimings` on each `resOutputsEvent` and
|
|
30
|
+
* `resOpFailedEvent` of `up --json`: one entry per provider call (`kind:
|
|
31
|
+
* "provider"`, `call` one of check, diff, create, read, update, delete)
|
|
32
|
+
* and per write or delete of the resource's record (`kind: "record"`),
|
|
33
|
+
* each with `startedAt` and `durationMs`, and `failed` when it failed.
|
|
34
|
+
* Every call is on exactly one event, and a replacement's create and
|
|
35
|
+
* delete steps split a URN's calls over two events, so the reader joins
|
|
36
|
+
* them. Stock Pulumi prints no such field, and the reader then finds none.
|
|
37
|
+
*
|
|
38
|
+
* During `up`, the engine may first preview: those `resourcePreEvent`s carry
|
|
39
|
+
* `planning: true`. {@link pulumiAppliedSteps} keeps only the steps the update
|
|
40
|
+
* ran, which is what the stock apply compares with the approved shape
|
|
41
|
+
* (ruling A).
|
|
42
|
+
*
|
|
43
|
+
* Like `./change-set.ts`, this module imports only `./values` and types, so it
|
|
44
|
+
* bundles without node's process modules.
|
|
45
|
+
*/
|
|
46
|
+
import { isObject, PULUMI_BLINDED_SECRET, PULUMI_SECRET_SIG, PULUMI_SIG_KEY } from "./values.js";
|
|
47
|
+
/** The env var that makes `preview --json` stream engine events instead of printing one document (`sdk/go/common/env/env.go`). */
|
|
48
|
+
export const PULUMI_STREAMING_PREVIEW_ENV = "PULUMI_ENABLE_STREAMING_JSON_PREVIEW";
|
|
49
|
+
/** The calls plunge times (INTENTIUS/plunge#55), by kind. */
|
|
50
|
+
export const PLUNGE_TIMING_CALLS = {
|
|
51
|
+
provider: ["check", "diff", "create", "read", "update", "delete"],
|
|
52
|
+
record: ["write", "delete"],
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* `value` as a {@link PlungeTiming}, or undefined when it is not one. A
|
|
56
|
+
* `call` outside the kind's list is kept, so a newer plunge's calls still
|
|
57
|
+
* read; an entry with no kind, no start or a negative duration is dropped.
|
|
58
|
+
*/
|
|
59
|
+
export function plungeTimingOf(value) {
|
|
60
|
+
if (!isObject(value))
|
|
61
|
+
return undefined;
|
|
62
|
+
const v = value;
|
|
63
|
+
if (v.kind !== "provider" && v.kind !== "record")
|
|
64
|
+
return undefined;
|
|
65
|
+
if (typeof v.call !== "string" || v.call === "")
|
|
66
|
+
return undefined;
|
|
67
|
+
if (typeof v.startedAt !== "string" || !Number.isFinite(Date.parse(v.startedAt)))
|
|
68
|
+
return undefined;
|
|
69
|
+
if (typeof v.durationMs !== "number" || !Number.isFinite(v.durationMs) || v.durationMs < 0)
|
|
70
|
+
return undefined;
|
|
71
|
+
return { kind: v.kind, call: v.call, startedAt: v.startedAt, durationMs: v.durationMs, ...(v.failed === true ? { failed: true } : {}) };
|
|
72
|
+
}
|
|
73
|
+
/** Every line of `stream` that parses as a JSON object. Other lines (a banner, a progress line) are skipped. */
|
|
74
|
+
export function pulumiEngineEvents(stream) {
|
|
75
|
+
const out = [];
|
|
76
|
+
for (const line of stream.split("\n")) {
|
|
77
|
+
const text = line.trim();
|
|
78
|
+
if (!text.startsWith("{"))
|
|
79
|
+
continue;
|
|
80
|
+
try {
|
|
81
|
+
const v = JSON.parse(text);
|
|
82
|
+
if (isObject(v))
|
|
83
|
+
out.push(v);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
// A line that is not one event: the stream's events are one per line.
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
/** Ops that are part of a replacement (`deploy.IsReplacementStep`). */
|
|
92
|
+
const REPLACEMENT_OPS = new Set(["replace", "create-replacement", "delete-replaced", "read-replacement", "discard-replaced", "import-replacement"]);
|
|
93
|
+
/** The printed document's filter (`shouldShow`), with `--show-sames` on: a non-logical replacement step is left out. */
|
|
94
|
+
function shown(m) {
|
|
95
|
+
return !(m.logical !== true && REPLACEMENT_OPS.has(m.op ?? ""));
|
|
96
|
+
}
|
|
97
|
+
/** A value with every blinded secret envelope read as the printed document's `"[secret]"`. */
|
|
98
|
+
function blinded(v) {
|
|
99
|
+
if (Array.isArray(v))
|
|
100
|
+
return v.map(blinded);
|
|
101
|
+
if (!isObject(v))
|
|
102
|
+
return v;
|
|
103
|
+
if (v[PULUMI_SIG_KEY] === PULUMI_SECRET_SIG)
|
|
104
|
+
return PULUMI_BLINDED_SECRET;
|
|
105
|
+
return Object.fromEntries(Object.entries(v).map(([k, x]) => [k, blinded(x)]));
|
|
106
|
+
}
|
|
107
|
+
/** A step state in the printed document's form (`apitype.ResourceV3`, empty fields omitted). */
|
|
108
|
+
function stateOf(s) {
|
|
109
|
+
if (!s || typeof s !== "object" || Array.isArray(s))
|
|
110
|
+
return undefined;
|
|
111
|
+
const map = (m) => (isObject(m) && Object.keys(m).length > 0 ? blinded(m) : undefined);
|
|
112
|
+
const inputs = map(s.inputs);
|
|
113
|
+
const outputs = map(s.outputs);
|
|
114
|
+
return {
|
|
115
|
+
...(s.urn ? { urn: s.urn } : {}),
|
|
116
|
+
...(typeof s.custom === "boolean" ? { custom: s.custom } : {}),
|
|
117
|
+
...(s.delete ? { delete: true } : {}),
|
|
118
|
+
...(s.id ? { id: s.id } : {}),
|
|
119
|
+
...(s.type ? { type: s.type } : {}),
|
|
120
|
+
...(s.parent ? { parent: s.parent } : {}),
|
|
121
|
+
...(inputs ? { inputs } : {}),
|
|
122
|
+
...(outputs ? { outputs } : {}),
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** One event step as a printed preview step (`getPreviewMetadataStep`). */
|
|
126
|
+
export function pulumiStepOfEvent(m) {
|
|
127
|
+
const oldState = stateOf(m.old);
|
|
128
|
+
const newState = stateOf(m.new);
|
|
129
|
+
const detailedDiff = isObject(m.detailedDiff)
|
|
130
|
+
? Object.fromEntries(Object.entries(m.detailedDiff).map(([k, d]) => [k, { ...(typeof d?.diffKind === "string" ? { kind: d.diffKind } : {}), ...(typeof d?.inputDiff === "boolean" ? { inputDiff: d.inputDiff } : {}) }]))
|
|
131
|
+
: undefined;
|
|
132
|
+
return {
|
|
133
|
+
...(m.op ? { op: m.op } : {}),
|
|
134
|
+
...(m.urn ? { urn: m.urn } : {}),
|
|
135
|
+
...(m.provider ? { provider: m.provider } : {}),
|
|
136
|
+
...(oldState ? { oldState } : {}),
|
|
137
|
+
...(newState ? { newState } : {}),
|
|
138
|
+
...(m.diffs?.length ? { diffReasons: [...m.diffs] } : {}),
|
|
139
|
+
...(m.keys?.length ? { replaceReasons: [...m.keys] } : {}),
|
|
140
|
+
...(detailedDiff ? { detailedDiff } : {}),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function stepsOf(events, keep) {
|
|
144
|
+
const out = [];
|
|
145
|
+
for (const e of events) {
|
|
146
|
+
const pre = e.resourcePreEvent;
|
|
147
|
+
if (!pre || !isObject(pre.metadata) || typeof pre.metadata.urn !== "string")
|
|
148
|
+
continue;
|
|
149
|
+
if (!keep(pre) || !shown(pre.metadata))
|
|
150
|
+
continue;
|
|
151
|
+
out.push(pulumiStepOfEvent(pre.metadata));
|
|
152
|
+
}
|
|
153
|
+
return out;
|
|
154
|
+
}
|
|
155
|
+
/** The diagnostics a stream printed, as the printed document lists them (ephemeral and debug ones left out). */
|
|
156
|
+
function diagnosticsOf(events) {
|
|
157
|
+
return events
|
|
158
|
+
.map((e) => e.diagnosticEvent)
|
|
159
|
+
.filter((d) => isObject(d) && d.ephemeral !== true && d.severity !== "debug" && typeof d.message === "string")
|
|
160
|
+
.map((d) => ({ ...(d.urn ? { urn: d.urn } : {}), message: d.message, severity: d.severity ?? "info" }));
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* A streamed preview as the document `pulumi preview --json` prints without
|
|
164
|
+
* the env var: `steps`, `diagnostics` and, from the summary, `changeSummary`.
|
|
165
|
+
* What `pulumiPreviewPart` and `pulumiPreviewDigest` read.
|
|
166
|
+
*/
|
|
167
|
+
export function pulumiStreamPreview(stream) {
|
|
168
|
+
const events = typeof stream === "string" ? pulumiEngineEvents(stream) : stream;
|
|
169
|
+
const summary = events.map((e) => e.summaryEvent).find((x) => isObject(x));
|
|
170
|
+
return {
|
|
171
|
+
steps: stepsOf(events, () => true),
|
|
172
|
+
diagnostics: diagnosticsOf(events),
|
|
173
|
+
...(summary?.resourceChanges ? { changeSummary: summary.resourceChanges } : {}),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
/** The steps an `up` ran: its `resourcePreEvent`s outside any preview phase (`planning` unset). */
|
|
177
|
+
export function pulumiAppliedSteps(stream) {
|
|
178
|
+
const events = typeof stream === "string" ? pulumiEngineEvents(stream) : stream;
|
|
179
|
+
return stepsOf(events, (e) => e.planning !== true);
|
|
180
|
+
}
|
|
181
|
+
/** The URNs whose operation failed during an `up` (`resOpFailedEvent`), sorted. */
|
|
182
|
+
export function pulumiFailedUrns(stream) {
|
|
183
|
+
const events = typeof stream === "string" ? pulumiEngineEvents(stream) : stream;
|
|
184
|
+
const urns = events.map((e) => e.resOpFailedEvent?.metadata?.urn).filter((u) => typeof u === "string");
|
|
185
|
+
return [...new Set(urns)].sort();
|
|
186
|
+
}
|
|
187
|
+
/** The URNs an `up` finished an operation on (`resOutputsEvent` outside a preview phase, `same` left out), sorted. */
|
|
188
|
+
export function pulumiLandedUrns(stream) {
|
|
189
|
+
const events = typeof stream === "string" ? pulumiEngineEvents(stream) : stream;
|
|
190
|
+
const urns = events
|
|
191
|
+
.map((e) => e.resOutputsEvent)
|
|
192
|
+
.filter((o) => isObject(o) && o.planning !== true && o.metadata?.op !== "same")
|
|
193
|
+
.map((o) => o.metadata?.urn)
|
|
194
|
+
.filter((u) => typeof u === "string");
|
|
195
|
+
return [...new Set(urns)].sort();
|
|
196
|
+
}
|
|
197
|
+
/** The `policyEvent` lines of a stream, `disabled` ones left out. */
|
|
198
|
+
export function pulumiPolicyEvents(stream) {
|
|
199
|
+
const events = typeof stream === "string" ? pulumiEngineEvents(stream) : stream;
|
|
200
|
+
const out = [];
|
|
201
|
+
for (const e of events) {
|
|
202
|
+
const p = e.policyEvent;
|
|
203
|
+
if (!p || typeof p !== "object" || p.enforcementLevel === "disabled")
|
|
204
|
+
continue;
|
|
205
|
+
out.push({
|
|
206
|
+
pack: p.policyPackName ?? "",
|
|
207
|
+
...(p.policyPackVersion ? { packVersion: p.policyPackVersion } : {}),
|
|
208
|
+
policy: p.policyName ?? "",
|
|
209
|
+
enforcementLevel: p.enforcementLevel ?? "advisory",
|
|
210
|
+
message: (p.message ?? "").trim(),
|
|
211
|
+
...(p.resourceUrn ? { urn: p.resourceUrn } : {}),
|
|
212
|
+
...(p.severity ? { severity: p.severity } : {}),
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
/** The rule id a CrossGuard policy is named by in chant's gate and overrides: `crossguard.<pack>.<policy>`. */
|
|
218
|
+
export function crossGuardRule(v) {
|
|
219
|
+
return `crossguard.${v.pack}.${v.policy}`;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* CrossGuard's violations as gate findings (`@intentius/chant/gate-policy`):
|
|
223
|
+
* a `mandatory` one denies the plan, an `advisory` (or `remediate`) one is
|
|
224
|
+
* a warning. CrossGuard has no hold.
|
|
225
|
+
*/
|
|
226
|
+
export function pulumiPolicyFindings(violations) {
|
|
227
|
+
const where = (v) => (v.urn ? ` (${v.urn})` : "");
|
|
228
|
+
return {
|
|
229
|
+
denials: violations.filter((v) => v.enforcementLevel === "mandatory").map((v) => ({ rule: crossGuardRule(v), message: `${v.message}${where(v)}` })),
|
|
230
|
+
holds: [],
|
|
231
|
+
warnings: violations.filter((v) => v.enforcementLevel !== "mandatory").map((v) => `${crossGuardRule(v)}: ${v.message}${where(v)}`),
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* plunge's per-resource timings in `up --json` (INTENTIUS/plunge#55), by URN:
|
|
236
|
+
* every valid entry of `metadata.plungeTimings` on each `resOutputsEvent`
|
|
237
|
+
* and `resOpFailedEvent`, joined across a URN's events in stream order. A
|
|
238
|
+
* stock Pulumi stream gives `{}`.
|
|
239
|
+
*/
|
|
240
|
+
export function pulumiStreamTimings(stream) {
|
|
241
|
+
var _a;
|
|
242
|
+
const events = typeof stream === "string" ? pulumiEngineEvents(stream) : stream;
|
|
243
|
+
const timings = {};
|
|
244
|
+
for (const e of events) {
|
|
245
|
+
for (const m of [e.resOutputsEvent?.metadata, e.resOpFailedEvent?.metadata]) {
|
|
246
|
+
if (!m?.urn || !Array.isArray(m.plungeTimings))
|
|
247
|
+
continue;
|
|
248
|
+
const read = m.plungeTimings.map(plungeTimingOf).filter((t) => t !== undefined);
|
|
249
|
+
if (read.length > 0)
|
|
250
|
+
(timings[_a = m.urn] ?? (timings[_a] = [])).push(...read);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
return timings;
|
|
254
|
+
}
|
|
255
|
+
/** The stream's `summaryEvent`, with plunge's timings when present. Undefined when the stream has no summary. */
|
|
256
|
+
export function pulumiStreamSummary(stream) {
|
|
257
|
+
const events = typeof stream === "string" ? pulumiEngineEvents(stream) : stream;
|
|
258
|
+
const s = events.map((e) => e.summaryEvent).find((x) => isObject(x));
|
|
259
|
+
const timings = pulumiStreamTimings(events);
|
|
260
|
+
if (!s)
|
|
261
|
+
return undefined;
|
|
262
|
+
return {
|
|
263
|
+
resourceChanges: isObject(s.resourceChanges) ? s.resourceChanges : {},
|
|
264
|
+
...(typeof s.durationSeconds === "number" ? { durationSeconds: s.durationSeconds } : {}),
|
|
265
|
+
...(typeof s.result === "string" && s.result ? { result: s.result } : {}),
|
|
266
|
+
...(s.maybeCorrupt ? { maybeCorrupt: true } : {}),
|
|
267
|
+
...(Object.keys(timings).length > 0 ? { timings } : {}),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
/** The first error a stream reported (an error diagnostic or an `errorEvent`), if any. */
|
|
271
|
+
export function pulumiStreamError(stream) {
|
|
272
|
+
const events = typeof stream === "string" ? pulumiEngineEvents(stream) : stream;
|
|
273
|
+
for (const e of events) {
|
|
274
|
+
if (typeof e.errorEvent?.error === "string" && e.errorEvent.error.trim())
|
|
275
|
+
return e.errorEvent.error.trim();
|
|
276
|
+
if (e.diagnosticEvent?.severity === "error" && typeof e.diagnosticEvent.message === "string")
|
|
277
|
+
return e.diagnosticEvent.message.trim();
|
|
278
|
+
}
|
|
279
|
+
return undefined;
|
|
280
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pulumi and plunge exit statuses mapped onto chant's exit-code table
|
|
3
|
+
* (#4553, `CHANT_EXIT` in `@intentius/chant/exit-codes`).
|
|
4
|
+
*
|
|
5
|
+
* Pulumi's own codes (`pkg/cmd/pulumi/cmd/exit_codes.go` upstream) overlap
|
|
6
|
+
* chant's numbers with other meanings: Pulumi's 3 is an authentication
|
|
7
|
+
* failure, chant's 3 a run waiting on a person. So nothing passes a raw
|
|
8
|
+
* Pulumi code through; every code the lexicon reads goes through
|
|
9
|
+
* {@link pulumiExitOf}. A Pulumi older than its exit-code taxonomy exits 1 for
|
|
10
|
+
* everything, which maps to `failed`, still right.
|
|
11
|
+
*
|
|
12
|
+
* The pulumi apply capability (#4541) wires this into its step: a plan that
|
|
13
|
+
* moved throws an error with `planMoved: true`, and core exits
|
|
14
|
+
* `CHANT_EXIT.moved`.
|
|
15
|
+
*/
|
|
16
|
+
import { type ChantExitCode } from "@intentius/chant/exit-codes";
|
|
17
|
+
/** Pulumi's exit statuses. */
|
|
18
|
+
export declare const PULUMI_EXIT: {
|
|
19
|
+
readonly success: 0;
|
|
20
|
+
readonly error: 1;
|
|
21
|
+
readonly configuration: 2;
|
|
22
|
+
readonly authentication: 3;
|
|
23
|
+
readonly resource: 4;
|
|
24
|
+
readonly policyViolation: 5;
|
|
25
|
+
readonly stackNotFound: 6;
|
|
26
|
+
/** `--expect-no-changes` found changes. */
|
|
27
|
+
readonly noChanges: 7;
|
|
28
|
+
readonly cancelled: 8;
|
|
29
|
+
readonly timeout: 9;
|
|
30
|
+
readonly await: 10;
|
|
31
|
+
readonly internal: 255;
|
|
32
|
+
};
|
|
33
|
+
/** plunge's exit status for a saved plan that moved, or one with no stamp (`pkg/backend/plunge/planstamp.go`, `ExitPlanMoved`). */
|
|
34
|
+
export declare const PLUNGE_PLAN_MOVED_EXIT = 40;
|
|
35
|
+
/**
|
|
36
|
+
* The table's code for a `pulumi` or `plunge` exit status.
|
|
37
|
+
*
|
|
38
|
+
* | Pulumi or plunge | Table |
|
|
39
|
+
* |---|---|
|
|
40
|
+
* | 0 | `done` |
|
|
41
|
+
* | 5 policy violation (a mandatory CrossGuard pack) | `denied` |
|
|
42
|
+
* | 7 changes under `--expect-no-changes` (a drift job's refresh) | `drift` |
|
|
43
|
+
* | plunge 40, a moved or unstamped plan | `moved` |
|
|
44
|
+
* | 1, 2 configuration, 3 authentication, 4 resource, 6 stack not found, 8 cancelled, 9 timeout, 10 await, 255, anything else | `failed` |
|
|
45
|
+
*
|
|
46
|
+
* A configuration error is `failed`: the table has no usage code of its own.
|
|
47
|
+
* Stock Pulumi's moved preview shape (`PlanShapeMovedError`) is core's moved
|
|
48
|
+
* mark already and never reaches here as a code.
|
|
49
|
+
*/
|
|
50
|
+
export declare function pulumiExitOf(code: number | null | undefined): ChantExitCode;
|
|
51
|
+
/** Whether a `pulumi` or `plunge` exit status is a plan that moved since its approval. */
|
|
52
|
+
export declare function pulumiPlanMoved(code: number | null | undefined): boolean;
|
|
53
|
+
//# sourceMappingURL=exit-codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../src/exit-codes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE7E,8BAA8B;AAC9B,eAAO,MAAM,WAAW;aACtB,OAAO,EAAE,CAAC;aACV,KAAK,EAAE,CAAC;aACR,aAAa,EAAE,CAAC;aAChB,cAAc,EAAE,CAAC;aACjB,QAAQ,EAAE,CAAC;aACX,eAAe,EAAE,CAAC;aAClB,aAAa,EAAE,CAAC;IAChB,2CAA2C;aAC3C,SAAS,EAAE,CAAC;aACZ,SAAS,EAAE,CAAC;aACZ,OAAO,EAAE,CAAC;aACV,KAAK,EAAE,EAAE;aACT,QAAQ,EAAE,GAAG;CACL,CAAC;AAEX,mIAAmI;AACnI,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,CAa3E;AAED,0FAA0F;AAC1F,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAExE"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pulumi and plunge exit statuses mapped onto chant's exit-code table
|
|
3
|
+
* (#4553, `CHANT_EXIT` in `@intentius/chant/exit-codes`).
|
|
4
|
+
*
|
|
5
|
+
* Pulumi's own codes (`pkg/cmd/pulumi/cmd/exit_codes.go` upstream) overlap
|
|
6
|
+
* chant's numbers with other meanings: Pulumi's 3 is an authentication
|
|
7
|
+
* failure, chant's 3 a run waiting on a person. So nothing passes a raw
|
|
8
|
+
* Pulumi code through; every code the lexicon reads goes through
|
|
9
|
+
* {@link pulumiExitOf}. A Pulumi older than its exit-code taxonomy exits 1 for
|
|
10
|
+
* everything, which maps to `failed`, still right.
|
|
11
|
+
*
|
|
12
|
+
* The pulumi apply capability (#4541) wires this into its step: a plan that
|
|
13
|
+
* moved throws an error with `planMoved: true`, and core exits
|
|
14
|
+
* `CHANT_EXIT.moved`.
|
|
15
|
+
*/
|
|
16
|
+
import { CHANT_EXIT } from "@intentius/chant/exit-codes";
|
|
17
|
+
/** Pulumi's exit statuses. */
|
|
18
|
+
export const PULUMI_EXIT = {
|
|
19
|
+
success: 0,
|
|
20
|
+
error: 1,
|
|
21
|
+
configuration: 2,
|
|
22
|
+
authentication: 3,
|
|
23
|
+
resource: 4,
|
|
24
|
+
policyViolation: 5,
|
|
25
|
+
stackNotFound: 6,
|
|
26
|
+
/** `--expect-no-changes` found changes. */
|
|
27
|
+
noChanges: 7,
|
|
28
|
+
cancelled: 8,
|
|
29
|
+
timeout: 9,
|
|
30
|
+
await: 10,
|
|
31
|
+
internal: 255,
|
|
32
|
+
};
|
|
33
|
+
/** plunge's exit status for a saved plan that moved, or one with no stamp (`pkg/backend/plunge/planstamp.go`, `ExitPlanMoved`). */
|
|
34
|
+
export const PLUNGE_PLAN_MOVED_EXIT = 40;
|
|
35
|
+
/**
|
|
36
|
+
* The table's code for a `pulumi` or `plunge` exit status.
|
|
37
|
+
*
|
|
38
|
+
* | Pulumi or plunge | Table |
|
|
39
|
+
* |---|---|
|
|
40
|
+
* | 0 | `done` |
|
|
41
|
+
* | 5 policy violation (a mandatory CrossGuard pack) | `denied` |
|
|
42
|
+
* | 7 changes under `--expect-no-changes` (a drift job's refresh) | `drift` |
|
|
43
|
+
* | plunge 40, a moved or unstamped plan | `moved` |
|
|
44
|
+
* | 1, 2 configuration, 3 authentication, 4 resource, 6 stack not found, 8 cancelled, 9 timeout, 10 await, 255, anything else | `failed` |
|
|
45
|
+
*
|
|
46
|
+
* A configuration error is `failed`: the table has no usage code of its own.
|
|
47
|
+
* Stock Pulumi's moved preview shape (`PlanShapeMovedError`) is core's moved
|
|
48
|
+
* mark already and never reaches here as a code.
|
|
49
|
+
*/
|
|
50
|
+
export function pulumiExitOf(code) {
|
|
51
|
+
switch (code) {
|
|
52
|
+
case PULUMI_EXIT.success:
|
|
53
|
+
return CHANT_EXIT.done;
|
|
54
|
+
case PULUMI_EXIT.policyViolation:
|
|
55
|
+
return CHANT_EXIT.denied;
|
|
56
|
+
case PULUMI_EXIT.noChanges:
|
|
57
|
+
return CHANT_EXIT.drift;
|
|
58
|
+
case PLUNGE_PLAN_MOVED_EXIT:
|
|
59
|
+
return CHANT_EXIT.moved;
|
|
60
|
+
default:
|
|
61
|
+
return CHANT_EXIT.failed;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Whether a `pulumi` or `plunge` exit status is a plan that moved since its approval. */
|
|
65
|
+
export function pulumiPlanMoved(code) {
|
|
66
|
+
return pulumiExitOf(code) === CHANT_EXIT.moved;
|
|
67
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,13 +4,23 @@ export { pulumiConfigSchema, pulumiMemberConfigSchema, type PulumiConfig } from
|
|
|
4
4
|
export { readPulumiMember, PULUMI_EXPORT_FILE, type PulumiMemberConfig, type PulumiMemberReport } from "./workspace-member.js";
|
|
5
5
|
export { pulumiPreviewPart, pulumiPreviewDigest, pulumiSteps, pulumiExportResources, type PulumiPreviewPartInput, type PulumiStep, type PulumiStepState, type PulumiExportedResource, } from "./change-set.js";
|
|
6
6
|
export { pulumiRefreshArgs, pulumiRefreshDriftRecords, pulumiRefreshDocumentRecords, type PulumiRefreshRead, type PulumiRefreshDriftInput, type PulumiRefreshDocumentInput, } from "./drift-record.js";
|
|
7
|
-
export { previewPulumiMember, previewPulumiMemberRead, refreshPulumiMember, pulumiMemberEngine, pulumiMemberStackOutputs, pulumiPreviewArgs, pulumiStackOutputArgs, runAllowedPlunge, runAllowedPulumi, readMemberExport, defaultPulumiRunner, PULUMI_ALLOWED_COMMANDS, type PulumiRunner, type PreviewPulumiMemberOptions, type PulumiMemberPreview, type PulumiMemberEngine, type PulumiMemberStackOutputsOptions, type RefreshPulumiMemberOptions, } from "./run.js";
|
|
7
|
+
export { previewPulumiMember, previewPulumiMemberRead, refreshPulumiMember, pulumiMemberEngine, pulumiMemberStackOutputs, pulumiPreviewArgs, pulumiStackOutputArgs, runAllowedPlunge, runAllowedPulumi, readMemberExport, defaultPulumiRunner, PULUMI_ALLOWED_COMMANDS, PULUMI_APPLY_COMMANDS, runApplyPulumi, runApplyPlunge, pulumiUpArgs, plungeUpArgs, pulumiUpPreviewArgs, PULUMI_REVIEW_STACK_COMMANDS, REVIEW_STACK_NAME, isReviewStackName, reviewStackInitArgs, reviewStackDestroyArgs, reviewStackRmArgs, runReviewStackPulumi, runReviewStackPlunge, type PulumiPolicyPack, type PulumiApplyTail, type PulumiRunner, type PreviewPulumiMemberOptions, type PulumiMemberPreview, type PulumiMemberEngine, type PulumiMemberStackOutputsOptions, type RefreshPulumiMemberOptions, } from "./run.js";
|
|
8
8
|
export { pulumiExportedStackOutputs, pulumiPlannedStackOutputs, type PulumiStackOutput } from "./stack-outputs.js";
|
|
9
9
|
export { PULUMI_UNKNOWN, PULUMI_SIG_KEY, PULUMI_SECRET_SIG } from "./values.js";
|
|
10
10
|
export { pulumiOutputSource, pulumiStackOutputSource, pulumiMemberPlannedOutputs, pulumiExportedOutputValues, pulumiPartHasChanges, PULUMI_APPLIED_OUTPUTS_ENV, type PulumiAppliedFrom, type PulumiOutputSourceOptions, } from "./member-outputs.js";
|
|
11
|
-
export { pulumiCapabilityPlugin } from "./capability-plugin.js";
|
|
11
|
+
export { pulumiCapabilityPlugin, PULUMI_VERB_FAMILIES } from "./capability-plugin.js";
|
|
12
|
+
export { createPulumiUpCapability, pulumiReviewStep, PR_ENV_TEMPLATE_VARIABLE, pulumiUpCapability, pulumiUpMember, pulumiReleaseInputs, pulumiScratchConfig, pulumiDefaultLockGrain, PulumiPlanMovedError, PulumiPolicyDeniedError, PulumiAppliedShapeError, PulumiResourceGrainRefusedError, type PulumiUpStepInput, type PulumiUpStepOutput, type PulumiUpArtifact, type PulumiUpOptions, type PulumiLockGrain, } from "./pulumi-up.js";
|
|
13
|
+
export { pulumiPlanShape, pulumiShapeDifferences, type PulumiPlanShapeOptions } from "./plan-shape.js";
|
|
14
|
+
export { pulumiLockRows } from "./lock-rows.js";
|
|
15
|
+
export { pulumiEngineEvents, pulumiStreamPreview, pulumiAppliedSteps, pulumiPolicyEvents, pulumiPolicyFindings, pulumiStreamSummary, crossGuardRule, PULUMI_STREAMING_PREVIEW_ENV, type PulumiEngineEvent, type PulumiPolicyViolation, type PulumiApplySummary, } from "./engine-events.js";
|
|
12
16
|
export { readPulumiDrift, type PulumiDriftRunners } from "./drift-read.js";
|
|
13
17
|
export { pulumiAuditCatalog } from "./lint/audit-catalog.js";
|
|
14
18
|
export { PulumiWatchOp, type PulumiWatchOpConfig, type PulumiWatchOpResources } from "./composites/pulumi-watch-op.js";
|
|
19
|
+
export { gatedStackExport, gatedStackCancel, gatedStackMove, moveLeftovers, diyStackLockIds, pulumiStackLockIds, type PulumiStackLocks, PULUMI_STACK_OPS_OP, type PulumiStackOpOutcome, type PulumiStackOpCommon, type PulumiStackOpKind } from "./stack-ops.js";
|
|
20
|
+
export { initReviewStack, removeReviewStack, parseReviewStackLocation, prNumberOf, pulumiTemplateStack, reviewConfigSource, reviewStackFor, reviewStackLocation, reviewStackTeardown, REVIEW_STACK_TEARDOWN, type ReviewStackOptions, type ReviewStackOutcome, type ReviewStackTeardown, type ReviewStackTeardownOptions, } from "./review-stack.js";
|
|
21
|
+
export { pulumiStackReferences, parsePulumiStackName, stackReferenceOwner, PULUMI_STACK_REFERENCE_TYPE, type PulumiStackReference } from "./stack-references.js";
|
|
22
|
+
export { PulumiAdoptOp, type PulumiAdoptOpConfig, type PulumiAdoptOpResources, type PulumiAdoptStack } from "./composites/pulumi-adopt-op.js";
|
|
23
|
+
export { parsePlungeAdoptView, pulumiAdoptDigest, adoptBucketTarget, type PlungeAdoptView, type PlungeAdoptStatus } from "./adopt.js";
|
|
15
24
|
export { pulumiPreview as pulumiPreviewStep, pulumiDrift as pulumiDriftStep } from "./op/builders.js";
|
|
25
|
+
export { pulumiExitOf, pulumiPlanMoved, PULUMI_EXIT, PLUNGE_PLAN_MOVED_EXIT } from "./exit-codes.js";
|
|
16
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,KAAK,YAAY,EAAE,MAAM,UAAU,CAAC;AAC3F,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5H,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,WAAW,EACX,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,sBAAsB,GAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,4BAA4B,EAC5B,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,0BAA0B,GAChC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAC/B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,+BAA+B,EACpC,KAAK,0BAA0B,GAChC,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,0BAA0B,EAAE,yBAAyB,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAChH,OAAO,EAAE,cAAc,E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YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,13 +4,26 @@ export { pulumiConfigSchema, pulumiMemberConfigSchema } from "./config.js";
|
|
|
4
4
|
export { readPulumiMember, PULUMI_EXPORT_FILE } from "./workspace-member.js";
|
|
5
5
|
export { pulumiPreviewPart, pulumiPreviewDigest, pulumiSteps, pulumiExportResources, } from "./change-set.js";
|
|
6
6
|
export { pulumiRefreshArgs, pulumiRefreshDriftRecords, pulumiRefreshDocumentRecords, } from "./drift-record.js";
|
|
7
|
-
export { previewPulumiMember, previewPulumiMemberRead, refreshPulumiMember, pulumiMemberEngine, pulumiMemberStackOutputs, pulumiPreviewArgs, pulumiStackOutputArgs, runAllowedPlunge, runAllowedPulumi, readMemberExport, defaultPulumiRunner, PULUMI_ALLOWED_COMMANDS, } from "./run.js";
|
|
7
|
+
export { previewPulumiMember, previewPulumiMemberRead, refreshPulumiMember, pulumiMemberEngine, pulumiMemberStackOutputs, pulumiPreviewArgs, pulumiStackOutputArgs, runAllowedPlunge, runAllowedPulumi, readMemberExport, defaultPulumiRunner, PULUMI_ALLOWED_COMMANDS, PULUMI_APPLY_COMMANDS, runApplyPulumi, runApplyPlunge, pulumiUpArgs, plungeUpArgs, pulumiUpPreviewArgs, PULUMI_REVIEW_STACK_COMMANDS, REVIEW_STACK_NAME, isReviewStackName, reviewStackInitArgs, reviewStackDestroyArgs, reviewStackRmArgs, runReviewStackPulumi, runReviewStackPlunge, } from "./run.js";
|
|
8
8
|
export { pulumiExportedStackOutputs, pulumiPlannedStackOutputs } from "./stack-outputs.js";
|
|
9
9
|
export { PULUMI_UNKNOWN, PULUMI_SIG_KEY, PULUMI_SECRET_SIG } from "./values.js";
|
|
10
10
|
export { pulumiOutputSource, pulumiStackOutputSource, pulumiMemberPlannedOutputs, pulumiExportedOutputValues, pulumiPartHasChanges, PULUMI_APPLIED_OUTPUTS_ENV, } from "./member-outputs.js";
|
|
11
|
-
export { pulumiCapabilityPlugin } from "./capability-plugin.js";
|
|
11
|
+
export { pulumiCapabilityPlugin, PULUMI_VERB_FAMILIES } from "./capability-plugin.js";
|
|
12
|
+
// The apply capability (#4541): a Pulumi or plunge stack as a component step that plans and applies.
|
|
13
|
+
export { createPulumiUpCapability, pulumiReviewStep, PR_ENV_TEMPLATE_VARIABLE, pulumiUpCapability, pulumiUpMember, pulumiReleaseInputs, pulumiScratchConfig, pulumiDefaultLockGrain, PulumiPlanMovedError, PulumiPolicyDeniedError, PulumiAppliedShapeError, PulumiResourceGrainRefusedError, } from "./pulumi-up.js";
|
|
14
|
+
export { pulumiPlanShape, pulumiShapeDifferences } from "./plan-shape.js";
|
|
15
|
+
export { pulumiLockRows } from "./lock-rows.js";
|
|
16
|
+
export { pulumiEngineEvents, pulumiStreamPreview, pulumiAppliedSteps, pulumiPolicyEvents, pulumiPolicyFindings, pulumiStreamSummary, crossGuardRule, PULUMI_STREAMING_PREVIEW_ENV, } from "./engine-events.js";
|
|
12
17
|
export { readPulumiDrift } from "./drift-read.js";
|
|
13
18
|
export { pulumiAuditCatalog } from "./lint/audit-catalog.js";
|
|
14
19
|
// The Preview/Drift watch composite and its step builders (#4494).
|
|
15
20
|
export { PulumiWatchOp } from "./composites/pulumi-watch-op.js";
|
|
21
|
+
export { gatedStackExport, gatedStackCancel, gatedStackMove, moveLeftovers, diyStackLockIds, pulumiStackLockIds, PULUMI_STACK_OPS_OP } from "./stack-ops.js";
|
|
22
|
+
// Review stacks (INTENTIUS/plywood#15): pr-<n> stacks only.
|
|
23
|
+
export { initReviewStack, removeReviewStack, parseReviewStackLocation, prNumberOf, pulumiTemplateStack, reviewConfigSource, reviewStackFor, reviewStackLocation, reviewStackTeardown, REVIEW_STACK_TEARDOWN, } from "./review-stack.js";
|
|
24
|
+
export { pulumiStackReferences, parsePulumiStackName, stackReferenceOwner, PULUMI_STACK_REFERENCE_TYPE } from "./stack-references.js";
|
|
25
|
+
export { PulumiAdoptOp } from "./composites/pulumi-adopt-op.js";
|
|
26
|
+
export { parsePlungeAdoptView, pulumiAdoptDigest, adoptBucketTarget } from "./adopt.js";
|
|
16
27
|
export { pulumiPreview as pulumiPreviewStep, pulumiDrift as pulumiDriftStep } from "./op/builders.js";
|
|
28
|
+
// Pulumi and plunge exit statuses on chant's exit-code table (#4553).
|
|
29
|
+
export { pulumiExitOf, pulumiPlanMoved, PULUMI_EXIT, PLUNGE_PLAN_MOVED_EXIT } from "./exit-codes.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-templates.d.ts","sourceRoot":"","sources":["../src/init-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"init-templates.d.ts","sourceRoot":"","sources":["../src/init-templates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAmDhE,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,QAAQ,GAAG,OAAO,GAAG,QAAQ,EAAE,eAAe,CAatF,CAAC"}
|
package/dist/init-templates.js
CHANGED
|
@@ -3,9 +3,11 @@ function chantConfig(member) {
|
|
|
3
3
|
import "@intentius/chant-lexicon-pulumi";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Reads the Pulumi program in ./infra as a member
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* Reads the Pulumi program in ./infra as a member. Its graph is the stack
|
|
7
|
+
* export that chant's pulumi-up apply writes to refs/chant/snapshots after
|
|
8
|
+
* each update, so nothing is checked in. A stack applied outside chant can
|
|
9
|
+
* check in stack-export.json beside Pulumi.yaml instead, taken with
|
|
10
|
+
* \`pulumi stack export --file stack-export.json\` after each update.
|
|
9
11
|
* \`dir\` is relative to this file (PUL101 warns on an absolute one).
|
|
10
12
|
*/
|
|
11
13
|
export default {
|
package/dist/integrity.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"algorithm": "sha256",
|
|
3
3
|
"artifacts": {
|
|
4
|
-
"manifest.json": "
|
|
4
|
+
"manifest.json": "d4de8cb6f01fdb50a4e9b53ae82877b221a4512e50e804f33eface5da48e9840",
|
|
5
5
|
"meta.json": "ca3d163bab055381827226140568f3bef7eaac187cebd76878e0b63e9e442356",
|
|
6
6
|
"types/index.d.ts": "883bcdf6a960e21360e79df010ca2087719fffec60fc39541c5ecd32d661e328",
|
|
7
7
|
"rules/member-dir-absolute.ts": "4805d5e247ad544f942e1b2c36fc15a5087ca0aacaf804183a269021bd60e276",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"rules/pul012.ts": "136f9764a532f56ce72461641550c9c4cee6af06c30968d8374f1a65a1b810d4",
|
|
21
21
|
"rules/pul013.ts": "a19b397fecc2bda3e5f32c8f339b0befbd8f1148b32e70a3ba4f9370ee103379",
|
|
22
22
|
"rules/pul014.ts": "25dd5ca4cb7f9906c608f4b7f78559efd188215c9a9a2f9f131498a847d3259b",
|
|
23
|
-
"rules/pul015.ts": "
|
|
23
|
+
"rules/pul015.ts": "f5eb45e941dfbe1ec53a31fd12258d7adb9877de33b5bcc566a09e3a0829d9da",
|
|
24
24
|
"skills/chant-pulumi.md": "aef93407423daf6d0acc492a4d5bbf002fbae67b4f993ad36f86725686b98d61",
|
|
25
25
|
"skills/chant-pulumi-stack-export.md": "aadd67f5e067de61dfda43d57492bca08bd22429e4baf314d6856a810dc0e8dc",
|
|
26
26
|
"skills/chant-pulumi-plunge.md": "8a7f2f9f1124744dee9645905f141057ca01f5a88e34e1bc3858d69406d7ff3a"
|
|
27
27
|
},
|
|
28
|
-
"composite": "
|
|
28
|
+
"composite": "362628fd365ccf7dfb116696cbe7f48f955530635fcba52c4366ad55a66ea747"
|
|
29
29
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* PUL015: the config says stock pulumi for a member on a plunge backend.
|
|
3
3
|
*
|
|
4
4
|
* `pulumi.member.engine` decides which binary runs the member's preview,
|
|
5
|
-
* outputs and drift; with none set,
|
|
5
|
+
* outputs and drift; with none set, `plywood.yml`'s engine, a `plunge`
|
|
6
|
+
* `PULUMI_BACKEND_URL`, or a `backend.url` in `Pulumi.yaml` that
|
|
6
7
|
* starts with `plunge` means plunge (`../../run.ts`, `pulumiMemberEngine`).
|
|
7
8
|
* The config wins, so `engine: "pulumi"` on a program whose backend is
|
|
8
9
|
* `plunge+file://...` or `plunge://...` runs stock `pulumi` against a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pul015.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/pul015.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pul015.d.ts","sourceRoot":"","sources":["../../../src/lint/post-synth/pul015.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAyC,MAAM,kCAAkC,CAAC;AAK9G,eAAO,MAAM,MAAM,EAAE,cAkBpB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The rows a Pulumi or plunge apply holds on the resource lock grain
|
|
3
|
+
* (#4552), from the member's change-set part (`./change-set.ts`):
|
|
4
|
+
*
|
|
5
|
+
* - `urn <urn>` for every resource the preview changes (create, update,
|
|
6
|
+
* replace, delete or forget). The URN carries the project and the stack,
|
|
7
|
+
* so two stacks never meet on a URN row.
|
|
8
|
+
* - `object <id>` for an update, replace, delete or forget whose resource
|
|
9
|
+
* has an id, so two members that act on one live object meet on its row,
|
|
10
|
+
* whatever lexicon or stack they are in.
|
|
11
|
+
* - The root `pulumi:pulumi:Stack` URN's row when its step is not `same`:
|
|
12
|
+
* two runs that rewrite the stack's outputs serialize. It is one more
|
|
13
|
+
* changed entry, so it needs no rule of its own.
|
|
14
|
+
* - When any entry is `mayAppear` (a component may register children only
|
|
15
|
+
* at apply, or the last export holds a resource the preview did not list),
|
|
16
|
+
* one `stack <project>/<stack>` row in place of the URN rows (ruling C),
|
|
17
|
+
* which conflicts with every `urn` row of the stack. The `object` rows stay.
|
|
18
|
+
*
|
|
19
|
+
* `same` and `read` steps hold nothing.
|
|
20
|
+
*/
|
|
21
|
+
import type { ChangeSetPart } from "@intentius/chant/change-set";
|
|
22
|
+
import { type LockRow } from "@intentius/chant/lifecycle/lock-rows";
|
|
23
|
+
/**
|
|
24
|
+
* The rows of one Pulumi member's part. `target` names the member in a
|
|
25
|
+
* refusal (`<project>/<stack>`); `fallback` gives the project and stack when
|
|
26
|
+
* no entry's address is a URN.
|
|
27
|
+
*/
|
|
28
|
+
export declare function pulumiLockRows(part: ChangeSetPart, target: string, fallback?: {
|
|
29
|
+
project?: string;
|
|
30
|
+
stack?: string;
|
|
31
|
+
}): LockRow[];
|
|
32
|
+
//# sourceMappingURL=lock-rows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock-rows.d.ts","sourceRoot":"","sources":["../src/lock-rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAwD,KAAK,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAe1H;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,EAAE,CAclI"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { objectRowKey, sortedLockRows, stackRowKey, urnRowKey } from "@intentius/chant/lifecycle/lock-rows";
|
|
2
|
+
import { parsePulumiUrn } from "@intentius/chant/pulumi-urn";
|
|
3
|
+
const HOLDS = new Set(["create", "update", "replace", "delete", "forget"]);
|
|
4
|
+
/** The project and stack a part's URNs name, or the fallbacks when no URN parses. */
|
|
5
|
+
function stackOf(part, fallback) {
|
|
6
|
+
for (const e of part.entries) {
|
|
7
|
+
const parsed = parsePulumiUrn(e.address);
|
|
8
|
+
if (parsed)
|
|
9
|
+
return { project: parsed.project, stack: parsed.stack };
|
|
10
|
+
}
|
|
11
|
+
const stack = part.member.scope ?? fallback.stack;
|
|
12
|
+
return fallback.project && stack ? { project: fallback.project, stack } : undefined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The rows of one Pulumi member's part. `target` names the member in a
|
|
16
|
+
* refusal (`<project>/<stack>`); `fallback` gives the project and stack when
|
|
17
|
+
* no entry's address is a URN.
|
|
18
|
+
*/
|
|
19
|
+
export function pulumiLockRows(part, target, fallback = {}) {
|
|
20
|
+
const changing = part.entries.filter((e) => HOLDS.has(e.action));
|
|
21
|
+
const rows = [];
|
|
22
|
+
for (const e of changing) {
|
|
23
|
+
if (e.action !== "create" && e.id)
|
|
24
|
+
rows.push({ key: objectRowKey(e.id), target, address: e.address });
|
|
25
|
+
}
|
|
26
|
+
if (changing.some((e) => e.mayAppear === true)) {
|
|
27
|
+
const at = stackOf(part, fallback);
|
|
28
|
+
if (!at)
|
|
29
|
+
throw new Error(`"${target}": some resources of the stack may appear only at apply, and neither a URN nor the step names the stack, so its row cannot be keyed`);
|
|
30
|
+
rows.push({ key: stackRowKey(at.project, at.stack), target, address: `${at.project}/${at.stack}` });
|
|
31
|
+
return sortedLockRows(rows);
|
|
32
|
+
}
|
|
33
|
+
for (const e of changing)
|
|
34
|
+
rows.push({ key: urnRowKey(e.address), target, address: e.address });
|
|
35
|
+
return sortedLockRows(rows);
|
|
36
|
+
}
|