@intentius/chant 0.124.103 → 0.124.104
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/audit/secrets.d.ts +6 -0
- package/dist/audit/secrets.js +9 -2
- package/dist/cli/commands/import-index.d.ts +15 -0
- package/dist/cli/commands/import-index.js +37 -3
- package/dist/cli/handlers/lifecycle.js +6 -0
- package/dist/cli/handlers/release-config.d.ts +15 -0
- package/dist/cli/handlers/release-config.js +58 -0
- package/dist/cli/handlers/release.js +36 -3
- package/dist/cli/main.js +12 -2
- package/dist/cli/parse-args.js +7 -0
- package/dist/cli/registry.d.ts +2 -0
- package/dist/cli/release-commands/cut.js +3 -0
- package/dist/config-import.js +26 -4
- package/dist/config.d.ts +14 -0
- package/dist/config.js +4 -0
- package/dist/floor-table.data.js +7 -6
- package/dist/floor-table.js +3 -1
- package/dist/graph-refs.d.ts +9 -0
- package/dist/graph-refs.js +9 -7
- package/dist/lifecycle/cloud-index.d.ts +6 -0
- package/dist/lifecycle/cloud-index.js +32 -5
- package/dist/lifecycle/identity-match.d.ts +18 -2
- package/dist/lifecycle/identity-match.js +10 -5
- package/dist/lifecycle/index-drift.d.ts +13 -0
- package/dist/lifecycle/index-drift.js +21 -3
- package/dist/lifecycle/index-import.d.ts +15 -0
- package/dist/lifecycle/index-import.js +25 -2
- package/dist/lifecycle/index-join.d.ts +1 -1
- package/dist/lifecycle/index-join.js +1 -1
- package/dist/lifecycle/publish-declaration.d.ts +6 -0
- package/dist/lifecycle/publish-declaration.js +18 -1
- package/dist/lifecycle/publish-forge.d.ts +2 -0
- package/dist/lifecycle/publish-forge.js +3 -1
- package/dist/lifecycle/publish-oci.d.ts +27 -0
- package/dist/lifecycle/publish-oci.js +63 -8
- package/dist/lifecycle/release-changelog.d.ts +18 -5
- package/dist/lifecycle/release-changelog.js +22 -10
- package/dist/lifecycle/release-cut.d.ts +13 -1
- package/dist/lifecycle/release-cut.js +3 -0
- package/dist/lifecycle/release-images.d.ts +32 -2
- package/dist/lifecycle/release-images.js +70 -2
- package/dist/lifecycle/release-init-goreleaser-images.d.ts +21 -0
- package/dist/lifecycle/release-init-goreleaser-images.js +160 -0
- package/dist/lifecycle/release-init.d.ts +22 -0
- package/dist/lifecycle/release-init.js +86 -7
- package/dist/local-chant.d.ts +3 -0
- package/dist/local-chant.js +28 -2
- package/dist/release-floors.d.ts +10 -6
- package/dist/release-floors.js +10 -6
- package/dist/ts-loader.d.ts +12 -3
- package/dist/ts-loader.js +27 -11
- package/dist/wave-runtime.mjs +291 -290
- package/dist/workspace/catalog-edges.d.ts +22 -0
- package/dist/workspace/catalog-edges.js +23 -0
- package/dist/workspace/release-steps/goreleaser.d.ts +6 -3
- package/dist/workspace/release-steps/goreleaser.js +12 -6
- package/dist/workspace/release-toolchains.d.ts +6 -0
- package/dist/workspace/release-toolchains.js +8 -0
- package/dist/workspace/release-train-workflow.d.ts +18 -0
- package/dist/workspace/release-train-workflow.js +135 -7
- package/dist/workspace/release-train.js +1 -1
- package/dist/workspace/release-workflow.d.ts +26 -0
- package/dist/workspace/release-workflow.js +60 -12
- package/dist/workspace/train-artifacts.js +3 -4
- package/dist/workspace/train-cut.d.ts +22 -1
- package/dist/workspace/train-cut.js +78 -14
- package/package.json +2 -2
package/dist/graph-refs.js
CHANGED
|
@@ -491,7 +491,7 @@ export function reconstructIdentityEdges(nodes, owners, scopeOf, existing = [])
|
|
|
491
491
|
const sorted = [...nodes].sort((a, b) => byString(a.id, b.id));
|
|
492
492
|
const ownerBy = new Map(owners.map((o) => [o.lexicon, o]));
|
|
493
493
|
const keyOf = (scope, value) => `${scope.account}\u0000${scope.region ?? ""}\u0000${value}`;
|
|
494
|
-
// key -> node id -> the rule that names it
|
|
494
|
+
// key -> node id -> the rule that names it, and the paths it names the node at
|
|
495
495
|
const index = new Map();
|
|
496
496
|
const own = new Map();
|
|
497
497
|
for (const node of sorted) {
|
|
@@ -501,15 +501,15 @@ export function reconstructIdentityEdges(nodes, owners, scopeOf, existing = [])
|
|
|
501
501
|
const scope = scopeOf(node);
|
|
502
502
|
const values = (owner.identities ?? defaultNodeIdentities)(node);
|
|
503
503
|
own.set(node.id, new Set(values.map((v) => v.value)));
|
|
504
|
-
for (const { kind, value } of values) {
|
|
504
|
+
for (const { kind, value, paths } of values) {
|
|
505
505
|
if (!identityCandidateValue(value))
|
|
506
506
|
continue;
|
|
507
507
|
const k = keyOf(scope, value);
|
|
508
508
|
const m = index.get(k) ?? index.set(k, new Map()).get(k);
|
|
509
509
|
const rule = identityMatchRuleId(owner.lexicon, node.kind, kind);
|
|
510
510
|
const prev = m.get(node.id);
|
|
511
|
-
if (prev === undefined || byString(rule, prev) < 0)
|
|
512
|
-
m.set(node.id, rule);
|
|
511
|
+
if (prev === undefined || byString(rule, prev.rule) < 0)
|
|
512
|
+
m.set(node.id, { rule, paths });
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
const joined = new Set(existing.map((e) => `${e.from}|${e.to}`));
|
|
@@ -523,10 +523,12 @@ export function reconstructIdentityEdges(nodes, owners, scopeOf, existing = [])
|
|
|
523
523
|
if (!identityCandidateValue(value) || mine.has(value))
|
|
524
524
|
continue;
|
|
525
525
|
const found = new Map();
|
|
526
|
-
for (const k of keys(value))
|
|
527
|
-
for (const [id, rule] of index.get(k) ?? [])
|
|
528
|
-
if (id !== holder.id)
|
|
526
|
+
for (const k of keys(value)) {
|
|
527
|
+
for (const [id, { rule, paths }] of index.get(k) ?? []) {
|
|
528
|
+
if (id !== holder.id && (paths === undefined || paths.some((p) => path === p || path.endsWith(`.${p}`))))
|
|
529
529
|
found.set(id, rule);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
530
532
|
if (found.size === 0)
|
|
531
533
|
continue;
|
|
532
534
|
if (found.size > 1) {
|
|
@@ -145,6 +145,12 @@ export interface IndexSummary {
|
|
|
145
145
|
notObserved: number;
|
|
146
146
|
};
|
|
147
147
|
notes: string[];
|
|
148
|
+
/** The same notes with their kind and, where there is one, the command to run yourself. */
|
|
149
|
+
noteDetails: Array<{
|
|
150
|
+
kind?: string;
|
|
151
|
+
message: string;
|
|
152
|
+
command?: string;
|
|
153
|
+
}>;
|
|
148
154
|
}
|
|
149
155
|
export interface RunCloudIndexOptions extends IndexCloudDeps {
|
|
150
156
|
/** The command name in messages: `chant index` (default) or `behold index`. */
|
|
@@ -477,6 +477,31 @@ export async function substrateLexicons(substrate) {
|
|
|
477
477
|
}
|
|
478
478
|
return { lexicons: [plugin] };
|
|
479
479
|
}
|
|
480
|
+
/** A kind that repeats more than this many times prints as one line with a count. */
|
|
481
|
+
const NOTE_REPEAT_LIMIT = 3;
|
|
482
|
+
/** The note lines the CLI prints: a command goes under its note, a long run of one kind collapses to a count. */
|
|
483
|
+
function noteLines(details) {
|
|
484
|
+
const byKind = new Map();
|
|
485
|
+
for (const n of details)
|
|
486
|
+
if (n.kind)
|
|
487
|
+
byKind.set(n.kind, (byKind.get(n.kind) ?? 0) + 1);
|
|
488
|
+
const lines = [];
|
|
489
|
+
const seen = new Set();
|
|
490
|
+
for (const n of details) {
|
|
491
|
+
const count = n.kind ? (byKind.get(n.kind) ?? 0) : 0;
|
|
492
|
+
if (n.kind && count > NOTE_REPEAT_LIMIT) {
|
|
493
|
+
if (seen.has(n.kind))
|
|
494
|
+
continue;
|
|
495
|
+
seen.add(n.kind);
|
|
496
|
+
lines.push(` note: ${count} ${n.kind} notes, for example: ${n.message}\n (all ${count} are in the stored version and in --json)\n`);
|
|
497
|
+
continue;
|
|
498
|
+
}
|
|
499
|
+
lines.push(` note: ${n.message}\n`);
|
|
500
|
+
if (n.command)
|
|
501
|
+
lines.push(` run: ${n.command}\n`);
|
|
502
|
+
}
|
|
503
|
+
return lines;
|
|
504
|
+
}
|
|
480
505
|
function summarize(doc) {
|
|
481
506
|
const nodes = doc.graph.nodes;
|
|
482
507
|
const unmapped = nodes.filter((n) => n.unmappedKind === true).length;
|
|
@@ -571,11 +596,12 @@ export async function runCloudIndex(argv, opts = {}) {
|
|
|
571
596
|
return 1;
|
|
572
597
|
}
|
|
573
598
|
const { doc, write } = result;
|
|
574
|
-
const
|
|
599
|
+
const noteDetails = [];
|
|
575
600
|
if (lex.note)
|
|
576
|
-
|
|
601
|
+
noteDetails.push({ message: lex.note });
|
|
577
602
|
for (const n of doc.notes ?? [])
|
|
578
|
-
|
|
603
|
+
noteDetails.push({ kind: n.kind, message: n.message, ...(n.command ? { command: n.command } : {}) });
|
|
604
|
+
const notes = noteDetails.map((n) => n.message);
|
|
579
605
|
const version = write.path ? basename(write.path) : undefined;
|
|
580
606
|
const summary = {
|
|
581
607
|
substrate: args.substrate,
|
|
@@ -590,6 +616,7 @@ export async function runCloudIndex(argv, opts = {}) {
|
|
|
590
616
|
...(write.reason ? { reason: write.reason } : {}),
|
|
591
617
|
...summarize(doc),
|
|
592
618
|
notes,
|
|
619
|
+
noteDetails,
|
|
593
620
|
};
|
|
594
621
|
if (args.json) {
|
|
595
622
|
out(`${JSON.stringify(summary, null, 2)}\n`);
|
|
@@ -597,8 +624,8 @@ export async function runCloudIndex(argv, opts = {}) {
|
|
|
597
624
|
else {
|
|
598
625
|
out(`${args.substrate} ${scope.scopeId}: ${summary.nodes} nodes (${summary.typed} typed, ${summary.unmapped} of unknown kind), ${summary.derivedEdges} derived edges\n`);
|
|
599
626
|
out(`coverage: ${summary.coverage.listed} (type, location) listed, ${summary.coverage.notObserved} not observed\n`);
|
|
600
|
-
for (const
|
|
601
|
-
out(
|
|
627
|
+
for (const line of noteLines(noteDetails))
|
|
628
|
+
out(line);
|
|
602
629
|
if (write.written)
|
|
603
630
|
out(`${command}: wrote ${version} under ${summary.scopeKey} in ${store.where}\n`);
|
|
604
631
|
else
|
|
@@ -39,14 +39,21 @@ export type DeclaredIdentity = {
|
|
|
39
39
|
kind: "identifier";
|
|
40
40
|
/** The inventory API's type name the identifier belongs to (the CloudFormation type for aws). */
|
|
41
41
|
listedType: string;
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* The identifier as the index's `nativeId` spells it (Cloud Control's,
|
|
44
|
+
* `|`-joined for a multi-part one), or as the lexicon's
|
|
45
|
+
* {@link IndexIdentity.nodeKey} spells a node's key.
|
|
46
|
+
*/
|
|
43
47
|
identifier: string;
|
|
44
48
|
/** A global type is indexed once per account at location `global`. */
|
|
45
49
|
global: boolean;
|
|
46
50
|
/**
|
|
47
51
|
* The location the declaration itself names, ahead of the entity's
|
|
48
52
|
* region: a Kubernetes namespace, or `cluster` for a cluster-scoped
|
|
49
|
-
* kind.
|
|
53
|
+
* kind. `"*"` matches the identifier at every location, for a
|
|
54
|
+
* declaration whose location is not a literal (an Azure resource that
|
|
55
|
+
* takes its resource group's), and absence is then read from the
|
|
56
|
+
* coverage at `*`. Absent: `global` or the region.
|
|
50
57
|
*/
|
|
51
58
|
location?: string;
|
|
52
59
|
/**
|
|
@@ -78,6 +85,13 @@ export interface IndexIdentity {
|
|
|
78
85
|
* Absent: its native id and its ARN cloud ids.
|
|
79
86
|
*/
|
|
80
87
|
nodeIdentities?(node: IRNode): NodeIdentityValue[];
|
|
88
|
+
/**
|
|
89
|
+
* The value a declared identifier is compared with, for a substrate whose
|
|
90
|
+
* native id holds parts no declaration spells: the resource group in an
|
|
91
|
+
* Azure id, the project and location in a GCP asset name. Undefined leaves
|
|
92
|
+
* the node out of the match. Absent: its native id.
|
|
93
|
+
*/
|
|
94
|
+
nodeKey?(node: IRNode): string | undefined;
|
|
81
95
|
}
|
|
82
96
|
/** One declared entity, as the build output names it. */
|
|
83
97
|
export interface DeclaredEntity {
|
|
@@ -126,6 +140,8 @@ export interface MatchOptions {
|
|
|
126
140
|
/** The region of an entity that names none. */
|
|
127
141
|
region?: string;
|
|
128
142
|
}
|
|
143
|
+
/** A declared location that matches every indexed location ({@link DeclaredIdentity}). */
|
|
144
|
+
export declare const ANY_LOCATION = "*";
|
|
129
145
|
/**
|
|
130
146
|
* Whether the index looked at (type, location), from its coverage. `listed`
|
|
131
147
|
* means a missing node is absent; anything else is a reason it is not
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { indexCoverageFor } from "./index-document.js";
|
|
2
2
|
const byString = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
3
|
+
/** A declared location that matches every indexed location ({@link DeclaredIdentity}). */
|
|
4
|
+
export const ANY_LOCATION = "*";
|
|
3
5
|
/** The documents must be cloud reads of one substrate, one account and one read, or a candidate from another read would bind. */
|
|
4
6
|
function cloudScopes(docs, substrate) {
|
|
5
7
|
const scopes = [];
|
|
@@ -80,17 +82,20 @@ export function matchDeclaredToIndex(entities, docs, identity, options = {}) {
|
|
|
80
82
|
// listedType -> nativeId -> nodes, and the same keyed by lexicon kind
|
|
81
83
|
const byIdentity = new Map();
|
|
82
84
|
const byKind = new Map();
|
|
83
|
-
const add = (index, t, n) => {
|
|
85
|
+
const add = (index, t, key, n) => {
|
|
84
86
|
const m = index.get(t) ?? index.set(t, new Map()).get(t);
|
|
85
|
-
(m.get(
|
|
87
|
+
(m.get(key) ?? m.set(key, []).get(key)).push(n);
|
|
86
88
|
};
|
|
87
89
|
for (const d of docs) {
|
|
88
90
|
for (const n of d.graph.nodes) {
|
|
89
91
|
if (n.nativeId === undefined)
|
|
90
92
|
continue;
|
|
91
|
-
|
|
93
|
+
const key = identity.nodeKey ? identity.nodeKey(n) : n.nativeId;
|
|
94
|
+
if (key === undefined)
|
|
95
|
+
continue;
|
|
96
|
+
add(byIdentity, listedTypeOf(n), key, n);
|
|
92
97
|
if (!n.unmappedKind)
|
|
93
|
-
add(byKind, n.kind, n);
|
|
98
|
+
add(byKind, n.kind, key, n);
|
|
94
99
|
}
|
|
95
100
|
}
|
|
96
101
|
const matches = {};
|
|
@@ -105,7 +110,7 @@ export function matchDeclaredToIndex(entities, docs, identity, options = {}) {
|
|
|
105
110
|
const region = entity.region ?? options.region;
|
|
106
111
|
const location = declared.location ?? (declared.global ? "global" : region);
|
|
107
112
|
const all = (declared.entityKind !== undefined ? byKind.get(declared.entityKind) : byIdentity.get(listedType))?.get(identifier) ?? [];
|
|
108
|
-
const inScope = location === undefined ? all : all.filter((n) => n.location === location);
|
|
113
|
+
const inScope = location === undefined || location === ANY_LOCATION ? all : all.filter((n) => n.location === location);
|
|
109
114
|
const candidates = [...new Set(inScope.map((n) => n.id))].sort(byString);
|
|
110
115
|
if (candidates.length > 1) {
|
|
111
116
|
matches[entity.name] = {
|
|
@@ -15,6 +15,13 @@
|
|
|
15
15
|
* and the observation baseline (`.chant/observation-baseline/<env>.json`,
|
|
16
16
|
* #4519) subtracted, value-bound. An accepted deviation stays quiet until
|
|
17
17
|
* the indexed value moves again.
|
|
18
|
+
*
|
|
19
|
+
* The index carries what the provider's listing returned, which is often
|
|
20
|
+
* a few properties per type (Cloud Control's `ListResources` gives a role
|
|
21
|
+
* its name and path, not its trust policy). A declared top-level property
|
|
22
|
+
* the indexed node does not carry was never observed, so it is left out
|
|
23
|
+
* of the comparison and reported as not observed, never as drift to
|
|
24
|
+
* `<absent>`. The record says so in `attributesUnobserved`.
|
|
18
25
|
* 3. Every row becomes one drift record (`drift: "v1"`, ../drift-record.ts).
|
|
19
26
|
*
|
|
20
27
|
* A row that is not bound is reported with its join verdict and never
|
|
@@ -83,6 +90,12 @@ export interface IndexDriftLexiconResult {
|
|
|
83
90
|
joins: Record<string, IndexJoin>;
|
|
84
91
|
/** The deep diff over the bound rows only. Unbound rows are never in it. */
|
|
85
92
|
deep: DeepDiffResult;
|
|
93
|
+
/**
|
|
94
|
+
* Per bound row, the declared top-level properties its indexed node does
|
|
95
|
+
* not carry, sorted. They were left out of {@link deep}: the index never
|
|
96
|
+
* observed them. Rows with none are not listed.
|
|
97
|
+
*/
|
|
98
|
+
unobservedProperties: Record<string, string[]>;
|
|
86
99
|
}
|
|
87
100
|
export interface IndexDriftCounts {
|
|
88
101
|
/** Declared entities compared. */
|
|
@@ -86,6 +86,7 @@ export function diffDeclaredAgainstIndex(input) {
|
|
|
86
86
|
// The bound rows are the observed side, each its indexed node's tree.
|
|
87
87
|
const bound = new Map();
|
|
88
88
|
const resources = {};
|
|
89
|
+
const unobservedProperties = {};
|
|
89
90
|
for (const [name, entity] of entities) {
|
|
90
91
|
const j = joins[name];
|
|
91
92
|
if (j?.verdict !== "bound")
|
|
@@ -93,11 +94,24 @@ export function diffDeclaredAgainstIndex(input) {
|
|
|
93
94
|
const hit = indexed.get(j.node);
|
|
94
95
|
if (!hit)
|
|
95
96
|
continue;
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
const attrs = (hit.attrs ?? {});
|
|
98
|
+
// Only what the index observed is compared: a declared property the
|
|
99
|
+
// listing never returned is unknown, not removed.
|
|
100
|
+
const props = {};
|
|
101
|
+
const missing = [];
|
|
102
|
+
for (const [key, value] of Object.entries(entity.props ?? {})) {
|
|
103
|
+
if (Object.prototype.hasOwnProperty.call(attrs, key))
|
|
104
|
+
props[key] = value;
|
|
105
|
+
else
|
|
106
|
+
missing.push(key);
|
|
107
|
+
}
|
|
108
|
+
if (missing.length > 0)
|
|
109
|
+
unobservedProperties[name] = missing.sort();
|
|
110
|
+
bound.set(name, { ...entity, props });
|
|
111
|
+
resources[name] = { type: entity.entityType, physicalId: hit.physicalId ?? j.nativeId, properties: attrs };
|
|
98
112
|
}
|
|
99
113
|
const deep = diffDeepObservation(bound, { resources, unobserved: {} }, plugin.deepNormalizationHooks, baselineForLexicon(input.baseline, lexicon));
|
|
100
|
-
byLexicon[lexicon] = { joins, deep };
|
|
114
|
+
byLexicon[lexicon] = { joins, deep, unobservedProperties };
|
|
101
115
|
// Bound rows: the deep diff's records, and in-sync for a row whose every
|
|
102
116
|
// difference is accepted (the deep diff lists it under neither).
|
|
103
117
|
const deepRecords = new Map(deepDiffDriftRecords({ ...adapter, diff: deep, command }).map((r) => [r.address, r]));
|
|
@@ -109,6 +123,7 @@ export function diffDeclaredAgainstIndex(input) {
|
|
|
109
123
|
if (j?.verdict === "bound" && bound.has(name)) {
|
|
110
124
|
counts.bound++;
|
|
111
125
|
const r = deepRecords.get(name);
|
|
126
|
+
const missing = unobservedProperties[name];
|
|
112
127
|
records.push(driftRecord({
|
|
113
128
|
...(r ?? {
|
|
114
129
|
member: input.member,
|
|
@@ -122,6 +137,9 @@ export function diffDeclaredAgainstIndex(input) {
|
|
|
122
137
|
address: address(name),
|
|
123
138
|
...at,
|
|
124
139
|
resourceType: entity.entityType,
|
|
140
|
+
...(missing
|
|
141
|
+
? { attributesUnobserved: { reason: "not-reached", detail: `the index does not carry ${missing.join(", ")}; compared only the properties it holds` } }
|
|
142
|
+
: {}),
|
|
125
143
|
}));
|
|
126
144
|
continue;
|
|
127
145
|
}
|
|
@@ -34,12 +34,16 @@ export interface IndexImportCodegen {
|
|
|
34
34
|
* `DeletionPolicy: Retain` on every imported resource, #4536). `notes`
|
|
35
35
|
* go into the file's header comment after the logical id (the k8s
|
|
36
36
|
* lexicon names the keys of a Secret it writes as a referenced secret).
|
|
37
|
+
* `missing` names the top-level properties the type requires that the
|
|
38
|
+
* node's attrs do not hold; each becomes a parameter from
|
|
39
|
+
* {@link requiredParameter}.
|
|
37
40
|
*/
|
|
38
41
|
resource(node: IRNode): {
|
|
39
42
|
type: string;
|
|
40
43
|
properties: Record<string, unknown>;
|
|
41
44
|
attributes?: Record<string, unknown>;
|
|
42
45
|
notes?: readonly string[];
|
|
46
|
+
missing?: readonly string[];
|
|
43
47
|
} | {
|
|
44
48
|
unsupported: string;
|
|
45
49
|
};
|
|
@@ -55,6 +59,15 @@ export interface IndexImportCodegen {
|
|
|
55
59
|
logicalId: string;
|
|
56
60
|
path: string;
|
|
57
61
|
}): ParameterIR;
|
|
62
|
+
/**
|
|
63
|
+
* The parameter that stands in for a required property the listing did
|
|
64
|
+
* not hold. Absent: such a property is named in the header only.
|
|
65
|
+
*/
|
|
66
|
+
requiredParameter?(name: string, context: {
|
|
67
|
+
node: IRNode;
|
|
68
|
+
logicalId: string;
|
|
69
|
+
path: string;
|
|
70
|
+
}): ParameterIR;
|
|
58
71
|
/** A reference to that parameter, as a property value in this lexicon's IR. */
|
|
59
72
|
parameterReference(name: string): unknown;
|
|
60
73
|
/** The type's short name for logical ids (`Bucket` for `AWS::S3::Bucket`). Absent: the kind's last segment. */
|
|
@@ -107,6 +120,8 @@ export interface IndexImportParameterReport {
|
|
|
107
120
|
node: string;
|
|
108
121
|
path: string;
|
|
109
122
|
group: string;
|
|
123
|
+
/** Why the value is a parameter: `masked` in the index, or a required property the listing did not hold. */
|
|
124
|
+
cause: "masked" | "missing";
|
|
110
125
|
}
|
|
111
126
|
/** The import report (`chant-index-import.json`), deterministic for one index and selection. */
|
|
112
127
|
export interface IndexImportReport {
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
* comment in the file names the edge and why;
|
|
24
24
|
* - a value the listing masked (`[REDACTED]`) is never written. Each one
|
|
25
25
|
* becomes a parameter to fill in;
|
|
26
|
+
* - a property the lexicon requires that the listing does not hold (a
|
|
27
|
+
* listing returns part of a resource's model) becomes a parameter to fill
|
|
28
|
+
* in too, with a header line saying so, rather than source that leaves it
|
|
29
|
+
* out;
|
|
26
30
|
* - output is deterministic: nodes, edges, parameters and logical ids are
|
|
27
31
|
* ordered by id, so the same index and selection give the same IR, and the
|
|
28
32
|
* same files.
|
|
@@ -357,6 +361,7 @@ export function planIndexImport(docs, selection, lexicons, options = {}) {
|
|
|
357
361
|
properties: r.properties,
|
|
358
362
|
...(r.attributes ? { attributes: r.attributes } : {}),
|
|
359
363
|
...(r.notes && r.notes.length > 0 ? { notes: r.notes } : {}),
|
|
364
|
+
...(r.missing && r.missing.length > 0 ? { missing: [...new Set(r.missing)].sort(byString) } : {}),
|
|
360
365
|
});
|
|
361
366
|
}
|
|
362
367
|
// Groups: lexicon + location. Global nodes join their lexicon's only regional group, when there is one.
|
|
@@ -465,17 +470,35 @@ export function planIndexImport(docs, selection, lexicons, options = {}) {
|
|
|
465
470
|
references.push({ path: at, target: e.to, ...(e.rule ? { rule: e.rule } : {}), written: "reference" });
|
|
466
471
|
}
|
|
467
472
|
const params = [];
|
|
468
|
-
|
|
473
|
+
const parameterName = (at) => {
|
|
469
474
|
let name = `${logicalId}${pascalWords(at)}`;
|
|
470
475
|
for (let i = 2; usedParams.has(name); i++)
|
|
471
476
|
name = `${logicalId}${pascalWords(at)}${i}`;
|
|
472
477
|
usedParams.add(name);
|
|
478
|
+
return name;
|
|
479
|
+
};
|
|
480
|
+
for (const { at, parts } of maskedPaths(props)) {
|
|
481
|
+
const name = parameterName(at);
|
|
473
482
|
parameters.push(w.codegen.secretParameter(name, { node: w.node, logicalId, path: at }));
|
|
474
483
|
props = setExact(props, parts, w.codegen.parameterReference(name));
|
|
475
484
|
params.push(name);
|
|
476
|
-
parameterReports.push({ name, node: w.node.id, path: at, group: dir });
|
|
485
|
+
parameterReports.push({ name, node: w.node.id, path: at, group: dir, cause: "masked" });
|
|
477
486
|
header.push(`${logicalId}.${at} was masked in the index; fill in the parameter ${name}`);
|
|
478
487
|
}
|
|
488
|
+
for (const at of w.missing ?? []) {
|
|
489
|
+
if (props[at] !== undefined)
|
|
490
|
+
continue;
|
|
491
|
+
if (!w.codegen.requiredParameter) {
|
|
492
|
+
header.push(`${logicalId}.${at} is required and the index listing did not hold it; add it before building`);
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
const name = parameterName(at);
|
|
496
|
+
parameters.push(w.codegen.requiredParameter(name, { node: w.node, logicalId, path: at }));
|
|
497
|
+
props = { ...props, [at]: w.codegen.parameterReference(name) };
|
|
498
|
+
params.push(name);
|
|
499
|
+
parameterReports.push({ name, node: w.node.id, path: at, group: dir, cause: "missing" });
|
|
500
|
+
header.push(`${logicalId}.${at} is required and the index listing did not hold it; fill in the parameter ${name}`);
|
|
501
|
+
}
|
|
479
502
|
if (references.length > 0)
|
|
480
503
|
report.references = references;
|
|
481
504
|
if (params.length > 0)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* `--live` lays a live read over it (`sourceOverlayGraphs`).
|
|
15
15
|
*
|
|
16
16
|
* The join goes through each lexicon's own index match, its plugin's
|
|
17
|
-
* `indexIdentity` (#4523, ./identity-match.ts). aws
|
|
17
|
+
* `indexIdentity` (#4523, ./identity-match.ts). aws, k8s, gcp and azure have one; a lexicon with
|
|
18
18
|
* none gets `not-observed`, reason `unsupported-kind`, on every row, never a
|
|
19
19
|
* guessed match. The verdicts:
|
|
20
20
|
*
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* `--live` lays a live read over it (`sourceOverlayGraphs`).
|
|
15
15
|
*
|
|
16
16
|
* The join goes through each lexicon's own index match, its plugin's
|
|
17
|
-
* `indexIdentity` (#4523, ./identity-match.ts). aws
|
|
17
|
+
* `indexIdentity` (#4523, ./identity-match.ts). aws, k8s, gcp and azure have one; a lexicon with
|
|
18
18
|
* none gets `not-observed`, reason `unsupported-kind`, on every row, never a
|
|
19
19
|
* guessed match. The verdicts:
|
|
20
20
|
*
|
|
@@ -55,6 +55,7 @@ export declare const OciPublishSchema: z.ZodObject<{
|
|
|
55
55
|
image: z.ZodString;
|
|
56
56
|
repository: z.ZodString;
|
|
57
57
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
platformTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
59
|
usernameEnv: z.ZodOptional<z.ZodString>;
|
|
59
60
|
passwordEnv: z.ZodOptional<z.ZodString>;
|
|
60
61
|
sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
@@ -79,6 +80,8 @@ export declare const ForgePublishSchema: z.ZodObject<{
|
|
|
79
80
|
forge: "forge";
|
|
80
81
|
}>>;
|
|
81
82
|
types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
83
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
84
|
+
nonConventional: z.ZodOptional<z.ZodBoolean>;
|
|
82
85
|
before: z.ZodOptional<z.ZodString>;
|
|
83
86
|
after: z.ZodOptional<z.ZodString>;
|
|
84
87
|
}, z.core.$strict>>;
|
|
@@ -336,6 +339,7 @@ export declare const PublishDeclarationSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
336
339
|
image: z.ZodString;
|
|
337
340
|
repository: z.ZodString;
|
|
338
341
|
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
342
|
+
platformTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
339
343
|
usernameEnv: z.ZodOptional<z.ZodString>;
|
|
340
344
|
passwordEnv: z.ZodOptional<z.ZodString>;
|
|
341
345
|
sbom: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodLiteral<false>]>>;
|
|
@@ -358,6 +362,8 @@ export declare const PublishDeclarationSchema: z.ZodDiscriminatedUnion<[z.ZodObj
|
|
|
358
362
|
forge: "forge";
|
|
359
363
|
}>>;
|
|
360
364
|
types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
365
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
366
|
+
nonConventional: z.ZodOptional<z.ZodBoolean>;
|
|
361
367
|
before: z.ZodOptional<z.ZodString>;
|
|
362
368
|
after: z.ZodOptional<z.ZodString>;
|
|
363
369
|
}, z.core.$strict>>;
|
|
@@ -91,8 +91,18 @@ export const OciPublishSchema = z
|
|
|
91
91
|
image: z.string().min(1),
|
|
92
92
|
/** `<registry host>/<name>`, such as `ghcr.io/acme/api` or `docker.io/acme/api`. */
|
|
93
93
|
repository: z.string().min(1),
|
|
94
|
-
/** Tags to point at the pushed digest. `{label}` is the release's label. Default: `["{label}"]`, or none for a release with no label. */
|
|
94
|
+
/** Tags to point at the pushed digest. `{label}` is the release's label and `{version}` the label from its first digit (#5269). Default: `["{label}"]`, or none for a release with no label. */
|
|
95
95
|
tags: z.array(z.string().min(1)).optional(),
|
|
96
|
+
/**
|
|
97
|
+
* Tags for each platform's image in an index (#5269), such as `["{label}-{arch}"]`: `{arch}` is the
|
|
98
|
+
* platform's architecture with its variant (`amd64`, `arm64`, `armv7`), `{os}` its OS and `{label}` the
|
|
99
|
+
* release's label (`{version}`, the label from its first digit). Each names `{label}` or `{version}`, so it
|
|
100
|
+
* belongs to the release and no status change moves it.
|
|
101
|
+
*/
|
|
102
|
+
platformTags: z
|
|
103
|
+
.array(z.string().min(1).refine((t) => (t.includes("{label}") || t.includes("{version}")) && t.includes("{arch}"), { message: "a platform tag names {arch} and {label} or {version}, such as {label}-{arch}" }))
|
|
104
|
+
.min(1)
|
|
105
|
+
.optional(),
|
|
96
106
|
/** The variable holding the registry user name. Default `OCI_USERNAME`. */
|
|
97
107
|
usernameEnv: envName.optional(),
|
|
98
108
|
/** The variable holding the registry password or token. Default `OCI_PASSWORD`. */
|
|
@@ -139,6 +149,10 @@ export const ForgePublishSchema = z
|
|
|
139
149
|
generate: z.enum(["forge", "commits"]).optional(),
|
|
140
150
|
/** With `generate: "commits"`: the commit types listed. Default `feat`, `fix` and `perf`. A breaking change is listed whatever its type; `*` lists every commit. */
|
|
141
151
|
types: z.array(z.string().min(1)).min(1).optional(),
|
|
152
|
+
/** With `generate: "commits"`, instead of `types` (#5270): the commit types left out, such as `docs`, `test` and `chore`; every other commit is listed, conventional or not. */
|
|
153
|
+
exclude: z.array(z.string().regex(/^\w+$/, "a commit type, such as docs")).min(1).optional(),
|
|
154
|
+
/** With `generate: "commits"` (#5270): list the commits whose subject is not conventional. Default `true` with `exclude` or `types: ["*"]`, `false` with a list of types. */
|
|
155
|
+
nonConventional: z.boolean().optional(),
|
|
142
156
|
/** A paragraph before the notes, with the same placeholders. */
|
|
143
157
|
before: z.string().min(1).optional(),
|
|
144
158
|
/** A paragraph after the notes, with the same placeholders. */
|
|
@@ -148,6 +162,9 @@ export const ForgePublishSchema = z
|
|
|
148
162
|
.refine((n) => (n.file === undefined) === (n.heading === undefined), { message: "notes.file and notes.heading go together", path: ["heading"] })
|
|
149
163
|
.refine((n) => n.file !== undefined || n.generate !== undefined, { message: "notes need a file section, generate, or both", path: ["generate"] })
|
|
150
164
|
.refine((n) => n.types === undefined || n.generate === "commits", { message: 'notes.types applies to generate: "commits"', path: ["types"] })
|
|
165
|
+
.refine((n) => n.exclude === undefined || n.generate === "commits", { message: 'notes.exclude applies to generate: "commits"', path: ["exclude"] })
|
|
166
|
+
.refine((n) => n.nonConventional === undefined || n.generate === "commits", { message: 'notes.nonConventional applies to generate: "commits"', path: ["nonConventional"] })
|
|
167
|
+
.refine((n) => n.exclude === undefined || n.types === undefined, { message: "notes.types lists types and notes.exclude leaves them out: name one", path: ["exclude"] })
|
|
151
168
|
.optional(),
|
|
152
169
|
/** The forge release's tag. Default: the tag the cut made, from `release.tag` (#5150; `release/<label>` or `release/<member>/<label>` when unset). */
|
|
153
170
|
tag: z.string().min(1).optional(),
|
|
@@ -67,6 +67,8 @@ export declare const PUBLISH_FORGE_LATEST_FLOOR = "0.124.63";
|
|
|
67
67
|
export declare const PUBLISH_FORGE_NOTES_FLOOR = "0.124.71";
|
|
68
68
|
/** The first chant whose forge target generates notes, `notes.generate` (#5153). Products feature-detect on it. */
|
|
69
69
|
export declare const PUBLISH_FORGE_GENERATED_NOTES_FLOOR = "0.124.101";
|
|
70
|
+
/** The first chant whose forge target's notes from commits take `exclude` and `nonConventional` (#5270). */
|
|
71
|
+
export declare const PUBLISH_FORGE_NOTES_EXCLUDE_FLOOR = "0.124.104";
|
|
70
72
|
/**
|
|
71
73
|
* The section of `page` that starts at the heading `heading` names (#4658),
|
|
72
74
|
* up to the next heading of the same level or higher, trimmed. A heading
|
|
@@ -76,6 +76,8 @@ export const PUBLISH_FORGE_LATEST_FLOOR = "0.124.63";
|
|
|
76
76
|
export const PUBLISH_FORGE_NOTES_FLOOR = "0.124.71";
|
|
77
77
|
/** The first chant whose forge target generates notes, `notes.generate` (#5153). Products feature-detect on it. */
|
|
78
78
|
export const PUBLISH_FORGE_GENERATED_NOTES_FLOOR = "0.124.101";
|
|
79
|
+
/** The first chant whose forge target's notes from commits take `exclude` and `nonConventional` (#5270). */
|
|
80
|
+
export const PUBLISH_FORGE_NOTES_EXCLUDE_FLOOR = "0.124.104";
|
|
79
81
|
/** `text` with `{label}`, `{version}` and `{tag}` filled in. */
|
|
80
82
|
function fillNotesText(text, values) {
|
|
81
83
|
return text.replaceAll("{label}", values.label).replaceAll("{version}", values.version).replaceAll("{tag}", values.tag);
|
|
@@ -500,7 +502,7 @@ export function forgeTarget(decl, deps) {
|
|
|
500
502
|
const previous = await previousMemberRelease(ctx, decl.forge);
|
|
501
503
|
if (n.generate === "commits") {
|
|
502
504
|
// #5159: the summaries of the intent files the cut consumed come first.
|
|
503
|
-
generated = [await consumedIntentNotes(ctx), changelogNotes(memberCommits(ctx, previous?.commit ?? null, decl.forge), n.types)].filter((p) => p.length > 0).join("\n\n");
|
|
505
|
+
generated = [await consumedIntentNotes(ctx), changelogNotes(memberCommits(ctx, previous?.commit ?? null, decl.forge), { ...(n.types ? { types: n.types } : {}), ...(n.exclude ? { exclude: n.exclude } : {}), ...(n.nonConventional !== undefined ? { nonConventional: n.nonConventional } : {}) })].filter((p) => p.length > 0).join("\n\n");
|
|
504
506
|
}
|
|
505
507
|
else {
|
|
506
508
|
// #5150: the previous release's tag is the one release.tag gives its label, as the cut made it.
|
|
@@ -46,6 +46,8 @@ import { type Attachment } from "./publish-attachments.js";
|
|
|
46
46
|
import { type Credential } from "./publish-credentials.js";
|
|
47
47
|
import type { OciPublishDeclaration } from "./publish-declaration.js";
|
|
48
48
|
import { type PublishContext, type PublishContextBase, type PublishDeps, type PublishFetch, type PublishTarget } from "./release-publish.js";
|
|
49
|
+
/** The first chant whose oci target takes `platformTags`, a tag for each platform's image in the index (#5269). */
|
|
50
|
+
export declare const OCI_PLATFORM_TAGS_FLOOR = "0.124.104";
|
|
49
51
|
/** A repository reference split into where the registry is and the name in it. */
|
|
50
52
|
export interface OciRepository {
|
|
51
53
|
/** The host as written, used to find docker config credentials. */
|
|
@@ -56,6 +58,17 @@ export interface OciRepository {
|
|
|
56
58
|
name: string;
|
|
57
59
|
}
|
|
58
60
|
export declare function parseRepository(repository: string): OciRepository;
|
|
61
|
+
interface Descriptor {
|
|
62
|
+
mediaType: string;
|
|
63
|
+
digest: string;
|
|
64
|
+
size?: number;
|
|
65
|
+
/** An index entry's platform. */
|
|
66
|
+
platform?: {
|
|
67
|
+
os?: string;
|
|
68
|
+
architecture?: string;
|
|
69
|
+
variant?: string;
|
|
70
|
+
};
|
|
71
|
+
}
|
|
59
72
|
/** The credential for `repo`: the declared variables, else the docker config's `auths` entry. */
|
|
60
73
|
export declare function ociCredential(decl: Pick<OciPublishDeclaration, "usernameEnv" | "passwordEnv">, repo: OciRepository, ctx: Pick<PublishContext, "env" | "redactor">): {
|
|
61
74
|
username: string;
|
|
@@ -143,6 +156,20 @@ export declare function referrerManifest(a: Attachment, subject: {
|
|
|
143
156
|
digest: string;
|
|
144
157
|
size: number;
|
|
145
158
|
}): Uint8Array;
|
|
159
|
+
/**
|
|
160
|
+
* The tag of each platform's image (#5269): `platformTags` with `{label}`,
|
|
161
|
+
* `{version}`, `{os}` and `{arch}` (the architecture and its variant, `armv7`) filled in
|
|
162
|
+
* for each image of the layout's index, from the index entry's platform or
|
|
163
|
+
* else the image's config. None for a release with no label. Two images
|
|
164
|
+
* that would take one tag are refused.
|
|
165
|
+
*/
|
|
166
|
+
export declare function ociPlatformTags(decl: Pick<OciPublishDeclaration, "platformTags" | "image">, label: string | null, manifests: ReadonlyArray<{
|
|
167
|
+
digest: string;
|
|
168
|
+
platform?: Descriptor["platform"];
|
|
169
|
+
}>, configPlatform?: (digest: string) => Descriptor["platform"]): Array<{
|
|
170
|
+
tag: string;
|
|
171
|
+
digest: string;
|
|
172
|
+
}>;
|
|
146
173
|
/** The tags to point at the digest: the context's tag when set, else the declared ones with `{label}` filled in, without `latest` for a prerelease label. */
|
|
147
174
|
export declare function ociTags(decl: OciPublishDeclaration, ctx: Pick<PublishContext, "tag" | "label">): string[];
|
|
148
175
|
/** The digest an OCI archive (a layout directory or a tar file of one) is pushed under: its top manifest's (#4657). */
|