@intentius/chant 0.124.64 → 0.124.66
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/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +3 -1
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +20 -2
- package/dist/cli/handlers/run.d.ts +30 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +108 -7
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +17 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +7 -0
- package/dist/cli/registry.d.ts +5 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +19 -1
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +11 -3
- package/dist/components/component.d.ts +19 -0
- package/dist/components/component.d.ts.map +1 -1
- package/dist/components/component.schema.json +17 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/release-run.d.ts +48 -0
- package/dist/components/release-run.d.ts.map +1 -0
- package/dist/components/release-run.js +166 -0
- package/dist/components/starter-plugin.d.ts +1 -0
- package/dist/components/starter-plugin.d.ts.map +1 -1
- package/dist/components/starter-plugin.js +5 -1
- package/dist/components/unchanged-inputs.d.ts +81 -0
- package/dist/components/unchanged-inputs.d.ts.map +1 -0
- package/dist/components/unchanged-inputs.js +121 -0
- package/dist/components/verbs/index.d.ts +1 -0
- package/dist/components/verbs/index.d.ts.map +1 -1
- package/dist/components/verbs/index.js +1 -0
- package/dist/components/verbs/release-image.d.ts +36 -0
- package/dist/components/verbs/release-image.d.ts.map +1 -0
- package/dist/components/verbs/release-image.js +33 -0
- package/dist/lifecycle/delivery-metrics.d.ts.map +1 -1
- package/dist/lifecycle/delivery-metrics.js +4 -2
- package/dist/lifecycle/gate-statement.d.ts.map +1 -1
- package/dist/lifecycle/gate-statement.js +1 -2
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +6 -1
- package/dist/lifecycle/ledger-read.js +1 -1
- package/dist/lifecycle/publish-homebrew.d.ts.map +1 -1
- package/dist/lifecycle/publish-homebrew.js +1 -2
- package/dist/lifecycle/publish-marketplace.d.ts.map +1 -1
- package/dist/lifecycle/publish-marketplace.js +2 -3
- package/dist/lifecycle/query.d.ts +2 -2
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +3 -3
- package/dist/lifecycle/release-cut.d.ts +32 -2
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +47 -7
- package/dist/lifecycle/release-ledger.d.ts +11 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-store.d.ts +17 -3
- package/dist/lifecycle/release-store.d.ts.map +1 -1
- package/dist/lifecycle/release-store.js +10 -3
- package/dist/op/activities/activity-contracts.d.ts +4 -4
- package/dist/op/op-waves-run.js +5 -3
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +3 -1
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/wave-runtime.mjs +311 -311
- package/dist/workspace/delivery-metrics.schema.json +1 -1
- package/dist/workspace/release-candidates.d.ts.map +1 -1
- package/dist/workspace/release-candidates.js +1 -2
- package/dist/workspace/releases.schema.json +7 -2
- package/package.json +1 -1
- package/src/cli/handlers/pr.ts +3 -1
- package/src/cli/handlers/release.ts +18 -2
- package/src/cli/handlers/run-unchanged.e2e.test.ts +112 -0
- package/src/cli/handlers/run.ts +117 -7
- package/src/cli/main.ts +17 -2
- package/src/cli/parse-args.ts +6 -0
- package/src/cli/registry.ts +5 -1
- package/src/components/cli-support.test.ts +53 -0
- package/src/components/cli-support.ts +26 -4
- package/src/components/component.schema.json +17 -0
- package/src/components/component.ts +20 -0
- package/src/components/index.ts +1 -0
- package/src/components/registry.test.ts +1 -1
- package/src/components/release-run.test.ts +127 -0
- package/src/components/release-run.ts +188 -0
- package/src/components/starter-plugin.ts +5 -0
- package/src/components/unchanged-inputs.test.ts +98 -0
- package/src/components/unchanged-inputs.ts +150 -0
- package/src/components/verbs/index.ts +1 -0
- package/src/components/verbs/release-image.ts +52 -0
- package/src/lifecycle/delivery-metrics.ts +4 -2
- package/src/lifecycle/gate-statement.ts +1 -2
- package/src/lifecycle/git.test.ts +15 -0
- package/src/lifecycle/git.ts +5 -1
- package/src/lifecycle/ledger-read.ts +1 -1
- package/src/lifecycle/publish-homebrew.ts +1 -2
- package/src/lifecycle/publish-marketplace.ts +2 -3
- package/src/lifecycle/query.ts +3 -3
- package/src/lifecycle/release-cut-lane.test.ts +18 -0
- package/src/lifecycle/release-cut-override.test.ts +12 -0
- package/src/lifecycle/release-cut.test.ts +45 -0
- package/src/lifecycle/release-cut.ts +67 -7
- package/src/lifecycle/release-ledger.ts +11 -0
- package/src/lifecycle/release-store.ts +28 -5
- package/src/op/op-waves-run.ts +4 -2
- package/src/pr-forge.ts +3 -1
- package/src/pr-requires.test.ts +10 -0
- package/src/release-floors.ts +1 -1
- package/src/workspace/delivery-metrics.schema.json +1 -1
- package/src/workspace/delivery-metrics.test.ts +8 -0
- package/src/workspace/release-candidates.ts +1 -2
- package/src/workspace/releases.schema.json +7 -2
|
@@ -284,11 +284,13 @@ buildParams) {
|
|
|
284
284
|
}
|
|
285
285
|
const discovered = [...result.components.values()].map(({ component }) => component);
|
|
286
286
|
const all = discovered.map((component) => toDriverComponent(component));
|
|
287
|
+
const inputs = Object.fromEntries(discovered.filter((c) => c.inputs !== undefined).map((c) => [c.name, c.inputs]));
|
|
288
|
+
const declared = Object.keys(inputs).length > 0 ? { inputs } : {};
|
|
287
289
|
if (isComponentList(selector))
|
|
288
|
-
return resolveComponentList(selector, discovered, all);
|
|
290
|
+
return { ...resolveComponentList(selector, discovered, all), ...declared };
|
|
289
291
|
if (selector === "all") {
|
|
290
292
|
const sites = Object.fromEntries(discovered.filter((c) => c.environments && c.environments.length > 0).map((c) => [c.name, c.environments.map((e) => ({ ...e }))]));
|
|
291
|
-
return { success: true, targets: withoutDisabled(discovered, all), ...(Object.keys(sites).length > 0 ? { sites } : {}) };
|
|
293
|
+
return { success: true, targets: withoutDisabled(discovered, all), ...(Object.keys(sites).length > 0 ? { sites } : {}), ...declared };
|
|
292
294
|
}
|
|
293
295
|
const found = all.find((c) => c.name === selector);
|
|
294
296
|
const disabledByName = discovered.find((c) => c.name === selector && c.enabled === false);
|
|
@@ -309,7 +311,7 @@ buildParams) {
|
|
|
309
311
|
error: `Component "${selector}" not found.${known ? ` Known components: ${known}` : " No components discovered."}`,
|
|
310
312
|
};
|
|
311
313
|
}
|
|
312
|
-
return { success: true, targets: [found] };
|
|
314
|
+
return { success: true, targets: [found], ...declared };
|
|
313
315
|
}
|
|
314
316
|
/**
|
|
315
317
|
* A list selector (`a,b,c`, #3950): the named components plus every component
|
|
@@ -410,6 +412,12 @@ export async function runComponents(path, selector, options = {}) {
|
|
|
410
412
|
const defaulted = resolved.targets.map((component) => applyConfigDefaults(component, config));
|
|
411
413
|
resolvedTargets = selector === "all" ? await withDeclaredReads(defaulted, registry, path) : defaulted;
|
|
412
414
|
}
|
|
415
|
+
if (options.prepare) {
|
|
416
|
+
const prepared = await options.prepare(resolvedTargets, { inputs: resolved.inputs ?? {} });
|
|
417
|
+
if ("error" in prepared)
|
|
418
|
+
return { success: false, selected: [], error: prepared.error };
|
|
419
|
+
resolvedTargets = prepared.components;
|
|
420
|
+
}
|
|
413
421
|
const selected = resolvedTargets.map((c) => c.name);
|
|
414
422
|
const narrowed = options.targets ?? {};
|
|
415
423
|
const outside = Object.keys(narrowed).filter((name) => !selected.includes(name));
|
|
@@ -184,6 +184,25 @@ export interface Component {
|
|
|
184
184
|
* environments are its member's, as before.
|
|
185
185
|
*/
|
|
186
186
|
environments?: ComponentEnvironmentDeclaration[];
|
|
187
|
+
/**
|
|
188
|
+
* Optional: what a deploy of this component is made from (#4695). A run
|
|
189
|
+
* under a release (`chant run --components --release`) skips the component
|
|
190
|
+
* when these are the same as in the release the environment runs it from,
|
|
191
|
+
* and records the skip; `--deploy-unchanged` deploys it anyway. Omitted, the
|
|
192
|
+
* component deploys with every release. See ./unchanged-inputs.ts.
|
|
193
|
+
*/
|
|
194
|
+
inputs?: ComponentInputs;
|
|
195
|
+
}
|
|
196
|
+
/** What a component's deploy is made from (#4695), compared between two releases. */
|
|
197
|
+
export interface ComponentInputs {
|
|
198
|
+
/**
|
|
199
|
+
* Git pathspecs, relative to the member's directory, such as
|
|
200
|
+
* `../crates/control` or `:(exclude)../web/e2e`. A change between the two
|
|
201
|
+
* releases' commits to a file they match deploys the component.
|
|
202
|
+
*/
|
|
203
|
+
paths?: string[];
|
|
204
|
+
/** Build parameters, by name. A value that differs between the two releases' targets for the environment deploys the component. */
|
|
205
|
+
params?: string[];
|
|
187
206
|
}
|
|
188
207
|
/** One environment a component declares it deploys to (#3153). */
|
|
189
208
|
export interface ComponentEnvironmentDeclaration {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../src/components/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,0DAA0D;AAC1D,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,kBAAkB,CAAC;AAEjE,4CAA4C;AAC5C,MAAM,WAAW,oBAAoB;IACnC,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9C;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,oBAAoB,CAAC;AAEnD,iCAAiC;AACjC,MAAM,WAAW,SAAS;IACxB,sGAAsG;IACtG,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEA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CAAC;IAChB,qGAAqG;IACrG,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wGAAwG;AACxG,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAE3G;AAED,+IAA+I;AAC/I,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAE1F;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,oBAAoB,CAE7E;AA6CD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,GAAG,QAAQ,CAAC,GAAG,SAAS,CAQxF;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAM3D;AAED,yPAAyP;AACzP,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAQ9D"}
|
|
@@ -77,6 +77,23 @@
|
|
|
77
77
|
"lifecycle": { "type": "string", "minLength": 1, "description": "The git remote this environment's approvals, effect receipts and ledger records are pushed to." }
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
},
|
|
81
|
+
"inputs": {
|
|
82
|
+
"type": "object",
|
|
83
|
+
"description": "Optional: what a deploy of this component is made from (#4695). A run under a release (chant run --components --release) skips the component when these are the same as in the release the environment runs it from, and records the skip; --deploy-unchanged deploys it anyway. Omitted, the component deploys with every release. Read by chant 0.124.65 and newer.",
|
|
84
|
+
"additionalProperties": false,
|
|
85
|
+
"properties": {
|
|
86
|
+
"paths": {
|
|
87
|
+
"type": "array",
|
|
88
|
+
"description": "Git pathspecs, relative to the member's directory, that the component is built and deployed from. A change to any file they match between the two releases' commits deploys it. Magic such as :(exclude) and :(top) is git's.",
|
|
89
|
+
"items": { "type": "string", "minLength": 1 }
|
|
90
|
+
},
|
|
91
|
+
"params": {
|
|
92
|
+
"type": "array",
|
|
93
|
+
"description": "Build parameters, by name, whose values in the environment's target the component deploys from. A value that differs between the two releases deploys it.",
|
|
94
|
+
"items": { "type": "string", "minLength": 1 }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
80
97
|
}
|
|
81
98
|
},
|
|
82
99
|
"$defs": {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* leaves have real implementations over an injectable `CloudExecutor` (#557);
|
|
5
5
|
* every other verb remains a typed stub. See https://intentius.io/chant/components/orchestration/
|
|
6
6
|
*/
|
|
7
|
-
export { type Archetype, type Wiring, type StackOutputReference, type BuildSpec, type Step, type Gate, type Phase, type Component, type ComponentEnvironmentDeclaration, phase, gate, stackOutput, inferArchetype, projectToJson, isComponent, } from "./component.js";
|
|
7
|
+
export { type Archetype, type Wiring, type StackOutputReference, type BuildSpec, type Step, type Gate, type Phase, type Component, type ComponentEnvironmentDeclaration, type ComponentInputs, phase, gate, stackOutput, inferArchetype, projectToJson, isComponent, } from "./component.js";
|
|
8
8
|
export { type DiscoveredComponent, type ComponentDiscoveryResult, discoverComponents, } from "./discover.js";
|
|
9
9
|
export { type ListedComponent, type ListComponentsResult, type DescribedComponent, type DescribeComponentResult, type ComponentGraphResult, type GenerateLexicon, type GenerateComponentsResult, type RunComponentsOptions, type RunComponentsResult, type ResolvedComponentTargets, listComponents, describeComponent, computeComponentGraph, generateComponentsPipeline, runComponents, findComponentGate, resolveComponentTargets, } from "./cli-support.js";
|
|
10
10
|
export { renderDriverHuman, renderDriverJson } from "./driver-output.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,+BAA+B,EACpC,KAAK,EACL,IAAI,EACJ,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,aAAa,EACb,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,6BAA6B,GAC9B,MAAM,cAAc,CAAC;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CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,+BAA+B,EACpC,KAAK,eAAe,EACpB,KAAK,EACL,IAAI,EACJ,WAAW,EACX,cAAc,EACd,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,aAAa,EACb,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACtE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,k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A0B,EAC1B,KAAK,gCAAgC,GACtC,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A run of a release's own artifacts (#4694): `chant run --components <c>
|
|
3
|
+
* --env <e> --release <label>` deploys what the cut recorded, without
|
|
4
|
+
* building it again.
|
|
5
|
+
*
|
|
6
|
+
* The run is at the release's commit (`resolveRunRelease`, ../cli/handlers/run.ts),
|
|
7
|
+
* so each component's composition is the one the cut compiled. Before
|
|
8
|
+
* anything runs, each component the release recorded an artifact for has its
|
|
9
|
+
* build steps (`BUILD_STEP_KINDS`) taken out, as a promote takes them out
|
|
10
|
+
* (`withoutBuildSteps`, ./promote.ts), and a step that reads the output of
|
|
11
|
+
* one is refused:
|
|
12
|
+
*
|
|
13
|
+
* - an image handed to the cut (`chant release cut --image`, the artifact's
|
|
14
|
+
* `ref`) is already in its registry. Each `release-image` step of the
|
|
15
|
+
* component is given it, and each publish step is replaced by a
|
|
16
|
+
* `release-image` step that hands on the same image, since there is no
|
|
17
|
+
* archive to publish from;
|
|
18
|
+
* - an archive the cut built is published from where the cut wrote it, so the
|
|
19
|
+
* publish step stays and reads that file. A run where the file is not there
|
|
20
|
+
* is refused.
|
|
21
|
+
*
|
|
22
|
+
* A component with build steps whose artifact the release did not record, and
|
|
23
|
+
* one with a `release-image` step when the release recorded no image for it,
|
|
24
|
+
* are refused: the first would build again, the second has no image to run.
|
|
25
|
+
* A component with neither build steps nor a `release-image` step runs as
|
|
26
|
+
* declared. Every refusal is returned before anything runs.
|
|
27
|
+
*/
|
|
28
|
+
import type { DriverComponent } from "./driver.js";
|
|
29
|
+
import type { Release } from "../lifecycle/release-store.js";
|
|
30
|
+
/** What a component's run under a release will do, for the run to print. */
|
|
31
|
+
export interface ReleaseRunNote {
|
|
32
|
+
component: string;
|
|
33
|
+
/** The build step kinds taken out. */
|
|
34
|
+
removed: string[];
|
|
35
|
+
/** The image the component runs, when one was handed to the cut. */
|
|
36
|
+
image?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The compositions to run under `release`, or every reason a component can't
|
|
40
|
+
* be run from it. `memberDir` is where the cut's archive paths are read from.
|
|
41
|
+
*/
|
|
42
|
+
export declare function releaseRunComponents(components: readonly DriverComponent[], release: Pick<Release, "releaseDigest" | "artifactDigests">, memberDir: string, label?: string | null): {
|
|
43
|
+
components: DriverComponent[];
|
|
44
|
+
notes: ReleaseRunNote[];
|
|
45
|
+
} | {
|
|
46
|
+
errors: string[];
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=release-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-run.d.ts","sourceRoot":"","sources":["../../src/components/release-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,OAAO,KAAK,EAAE,eAAe,EAAuC,MAAM,UAAU,CAAC;AACrF,OAAO,KAAK,EAAE,OAAO,EAAmB,MAAM,4BAA4B,CAAC;AA+E3E,4EAA4E;AAC5E,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,oEAAoE;IACpE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,EAAE,SAAS,eAAe,EAAE,EACtC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,iBAAiB,CAAC,EAC3D,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,MAAM,GAAG,IAAW,GAC1B;IAAE,UAAU,EAAE,eAAe,EAAE,CAAC;IAAC,KAAK,EAAE,cAAc,EAAE,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CA2DnF"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A run of a release's own artifacts (#4694): `chant run --components <c>
|
|
3
|
+
* --env <e> --release <label>` deploys what the cut recorded, without
|
|
4
|
+
* building it again.
|
|
5
|
+
*
|
|
6
|
+
* The run is at the release's commit (`resolveRunRelease`, ../cli/handlers/run.ts),
|
|
7
|
+
* so each component's composition is the one the cut compiled. Before
|
|
8
|
+
* anything runs, each component the release recorded an artifact for has its
|
|
9
|
+
* build steps (`BUILD_STEP_KINDS`) taken out, as a promote takes them out
|
|
10
|
+
* (`withoutBuildSteps`, ./promote.ts), and a step that reads the output of
|
|
11
|
+
* one is refused:
|
|
12
|
+
*
|
|
13
|
+
* - an image handed to the cut (`chant release cut --image`, the artifact's
|
|
14
|
+
* `ref`) is already in its registry. Each `release-image` step of the
|
|
15
|
+
* component is given it, and each publish step is replaced by a
|
|
16
|
+
* `release-image` step that hands on the same image, since there is no
|
|
17
|
+
* archive to publish from;
|
|
18
|
+
* - an archive the cut built is published from where the cut wrote it, so the
|
|
19
|
+
* publish step stays and reads that file. A run where the file is not there
|
|
20
|
+
* is refused.
|
|
21
|
+
*
|
|
22
|
+
* A component with build steps whose artifact the release did not record, and
|
|
23
|
+
* one with a `release-image` step when the release recorded no image for it,
|
|
24
|
+
* are refused: the first would build again, the second has no image to run.
|
|
25
|
+
* A component with neither build steps nor a `release-image` step runs as
|
|
26
|
+
* declared. Every refusal is returned before anything runs.
|
|
27
|
+
*/
|
|
28
|
+
import { existsSync } from "node:fs";
|
|
29
|
+
import { isAbsolute, resolve } from "node:path";
|
|
30
|
+
import { BUILD_STEP_KINDS, PUBLISH_STEP_KINDS } from "./promote.js";
|
|
31
|
+
import { parseWiringRef } from "../lint/rules/comp/support.js";
|
|
32
|
+
import { RELEASE_IMAGE_KIND } from "./verbs/release-image.js";
|
|
33
|
+
const isGate = (s) => s.kind === "gate";
|
|
34
|
+
const isPhase = (s) => typeof s.phase === "string" && Array.isArray(s.steps);
|
|
35
|
+
/** Every step of a composition, nested phases included. */
|
|
36
|
+
function stepsOf(phases) {
|
|
37
|
+
const out = [];
|
|
38
|
+
const walk = (phase) => {
|
|
39
|
+
for (const s of phase.steps) {
|
|
40
|
+
if (isPhase(s))
|
|
41
|
+
walk(s);
|
|
42
|
+
else if (!isGate(s))
|
|
43
|
+
out.push(s);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
phases.forEach(walk);
|
|
47
|
+
return out;
|
|
48
|
+
}
|
|
49
|
+
/** The same phases with every step `fn` maps, nested phases included. */
|
|
50
|
+
function mapSteps(phases, fn) {
|
|
51
|
+
const map = (phase) => ({
|
|
52
|
+
...phase,
|
|
53
|
+
steps: phase.steps.map((s) => (isPhase(s) ? map(s) : isGate(s) ? s : fn(s))),
|
|
54
|
+
});
|
|
55
|
+
return phases.map(map);
|
|
56
|
+
}
|
|
57
|
+
/** Every `@Phase.field` a step's fields read. */
|
|
58
|
+
function priorStepReads(step) {
|
|
59
|
+
const out = [];
|
|
60
|
+
const walk = (v) => {
|
|
61
|
+
if (typeof v === "string") {
|
|
62
|
+
const ref = parseWiringRef(v);
|
|
63
|
+
if (ref?.kind === "prior-step")
|
|
64
|
+
out.push({ phase: ref.phaseName, field: ref.field });
|
|
65
|
+
}
|
|
66
|
+
else if (Array.isArray(v))
|
|
67
|
+
v.forEach(walk);
|
|
68
|
+
else if (v && typeof v === "object" && !("stackOutput" in v))
|
|
69
|
+
Object.values(v).forEach(walk);
|
|
70
|
+
};
|
|
71
|
+
const { kind: _kind, ...fields } = step;
|
|
72
|
+
walk(fields);
|
|
73
|
+
return out;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* `component` without its build steps, a phase left with nothing dropped, or
|
|
77
|
+
* why it can't be: a step left reads an output of a phase that held only
|
|
78
|
+
* build steps.
|
|
79
|
+
*/
|
|
80
|
+
function withoutBuilds(component) {
|
|
81
|
+
const removed = [];
|
|
82
|
+
const emptied = new Set();
|
|
83
|
+
const strip = (phase) => {
|
|
84
|
+
const steps = [];
|
|
85
|
+
let lost = false;
|
|
86
|
+
for (const s of phase.steps) {
|
|
87
|
+
if (isPhase(s)) {
|
|
88
|
+
const nested = strip(s);
|
|
89
|
+
if (nested)
|
|
90
|
+
steps.push(nested);
|
|
91
|
+
}
|
|
92
|
+
else if (!isGate(s) && BUILD_STEP_KINDS.includes(s.kind)) {
|
|
93
|
+
removed.push(s.kind);
|
|
94
|
+
lost = true;
|
|
95
|
+
}
|
|
96
|
+
else
|
|
97
|
+
steps.push(s);
|
|
98
|
+
}
|
|
99
|
+
if (lost && !steps.some((s) => !isGate(s)))
|
|
100
|
+
emptied.add(phase.phase);
|
|
101
|
+
return steps.length > 0 ? { ...phase, steps } : undefined;
|
|
102
|
+
};
|
|
103
|
+
const deploy = component.deploy.map(strip).filter((p) => p !== undefined);
|
|
104
|
+
for (const step of stepsOf(deploy)) {
|
|
105
|
+
const read = priorStepReads(step).find((r) => emptied.has(r.phase));
|
|
106
|
+
if (read) {
|
|
107
|
+
return { error: `component "${component.name}" reads "@${read.phase}.${read.field}", an output of a build step a run under a release does not run` };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return { component: { ...component, deploy }, removed };
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The compositions to run under `release`, or every reason a component can't
|
|
114
|
+
* be run from it. `memberDir` is where the cut's archive paths are read from.
|
|
115
|
+
*/
|
|
116
|
+
export function releaseRunComponents(components, release, memberDir, label = null) {
|
|
117
|
+
const name = label ?? release.releaseDigest;
|
|
118
|
+
const errors = [];
|
|
119
|
+
const out = [];
|
|
120
|
+
const notes = [];
|
|
121
|
+
for (const component of components) {
|
|
122
|
+
const artifacts = release.artifactDigests.filter((a) => a.component === component.name);
|
|
123
|
+
const handed = artifacts.find((a) => typeof a.ref === "string");
|
|
124
|
+
const steps = stepsOf(component.deploy);
|
|
125
|
+
const builds = steps.some((s) => BUILD_STEP_KINDS.includes(s.kind));
|
|
126
|
+
const wantsImage = steps.some((s) => s.kind === RELEASE_IMAGE_KIND);
|
|
127
|
+
if (wantsImage && !handed) {
|
|
128
|
+
errors.push(`component "${component.name}" runs the image release ${name} recorded for it (a release-image step), and the release recorded none; ` +
|
|
129
|
+
`hand the cut its image: chant release cut <label> --image ${component.name}=<repository>@sha256:<hex>`);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (!builds && !handed) {
|
|
133
|
+
out.push(component);
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (artifacts.length === 0) {
|
|
137
|
+
errors.push(`component "${component.name}" builds an artifact, and release ${name} recorded none for it, so the run would build it again; ` +
|
|
138
|
+
`cut a release that builds it, or hand the cut its image with --image`);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (!handed) {
|
|
142
|
+
const missing = artifacts.filter((a) => a.path === "" || !existsSync(isAbsolute(a.path) ? a.path : resolve(memberDir, a.path)));
|
|
143
|
+
if (missing.length > 0) {
|
|
144
|
+
errors.push(`component "${component.name}": release ${name} built ${missing.map((a) => a.path || a.kind).join(", ")}, which is not here, so the run can't publish the release's own artifact; ` +
|
|
145
|
+
`run where the cut built it, or push the image and hand the cut its digest with --image`);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
// An image handed to the cut is in its registry already: a publish step hands it on rather than pushing an archive.
|
|
150
|
+
const filled = handed
|
|
151
|
+
? mapSteps(component.deploy, (s) => s.kind === RELEASE_IMAGE_KIND
|
|
152
|
+
? { ...s, uri: handed.ref, digest: handed.digest }
|
|
153
|
+
: PUBLISH_STEP_KINDS.includes(s.kind)
|
|
154
|
+
? { kind: RELEASE_IMAGE_KIND, uri: handed.ref, digest: handed.digest, replaces: s.kind }
|
|
155
|
+
: s)
|
|
156
|
+
: component.deploy;
|
|
157
|
+
const stripped = withoutBuilds({ ...component, deploy: filled });
|
|
158
|
+
if ("error" in stripped) {
|
|
159
|
+
errors.push(stripped.error);
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
out.push(stripped.component);
|
|
163
|
+
notes.push({ component: component.name, removed: stripped.removed, ...(handed ? { image: handed.ref } : {}) });
|
|
164
|
+
}
|
|
165
|
+
return errors.length > 0 ? { errors } : { components: out, notes };
|
|
166
|
+
}
|
|
@@ -45,6 +45,7 @@ export declare const STARTER_VERB_FAMILIES: {
|
|
|
45
45
|
readonly escapeHatch: readonly ["shell"];
|
|
46
46
|
readonly cloudflare: readonly ["wrangler-deploy", "wrangler-versions-promote", "r2-sync"];
|
|
47
47
|
readonly engineOutputs: readonly ["member-outputs"];
|
|
48
|
+
readonly release: readonly ["release-image"];
|
|
48
49
|
};
|
|
49
50
|
/**
|
|
50
51
|
* The built-in capability plugin carrying the entire Phase 1 starter verb
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"starter-plugin.d.ts","sourceRoot":"","sources":["../../src/components/starter-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;
|
|
1
|
+
{"version":3,"file":"starter-plugin.d.ts","sourceRoot":"","sources":["../../src/components/starter-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AA0BH,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE/E;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;aAChC,KAAK,YAAG,cAAc,EAAE,aAAa,EAAE,WAAW;aAIlD,IAAI,YAAG,eAAe;aAEtB,OAAO,YAAG,eAAe,EAAE,kBAAkB;aAC7C,mBAAmB,YAAG,MAAM,EAAE,mBAAmB,EAAE,QAAQ;aAC3D,iBAAiB,YAAG,sBAAsB,EAAE,WAAW;aAIvD,UAAU,YAAG,sBAAsB,EAAE,eAAe,EAAE,aAAa;aAGnE,OAAO,YAAG,eAAe;aACzB,WAAW,YAAG,OAAO;aAMrB,UAAU,YAAG,iBAAiB,EAAE,2BAA2B,EAAE,SAAS;aAItE,aAAa,YAAG,gBAAgB;aAGhC,OAAO,YAAG,eAAe;CACjB,CAAC;AAmCX;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAUrC,CAAC"}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* from verb modules, so neither needed to change for this migration —
|
|
26
26
|
* the compatibility guarantee #559 asks for.
|
|
27
27
|
*/
|
|
28
|
-
import { dockerBuildCapability, zipPackageCapability, jvmBuildCapability, generateSbomCapability, publishImageCapability, publishArtifactCapability, signCapability, attestProvenanceCapability, verifyCapability, scanVulnerabilitiesCapability, vulnGateCapability, waitClusterHealthyCapability, waitEndpointCapability, healthGateCapability, shellCapability, ensureSecretCapability, wranglerDeployCapability, wranglerVersionsPromoteCapability, r2SyncCapability, memberOutputsStarterCapability, } from "./verbs/index.js";
|
|
28
|
+
import { dockerBuildCapability, zipPackageCapability, jvmBuildCapability, generateSbomCapability, publishImageCapability, publishArtifactCapability, signCapability, attestProvenanceCapability, verifyCapability, scanVulnerabilitiesCapability, vulnGateCapability, waitClusterHealthyCapability, waitEndpointCapability, healthGateCapability, shellCapability, ensureSecretCapability, wranglerDeployCapability, wranglerVersionsPromoteCapability, r2SyncCapability, memberOutputsStarterCapability, releaseImageCapability, } from "./verbs/index.js";
|
|
29
29
|
import { ownPackageVersion } from "./capability-plugin.js";
|
|
30
30
|
/**
|
|
31
31
|
* Every `kind` in the starter verb set, grouped by family, per epic #551 and
|
|
@@ -63,6 +63,9 @@ export const STARTER_VERB_FAMILIES = {
|
|
|
63
63
|
// (#4455). One agnostic verb; each engine's lexicon contributes a source
|
|
64
64
|
// (`CapabilityPlugin.engineOutputSources`).
|
|
65
65
|
engineOutputs: ["member-outputs"],
|
|
66
|
+
// The image a release recorded for the component, handed to the cut by
|
|
67
|
+
// digest (#4694); a run under the release fills it in.
|
|
68
|
+
release: ["release-image"],
|
|
66
69
|
};
|
|
67
70
|
/**
|
|
68
71
|
* Every starter-set verb, in the same registration order Phase 1's
|
|
@@ -93,6 +96,7 @@ function starterCapabilities() {
|
|
|
93
96
|
wranglerVersionsPromoteCapability,
|
|
94
97
|
r2SyncCapability,
|
|
95
98
|
memberOutputsStarterCapability,
|
|
99
|
+
releaseImageCapability,
|
|
96
100
|
];
|
|
97
101
|
}
|
|
98
102
|
/**
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A component a release leaves alone (#4695): one whose declared inputs are
|
|
3
|
+
* the same as in the release the environment runs it from.
|
|
4
|
+
*
|
|
5
|
+
* Some deploys cost something even when nothing changed. Arugula's hub drops
|
|
6
|
+
* every relayed terminal when it restarts, and `fly-release` stamps each
|
|
7
|
+
* release's commit on the Machine, so every release would restart it. A
|
|
8
|
+
* component declares what it is made from (`inputs` on the component):
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* inputs: {
|
|
12
|
+
* paths: ["../crates/control", "../web", ":(exclude)../web/e2e", "../Cargo.lock", "src/control.component.ts", "src/control.fly.ts"],
|
|
13
|
+
* params: ["region"],
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* and a run under a release (`chant run --components --release`) compares
|
|
18
|
+
* them with the release named by the environment's latest record of the
|
|
19
|
+
* component. The component is unchanged when:
|
|
20
|
+
*
|
|
21
|
+
* - git sees no change between the two releases' commits to a file the
|
|
22
|
+
* `paths` match, read as pathspecs from the member's directory;
|
|
23
|
+
* - each of the `params` has the same value in the two releases' targets for
|
|
24
|
+
* the environment;
|
|
25
|
+
* - the deploy files the two targets record for the component
|
|
26
|
+
* (`releaseTemplatesDigest`) are the same, so a change to what the
|
|
27
|
+
* component deploys is never skipped for want of a listed path.
|
|
28
|
+
*
|
|
29
|
+
* Anything that can't be compared deploys: no record of the component in the
|
|
30
|
+
* environment, a record made from no release, a release that isn't stored, a
|
|
31
|
+
* commit git doesn't have. `--deploy-unchanged` deploys it anyway.
|
|
32
|
+
*
|
|
33
|
+
* A skip is recorded ({@link unchangedRecord}): a release record of this
|
|
34
|
+
* release for the component that repeats the digest of the deploy it keeps
|
|
35
|
+
* and names that deploy in `unchangedSince`.
|
|
36
|
+
*/
|
|
37
|
+
import type { ComponentInputs } from "./component.js";
|
|
38
|
+
import type { Release } from "../lifecycle/release-store.js";
|
|
39
|
+
import type { ReleaseRecord, ReleaseRecordInput, RunOrigin } from "../lifecycle/release-ledger.js";
|
|
40
|
+
/** The first chant that reads a component's `inputs` and writes `unchangedSince` on a release record (#4695). */
|
|
41
|
+
export declare const UNCHANGED_INPUTS_FLOOR = "0.124.65";
|
|
42
|
+
/** Whether a component's inputs are the same as in the release the environment runs it from. */
|
|
43
|
+
export type InputsVerdict = {
|
|
44
|
+
unchanged: true;
|
|
45
|
+
/** The environment's record of the deploy that stays. */
|
|
46
|
+
since: ReleaseRecord;
|
|
47
|
+
/** The environment's record already names this release: there is nothing new to record. */
|
|
48
|
+
recorded: boolean;
|
|
49
|
+
} | {
|
|
50
|
+
unchanged: false;
|
|
51
|
+
reason: string;
|
|
52
|
+
};
|
|
53
|
+
/** The files `paths` match that differ between two commits, or null when git can't tell. */
|
|
54
|
+
export type ChangedPaths = (from: string, to: string, paths: readonly string[]) => string[] | null;
|
|
55
|
+
/** {@link ChangedPaths} through `git diff`, with the pathspecs read from `memberDir`. */
|
|
56
|
+
export declare function gitChangedPaths(memberDir: string): ChangedPaths;
|
|
57
|
+
/** Compare `component`'s declared inputs in `release` with the release the environment's `current` record names. */
|
|
58
|
+
export declare function compareInputs(input: {
|
|
59
|
+
component: string;
|
|
60
|
+
inputs: ComponentInputs;
|
|
61
|
+
env: string;
|
|
62
|
+
release: Release;
|
|
63
|
+
/** The environment's latest record of the component, if it has one. */
|
|
64
|
+
current: ReleaseRecord | undefined;
|
|
65
|
+
readRelease: (digest: string) => Promise<Release | null>;
|
|
66
|
+
changedPaths: ChangedPaths;
|
|
67
|
+
}): Promise<InputsVerdict>;
|
|
68
|
+
/**
|
|
69
|
+
* The record of a skip (#4695): this release, for `since`'s component in its
|
|
70
|
+
* environment, repeating what that deploy recorded of its artifact and naming
|
|
71
|
+
* it in `unchangedSince`. Who approved that deploy is not repeated, since
|
|
72
|
+
* nothing was approved now.
|
|
73
|
+
*/
|
|
74
|
+
export declare function unchangedRecord(since: ReleaseRecord, run: {
|
|
75
|
+
releaseDigest: string;
|
|
76
|
+
runId: string;
|
|
77
|
+
runOrigin?: RunOrigin;
|
|
78
|
+
timestamp: string;
|
|
79
|
+
actor: string;
|
|
80
|
+
}): ReleaseRecordInput;
|
|
81
|
+
//# sourceMappingURL=unchanged-inputs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unchanged-inputs.d.ts","sourceRoot":"","sources":["../../src/components/unchanged-inputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAGhG,iHAAiH;AACjH,eAAO,MAAM,sBAAsB,aAAa,CAAC;AAEjD,gGAAgG;AAChG,MAAM,MAAM,aAAa,GACrB;IACE,SAAS,EAAE,IAAI,CAAC;IAChB,yDAAyD;IACzD,KAAK,EAAE,aAAa,CAAC;IACrB,2FAA2F;IAC3F,QAAQ,EAAE,OAAO,CAAC;CACnB,GACD;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC,4FAA4F;AAC5F,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,KAAK,MAAM,EAAE,GAAG,IAAI,CAAC;AAEnG,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAa/D;AAID,oHAAoH;AACpH,wBAAsB,aAAa,CAAC,KAAK,EAAE;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,eAAe,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IACnC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IACzD,YAAY,EAAE,YAAY,CAAC;CAC5B,GAAG,OAAO,CAAC,aAAa,CAAC,CAiCzB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrG,kBAAkB,CAiBpB"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A component a release leaves alone (#4695): one whose declared inputs are
|
|
3
|
+
* the same as in the release the environment runs it from.
|
|
4
|
+
*
|
|
5
|
+
* Some deploys cost something even when nothing changed. Arugula's hub drops
|
|
6
|
+
* every relayed terminal when it restarts, and `fly-release` stamps each
|
|
7
|
+
* release's commit on the Machine, so every release would restart it. A
|
|
8
|
+
* component declares what it is made from (`inputs` on the component):
|
|
9
|
+
*
|
|
10
|
+
* ```ts
|
|
11
|
+
* inputs: {
|
|
12
|
+
* paths: ["../crates/control", "../web", ":(exclude)../web/e2e", "../Cargo.lock", "src/control.component.ts", "src/control.fly.ts"],
|
|
13
|
+
* params: ["region"],
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* and a run under a release (`chant run --components --release`) compares
|
|
18
|
+
* them with the release named by the environment's latest record of the
|
|
19
|
+
* component. The component is unchanged when:
|
|
20
|
+
*
|
|
21
|
+
* - git sees no change between the two releases' commits to a file the
|
|
22
|
+
* `paths` match, read as pathspecs from the member's directory;
|
|
23
|
+
* - each of the `params` has the same value in the two releases' targets for
|
|
24
|
+
* the environment;
|
|
25
|
+
* - the deploy files the two targets record for the component
|
|
26
|
+
* (`releaseTemplatesDigest`) are the same, so a change to what the
|
|
27
|
+
* component deploys is never skipped for want of a listed path.
|
|
28
|
+
*
|
|
29
|
+
* Anything that can't be compared deploys: no record of the component in the
|
|
30
|
+
* environment, a record made from no release, a release that isn't stored, a
|
|
31
|
+
* commit git doesn't have. `--deploy-unchanged` deploys it anyway.
|
|
32
|
+
*
|
|
33
|
+
* A skip is recorded ({@link unchangedRecord}): a release record of this
|
|
34
|
+
* release for the component that repeats the digest of the deploy it keeps
|
|
35
|
+
* and names that deploy in `unchangedSince`.
|
|
36
|
+
*/
|
|
37
|
+
import { execFileSync } from "node:child_process";
|
|
38
|
+
import { releaseTemplatesDigest } from "./release-promote.js";
|
|
39
|
+
/** The first chant that reads a component's `inputs` and writes `unchangedSince` on a release record (#4695). */
|
|
40
|
+
export const UNCHANGED_INPUTS_FLOOR = "0.124.65";
|
|
41
|
+
/** {@link ChangedPaths} through `git diff`, with the pathspecs read from `memberDir`. */
|
|
42
|
+
export function gitChangedPaths(memberDir) {
|
|
43
|
+
return (from, to, paths) => {
|
|
44
|
+
try {
|
|
45
|
+
const out = execFileSync("git", ["diff", "--name-only", "--no-renames", from, to, "--", ...paths], {
|
|
46
|
+
cwd: memberDir,
|
|
47
|
+
encoding: "utf-8",
|
|
48
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
49
|
+
});
|
|
50
|
+
return out.split("\n").filter((l) => l !== "");
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
const shortDigest = (d) => d.replace(/^jcs1-sha256:/, "").slice(0, 12);
|
|
58
|
+
/** Compare `component`'s declared inputs in `release` with the release the environment's `current` record names. */
|
|
59
|
+
export async function compareInputs(input) {
|
|
60
|
+
const { component, inputs, env, release, current } = input;
|
|
61
|
+
const paths = inputs.paths ?? [];
|
|
62
|
+
const params = inputs.params ?? [];
|
|
63
|
+
if (paths.length === 0 && params.length === 0)
|
|
64
|
+
return { unchanged: false, reason: "it declares no paths or params in inputs" };
|
|
65
|
+
if (!current)
|
|
66
|
+
return { unchanged: false, reason: `"${env}" has no deploy of it` };
|
|
67
|
+
if (current.releaseDigest === undefined)
|
|
68
|
+
return { unchanged: false, reason: `the deploy "${env}" runs (run ${current.runId}) was not made from a release` };
|
|
69
|
+
if (current.releaseDigest === release.releaseDigest)
|
|
70
|
+
return { unchanged: true, since: current, recorded: true };
|
|
71
|
+
const prior = await input.readRelease(current.releaseDigest).catch(() => null);
|
|
72
|
+
if (!prior)
|
|
73
|
+
return { unchanged: false, reason: `release ${shortDigest(current.releaseDigest)}, which "${env}" runs it from, is not stored here` };
|
|
74
|
+
const before = prior.targets.find((t) => t.env === env);
|
|
75
|
+
const now = release.targets.find((t) => t.env === env);
|
|
76
|
+
if (!before || !now)
|
|
77
|
+
return { unchanged: false, reason: `release ${shortDigest((before ? release : prior).releaseDigest)} has no target for "${env}"` };
|
|
78
|
+
for (const name of params) {
|
|
79
|
+
const a = before.params.find((p) => p.name === name)?.value;
|
|
80
|
+
const b = now.params.find((p) => p.name === name)?.value;
|
|
81
|
+
if (a !== b)
|
|
82
|
+
return { unchanged: false, reason: `param ${name} is ${JSON.stringify(b)}, was ${JSON.stringify(a)}` };
|
|
83
|
+
}
|
|
84
|
+
if (releaseTemplatesDigest(before, component) !== releaseTemplatesDigest(now, component)) {
|
|
85
|
+
return { unchanged: false, reason: `the files its deploy reads in the "${env}" target changed` };
|
|
86
|
+
}
|
|
87
|
+
if (paths.length > 0 && prior.commit !== release.commit) {
|
|
88
|
+
const changed = input.changedPaths(prior.commit, release.commit, paths);
|
|
89
|
+
if (changed === null) {
|
|
90
|
+
return { unchanged: false, reason: `git can't compare ${prior.commit.slice(0, 12)} and ${release.commit.slice(0, 12)} here; fetch the history between them` };
|
|
91
|
+
}
|
|
92
|
+
if (changed.length > 0) {
|
|
93
|
+
return { unchanged: false, reason: `${changed.length} input file(s) changed since ${prior.commit.slice(0, 12)}, such as ${changed[0]}` };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return { unchanged: true, since: current, recorded: false };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The record of a skip (#4695): this release, for `since`'s component in its
|
|
100
|
+
* environment, repeating what that deploy recorded of its artifact and naming
|
|
101
|
+
* it in `unchangedSince`. Who approved that deploy is not repeated, since
|
|
102
|
+
* nothing was approved now.
|
|
103
|
+
*/
|
|
104
|
+
export function unchangedRecord(since, run) {
|
|
105
|
+
return {
|
|
106
|
+
component: since.component,
|
|
107
|
+
env: since.env,
|
|
108
|
+
digest: since.digest,
|
|
109
|
+
gitSha: since.gitSha,
|
|
110
|
+
...(since.manifestDigest !== undefined ? { manifestDigest: since.manifestDigest } : {}),
|
|
111
|
+
...(since.inputDigest !== undefined ? { inputDigest: since.inputDigest } : {}),
|
|
112
|
+
...(since.digestKind !== undefined ? { digestKind: since.digestKind } : {}),
|
|
113
|
+
...(since.releaseVersion !== undefined ? { releaseVersion: since.releaseVersion } : {}),
|
|
114
|
+
runId: run.runId,
|
|
115
|
+
...(run.runOrigin ? { runOrigin: run.runOrigin } : {}),
|
|
116
|
+
timestamp: run.timestamp,
|
|
117
|
+
actor: run.actor,
|
|
118
|
+
releaseDigest: run.releaseDigest,
|
|
119
|
+
unchangedSince: { env: since.env, runId: since.runId, timestamp: since.timestamp },
|
|
120
|
+
};
|
|
121
|
+
}
|
|
@@ -53,6 +53,7 @@ export * from "./run-agent.js";
|
|
|
53
53
|
export * from "./wrangler.js";
|
|
54
54
|
export * from "./r2-sync.js";
|
|
55
55
|
export * from "./member-outputs.js";
|
|
56
|
+
export * from "./release-image.js";
|
|
56
57
|
export * from "./vuln-scan.js";
|
|
57
58
|
export * from "./vex.js";
|
|
58
59
|
export * from "./license-policy.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/verbs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/verbs/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,QAAQ,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
|
|
@@ -53,6 +53,7 @@ export * from "./run-agent.js";
|
|
|
53
53
|
export * from "./wrangler.js";
|
|
54
54
|
export * from "./r2-sync.js";
|
|
55
55
|
export * from "./member-outputs.js";
|
|
56
|
+
export * from "./release-image.js";
|
|
56
57
|
export * from "./vuln-scan.js";
|
|
57
58
|
export * from "./vex.js";
|
|
58
59
|
export * from "./license-policy.js";
|