@intentius/chant 0.124.103 → 0.124.105
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/capabilities/templates.d.ts +66 -3
- package/dist/capabilities/templates.js +220 -81
- 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-doctor.js +8 -3
- package/dist/cli/handlers/release-init.js +7 -4
- package/dist/cli/handlers/release.js +36 -3
- package/dist/cli/handlers/search.d.ts +1 -1
- package/dist/cli/handlers/search.js +24 -2
- package/dist/cli/main.js +12 -2
- package/dist/cli/parse-args.js +9 -2
- package/dist/cli/registry.d.ts +2 -0
- package/dist/cli/release-commands/cut.js +3 -0
- package/dist/cli/release-commands/doctor.js +5 -2
- package/dist/cloud-lister/aws.d.ts +9 -0
- package/dist/cloud-lister/aws.js +20 -0
- package/dist/config-import.js +26 -4
- package/dist/config.d.ts +24 -0
- package/dist/config.js +6 -0
- package/dist/floor-table.data.js +8 -6
- package/dist/floor-table.js +3 -1
- package/dist/graph-refs.d.ts +22 -0
- package/dist/graph-refs.js +20 -11
- package/dist/lifecycle/cloud-index.d.ts +6 -0
- package/dist/lifecycle/cloud-index.js +32 -5
- package/dist/lifecycle/derive-edges.d.ts +1 -1
- package/dist/lifecycle/derive-edges.js +5 -3
- 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 +24 -2
- package/dist/lifecycle/index-import.js +61 -9
- 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-artifacts.js +3 -1
- package/dist/lifecycle/release-at.d.ts +5 -1
- package/dist/lifecycle/release-at.js +69 -4
- 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-doctor.d.ts +10 -0
- package/dist/lifecycle/release-doctor.js +84 -14
- package/dist/lifecycle/release-green.d.ts +5 -2
- package/dist/lifecycle/release-green.js +40 -8
- package/dist/lifecycle/release-images.d.ts +39 -3
- package/dist/lifecycle/release-images.js +84 -7
- 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 +38 -7
- package/dist/lifecycle/release-init.js +298 -52
- package/dist/lifecycle/release-next.d.ts +1 -1
- package/dist/lifecycle/release-next.js +9 -4
- 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 +292 -291
- package/dist/workspace/capabilities-contract.d.ts +15 -5
- package/dist/workspace/capabilities-contract.js +7 -4
- package/dist/workspace/capabilities.schema.json +45 -1
- package/dist/workspace/catalog-edges.d.ts +22 -0
- package/dist/workspace/catalog-edges.js +23 -0
- package/dist/workspace/release-changed.d.ts +2 -0
- package/dist/workspace/release-changed.js +7 -2
- package/dist/workspace/release-steps/doctor.js +2 -1
- 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 +80 -16
- package/package.json +2 -2
|
@@ -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). */
|
|
@@ -53,6 +53,8 @@ import { bytesDigest, checkReleaseDigest, fileDigest, isDir, memberFile, publish
|
|
|
53
53
|
import { trainName, waitUntilServed } from "./publish-train-names.js";
|
|
54
54
|
import { PublishTargetError } from "./release-publish.js";
|
|
55
55
|
import { prereleaseOf } from "./release-prerelease.js";
|
|
56
|
+
/** The first chant whose oci target takes `platformTags`, a tag for each platform's image in the index (#5269). */
|
|
57
|
+
export const OCI_PLATFORM_TAGS_FLOOR = "0.124.104";
|
|
56
58
|
const INDEX_TYPES = new Set(["application/vnd.oci.image.index.v1+json", "application/vnd.docker.distribution.manifest.list.v2+json"]);
|
|
57
59
|
export function parseRepository(repository) {
|
|
58
60
|
const parts = repository.split("/");
|
|
@@ -410,12 +412,49 @@ export function referrerManifest(a, subject) {
|
|
|
410
412
|
};
|
|
411
413
|
return new Uint8Array(Buffer.from(JSON.stringify(manifest)));
|
|
412
414
|
}
|
|
415
|
+
/**
|
|
416
|
+
* The tag of each platform's image (#5269): `platformTags` with `{label}`,
|
|
417
|
+
* `{version}`, `{os}` and `{arch}` (the architecture and its variant, `armv7`) filled in
|
|
418
|
+
* for each image of the layout's index, from the index entry's platform or
|
|
419
|
+
* else the image's config. None for a release with no label. Two images
|
|
420
|
+
* that would take one tag are refused.
|
|
421
|
+
*/
|
|
422
|
+
export function ociPlatformTags(decl, label, manifests, configPlatform = () => undefined) {
|
|
423
|
+
if (!decl.platformTags || label === null)
|
|
424
|
+
return [];
|
|
425
|
+
const out = [];
|
|
426
|
+
const taken = new Map();
|
|
427
|
+
for (const m of manifests) {
|
|
428
|
+
const p = m.platform ?? configPlatform(m.digest);
|
|
429
|
+
if (!p?.architecture || p.architecture === "unknown")
|
|
430
|
+
continue;
|
|
431
|
+
const arch = `${p.architecture}${p.variant ?? ""}`;
|
|
432
|
+
for (const t of decl.platformTags) {
|
|
433
|
+
const tag = fillTag(t, label).split("{arch}").join(arch).split("{os}").join(p.os ?? "");
|
|
434
|
+
const other = taken.get(tag);
|
|
435
|
+
if (other !== undefined && other !== m.digest) {
|
|
436
|
+
throw new PublishTargetError("publish-oci-platform-tag-taken", `${decl.image} holds two images that platformTags would both tag ${tag}`, "Name {os} in platformTags as well, or build one image per platform.");
|
|
437
|
+
}
|
|
438
|
+
if (other === undefined)
|
|
439
|
+
out.push({ tag, digest: m.digest });
|
|
440
|
+
taken.set(tag, m.digest);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return out;
|
|
444
|
+
}
|
|
445
|
+
/** A tag that names the release, by `{label}` or `{version}` (#5269), and so belongs to it. */
|
|
446
|
+
const namesRelease = (t) => t.includes("{label}") || t.includes("{version}");
|
|
447
|
+
/** `t` with `{label}` and `{version}` (the label from its first digit, #5269) filled in. */
|
|
448
|
+
function fillTag(t, label) {
|
|
449
|
+
const at = label.search(/\d/);
|
|
450
|
+
return t.split("{label}").join(label).split("{version}").join(at >= 0 ? label.slice(at) : label);
|
|
451
|
+
}
|
|
413
452
|
/** 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. */
|
|
414
453
|
export function ociTags(decl, ctx) {
|
|
415
454
|
if (ctx.tag)
|
|
416
455
|
return [ctx.tag];
|
|
417
456
|
const declared = decl.tags ?? (ctx.label ? ["{label}"] : []);
|
|
418
|
-
const tags = declared.filter((t) => ctx.label !== null || !t
|
|
457
|
+
const tags = declared.filter((t) => ctx.label !== null || !namesRelease(t)).map((t) => (ctx.label === null ? t : fillTag(t, ctx.label)));
|
|
419
458
|
// A prerelease label moves no `latest`; what is left is its own label tag.
|
|
420
459
|
if (prereleaseOf(ctx.label) === null)
|
|
421
460
|
return tags;
|
|
@@ -441,7 +480,7 @@ export function ociArchiveDigest(abs) {
|
|
|
441
480
|
export function ociMovingTags(decl, channel, label = null) {
|
|
442
481
|
if (channel)
|
|
443
482
|
return [channel];
|
|
444
|
-
const moving = (decl.tags ?? ["{label}"]).filter((t) => !t
|
|
483
|
+
const moving = (decl.tags ?? ["{label}"]).filter((t) => !namesRelease(t));
|
|
445
484
|
return prereleaseOf(label) === null ? moving : moving.filter((t) => t !== "latest");
|
|
446
485
|
}
|
|
447
486
|
export function ociTarget(decl, deps) {
|
|
@@ -460,8 +499,17 @@ export function ociTarget(decl, deps) {
|
|
|
460
499
|
}
|
|
461
500
|
return layout;
|
|
462
501
|
};
|
|
463
|
-
|
|
464
|
-
|
|
502
|
+
/** #5269: each platform's image's tags, from the layout. */
|
|
503
|
+
const platformTags = (ctx, layout) => ociPlatformTags(decl, ctx.label, layout.manifests, (digest) => {
|
|
504
|
+
const m = layout.manifests.find((x) => x.digest === digest);
|
|
505
|
+
const config = m?.blobs[0];
|
|
506
|
+
if (!config)
|
|
507
|
+
return undefined;
|
|
508
|
+
const c = JSON.parse(Buffer.from(layout.readBlob(config.digest)).toString("utf-8"));
|
|
509
|
+
return { ...(c.os ? { os: c.os } : {}), ...(c.architecture ? { architecture: c.architecture } : {}), ...(c.variant ? { variant: c.variant } : {}) };
|
|
510
|
+
});
|
|
511
|
+
const item = (ctx, digest, perPlatform = []) => {
|
|
512
|
+
const tags = [...ociTags(decl, ctx), ...perPlatform.map((p) => p.tag)];
|
|
465
513
|
return {
|
|
466
514
|
name: `${decl.image}${tags.length > 0 ? ` (tag${tags.length === 1 ? "" : "s"} ${tags.join(", ")})` : ""}`,
|
|
467
515
|
destination: `${decl.repository}@${digest}`,
|
|
@@ -548,7 +596,7 @@ export function ociTarget(decl, deps) {
|
|
|
548
596
|
const label = ctx.label;
|
|
549
597
|
if (label === null)
|
|
550
598
|
return null;
|
|
551
|
-
const tags = (decl.tags ?? ["{label}"]).filter(
|
|
599
|
+
const tags = (decl.tags ?? ["{label}"]).filter(namesRelease).map((t) => fillTag(t, label));
|
|
552
600
|
if (tags.length === 0)
|
|
553
601
|
return null;
|
|
554
602
|
const { registry } = connect(ctx);
|
|
@@ -632,7 +680,7 @@ export function ociTarget(decl, deps) {
|
|
|
632
680
|
async plan(ctx) {
|
|
633
681
|
const layout = inspect(ctx);
|
|
634
682
|
try {
|
|
635
|
-
return [item(ctx, layout.top.digest), ...referrers(ctx, layout).map(referrerItem), ...(ctx.signing ? signatures.map((s) => signatureItem(ctx, s, layout.top.digest)) : [])];
|
|
683
|
+
return [item(ctx, layout.top.digest, platformTags(ctx, layout)), ...referrers(ctx, layout).map(referrerItem), ...(ctx.signing ? signatures.map((s) => signatureItem(ctx, s, layout.top.digest)) : [])];
|
|
636
684
|
}
|
|
637
685
|
finally {
|
|
638
686
|
layout.cleanup();
|
|
@@ -643,7 +691,7 @@ export function ociTarget(decl, deps) {
|
|
|
643
691
|
try {
|
|
644
692
|
const attached = referrers(ctx, layout);
|
|
645
693
|
const { cred, registry } = connect(ctx);
|
|
646
|
-
const staged = { ...item(ctx, layout.top.digest), name: decl.image };
|
|
694
|
+
const staged = { ...item(ctx, layout.top.digest, platformTags(ctx, layout)), name: decl.image };
|
|
647
695
|
const items = [];
|
|
648
696
|
if (await registry.hasManifest(layout.top.digest, layout.top.mediaType)) {
|
|
649
697
|
ctx.log(`${decl.repository} already holds ${layout.top.digest}; the image is not pushed again`);
|
|
@@ -691,8 +739,15 @@ export function ociTarget(decl, deps) {
|
|
|
691
739
|
for (const t of tags)
|
|
692
740
|
await registry.putManifest(t, layout.top.mediaType, layout.top.bytes);
|
|
693
741
|
ctx.log(tags.length > 0 ? `tagged ${layout.top.digest} ${tags.join(", ")}` : `no tag to point at ${layout.top.digest}`);
|
|
742
|
+
// #5269: each platform's image under its own tag, pushed by digest in the stage.
|
|
743
|
+
const perPlatform = platformTags(ctx, layout);
|
|
744
|
+
for (const p of perPlatform) {
|
|
745
|
+
const m = layout.manifests.find((x) => x.digest === p.digest);
|
|
746
|
+
await registry.putManifest(p.tag, m.mediaType, m.bytes);
|
|
747
|
+
ctx.log(`tagged ${p.digest} ${p.tag}`);
|
|
748
|
+
}
|
|
694
749
|
const signed = (staged?.items ?? []).filter((i) => i.attachment === "signature" || i.attachment === "attestation").map(({ present: _present, ...i }) => i);
|
|
695
|
-
return { target: this.name, destination: this.destination, items: [item(ctx, layout.top.digest), ...referrers(ctx, layout).map(referrerItem), ...signed] };
|
|
750
|
+
return { target: this.name, destination: this.destination, items: [item(ctx, layout.top.digest, perPlatform), ...referrers(ctx, layout).map(referrerItem), ...signed] };
|
|
696
751
|
}
|
|
697
752
|
finally {
|
|
698
753
|
layout.cleanup();
|
|
@@ -218,7 +218,9 @@ export function checkReleaseArtifacts(artifacts, o = {}) {
|
|
|
218
218
|
throw new ReleaseArtifactError("release-artifact-invalid", `${where(a)}: goreleaser.types is empty, so nothing would be recorded`);
|
|
219
219
|
}
|
|
220
220
|
else if (isHelm(a)) {
|
|
221
|
-
|
|
221
|
+
// #5271: the chart is only read, so it may leave the member with `..`; its archive may not.
|
|
222
|
+
if (isAbsolute(a.helm.chart))
|
|
223
|
+
throw new ReleaseArtifactError("release-artifact-outside", `${where(a)}: the chart directory ${a.helm.chart} is an absolute path; name it relative to the member`);
|
|
222
224
|
inside(a, "the chart archive directory", a.helm.dir);
|
|
223
225
|
}
|
|
224
226
|
else if (isNfpm(a)) {
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
* repository's own. The checkout's `node_modules` are linked in, so the
|
|
13
13
|
* compile resolves the packages the checkout already installed; a commit
|
|
14
14
|
* whose lockfile differs from the checkout's would need its own install
|
|
15
|
-
* (inferred, as the cut can't tell).
|
|
15
|
+
* (inferred, as the cut can't tell). An npm, pnpm or yarn workspace links
|
|
16
|
+
* each member into `node_modules` with a relative symlink to the member's
|
|
17
|
+
* directory; those links are pointed at the member's directory in the new
|
|
18
|
+
* worktree, so a build there resolves the worktree's own members (built by
|
|
19
|
+
* the cut's build command) and not the checkout's.
|
|
16
20
|
*/
|
|
17
21
|
export type CutAtCode = "release-at-unknown";
|
|
18
22
|
export declare class CutAtError extends Error {
|
|
@@ -12,12 +12,16 @@
|
|
|
12
12
|
* repository's own. The checkout's `node_modules` are linked in, so the
|
|
13
13
|
* compile resolves the packages the checkout already installed; a commit
|
|
14
14
|
* whose lockfile differs from the checkout's would need its own install
|
|
15
|
-
* (inferred, as the cut can't tell).
|
|
15
|
+
* (inferred, as the cut can't tell). An npm, pnpm or yarn workspace links
|
|
16
|
+
* each member into `node_modules` with a relative symlink to the member's
|
|
17
|
+
* directory; those links are pointed at the member's directory in the new
|
|
18
|
+
* worktree, so a build there resolves the worktree's own members (built by
|
|
19
|
+
* the cut's build command) and not the checkout's.
|
|
16
20
|
*/
|
|
17
21
|
import { execFileSync } from "node:child_process";
|
|
18
|
-
import { existsSync, mkdtempSync, realpathSync, rmSync, symlinkSync } from "node:fs";
|
|
22
|
+
import { existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync, realpathSync, rmSync, symlinkSync } from "node:fs";
|
|
19
23
|
import { tmpdir } from "node:os";
|
|
20
|
-
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
24
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
21
25
|
export class CutAtError extends Error {
|
|
22
26
|
constructor(code, message, fix) {
|
|
23
27
|
super(message);
|
|
@@ -38,6 +42,67 @@ export function resolveCutCommit(top, ref) {
|
|
|
38
42
|
throw new CutAtError("release-at-unknown", `--at ${ref} names no commit this clone has`, "Fetch it first (git fetch origin --tags), or name a sha `chant release candidates` lists.");
|
|
39
43
|
}
|
|
40
44
|
}
|
|
45
|
+
/** Where `link` points, relative to `top`, when that is inside `top` and outside any `node_modules`; else null. */
|
|
46
|
+
function workspaceTarget(link, top) {
|
|
47
|
+
try {
|
|
48
|
+
if (!lstatSync(link).isSymbolicLink())
|
|
49
|
+
return null;
|
|
50
|
+
const rel = relative(top, realpathSync(link));
|
|
51
|
+
if (rel === "" || rel.startsWith("..") || isAbsolute(rel) || rel.split(sep).includes("node_modules"))
|
|
52
|
+
return null;
|
|
53
|
+
return rel;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** Whether `name` in `from` is a directory of entries of its own: a scope or `.bin`. */
|
|
60
|
+
function isGroup(from, name) {
|
|
61
|
+
if (!(name.startsWith("@") || name === ".bin"))
|
|
62
|
+
return false;
|
|
63
|
+
try {
|
|
64
|
+
const st = lstatSync(join(from, name));
|
|
65
|
+
return st.isDirectory() && !st.isSymbolicLink();
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
function hasWorkspaceLink(from, top) {
|
|
72
|
+
for (const name of readdirSync(from)) {
|
|
73
|
+
if (isGroup(from, name)) {
|
|
74
|
+
if (hasWorkspaceLink(join(from, name), top))
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
else if (workspaceTarget(join(from, name), top) !== null)
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
function mirror(from, to, top, dir) {
|
|
83
|
+
mkdirSync(to, { recursive: true });
|
|
84
|
+
for (const name of readdirSync(from)) {
|
|
85
|
+
const src = join(from, name);
|
|
86
|
+
const dest = join(to, name);
|
|
87
|
+
if (isGroup(from, name)) {
|
|
88
|
+
mirror(src, dest, top, dir);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const rel = workspaceTarget(src, top);
|
|
92
|
+
symlinkSync(rel === null ? src : join(dir, rel), dest);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Link the checkout's `node_modules` at `to`: as one symlink, or, when it
|
|
97
|
+
* holds workspace links into the checkout, as a directory of per-entry links
|
|
98
|
+
* with those re-pointed into `dir`.
|
|
99
|
+
*/
|
|
100
|
+
function linkNodeModules(from, to, top, dir) {
|
|
101
|
+
if (hasWorkspaceLink(from, top))
|
|
102
|
+
mirror(from, to, top, dir);
|
|
103
|
+
else
|
|
104
|
+
symlinkSync(from, to, "dir");
|
|
105
|
+
}
|
|
41
106
|
/**
|
|
42
107
|
* Check `commit` out in a temporary detached worktree of the repository at
|
|
43
108
|
* `top`, with the checkout's `node_modules` linked at the top and at each
|
|
@@ -72,7 +137,7 @@ export function checkoutCommit(top, cwd, commit) {
|
|
|
72
137
|
const from = join(realTop, level, "node_modules");
|
|
73
138
|
const to = join(dir, level, "node_modules");
|
|
74
139
|
if (existsSync(from) && !existsSync(to) && existsSync(dirname(to)))
|
|
75
|
-
|
|
140
|
+
linkNodeModules(from, to, realTop, dir);
|
|
76
141
|
}
|
|
77
142
|
}
|
|
78
143
|
catch (err) {
|
|
@@ -41,12 +41,25 @@ export declare function changelogBump(messages: readonly string[]): ReleaseBump;
|
|
|
41
41
|
export declare function releaseChangelog(commits: readonly ChangelogCommit[]): ReleaseChangelog;
|
|
42
42
|
/** The commit types a forge release's notes generated from commits list when none are declared (#5153). */
|
|
43
43
|
export declare const DEFAULT_NOTES_TYPES: readonly string[];
|
|
44
|
+
/** Which commits a forge release's notes generated from commits list (#5153, #5270). */
|
|
45
|
+
export interface NotesFilter {
|
|
46
|
+
/** The conventional types listed. Default `feat`, `fix` and `perf`; `*` lists every type. */
|
|
47
|
+
types?: readonly string[];
|
|
48
|
+
/** The conventional types left out, every other commit listed: goreleaser's `changelog.filters.exclude`. Not with `types`. */
|
|
49
|
+
exclude?: readonly string[];
|
|
50
|
+
/** List the commits whose subject is not conventional. Default: with `exclude` or `*` yes, with a list of types no. */
|
|
51
|
+
nonConventional?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/** Whether the notes list `message` under `filter` (#5270). A breaking change is listed whatever its type. */
|
|
54
|
+
export declare function notesListCommit(message: string, filter?: NotesFilter): boolean;
|
|
44
55
|
/**
|
|
45
56
|
* Release notes from `commits` (#5153), newest first as `git log` lists
|
|
46
|
-
* them: the commits
|
|
57
|
+
* them: the commits {@link notesListCommit} lists, grouped by
|
|
47
58
|
* {@link releaseChangelog} under a `###` heading each, one line per commit
|
|
48
|
-
* with its scope and short sha.
|
|
49
|
-
*
|
|
50
|
-
*
|
|
59
|
+
* with its scope and short sha. `types` (default `feat`, `fix` and `perf`)
|
|
60
|
+
* lists those types, `*` every commit; `exclude` lists every commit but those
|
|
61
|
+
* types (#5270). Commits that are not conventional are listed with `*` or
|
|
62
|
+
* `exclude` and not with a list of types, unless `nonConventional` says
|
|
63
|
+
* otherwise. Empty when no commit is listed.
|
|
51
64
|
*/
|
|
52
|
-
export declare function changelogNotes(commits: readonly ChangelogCommit[],
|
|
65
|
+
export declare function changelogNotes(commits: readonly ChangelogCommit[], filter?: NotesFilter | readonly string[]): string;
|
|
@@ -44,20 +44,32 @@ const NOTES_GROUPS = [
|
|
|
44
44
|
["fix", "Fixes"],
|
|
45
45
|
["other", "Other changes"],
|
|
46
46
|
];
|
|
47
|
+
/** Whether the notes list `message` under `filter` (#5270). A breaking change is listed whatever its type. */
|
|
48
|
+
export function notesListCommit(message, filter = {}) {
|
|
49
|
+
const { kind, type } = classifyCommit(message);
|
|
50
|
+
if (kind === "breaking")
|
|
51
|
+
return true;
|
|
52
|
+
const types = filter.types ?? (filter.exclude ? ["*"] : DEFAULT_NOTES_TYPES);
|
|
53
|
+
const all = types.includes("*");
|
|
54
|
+
if (type === undefined)
|
|
55
|
+
return filter.nonConventional ?? all;
|
|
56
|
+
if (filter.exclude?.includes(type))
|
|
57
|
+
return false;
|
|
58
|
+
return all || types.includes(type);
|
|
59
|
+
}
|
|
47
60
|
/**
|
|
48
61
|
* Release notes from `commits` (#5153), newest first as `git log` lists
|
|
49
|
-
* them: the commits
|
|
62
|
+
* them: the commits {@link notesListCommit} lists, grouped by
|
|
50
63
|
* {@link releaseChangelog} under a `###` heading each, one line per commit
|
|
51
|
-
* with its scope and short sha.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
64
|
+
* with its scope and short sha. `types` (default `feat`, `fix` and `perf`)
|
|
65
|
+
* lists those types, `*` every commit; `exclude` lists every commit but those
|
|
66
|
+
* types (#5270). Commits that are not conventional are listed with `*` or
|
|
67
|
+
* `exclude` and not with a list of types, unless `nonConventional` says
|
|
68
|
+
* otherwise. Empty when no commit is listed.
|
|
54
69
|
*/
|
|
55
|
-
export function changelogNotes(commits,
|
|
56
|
-
const
|
|
57
|
-
const listed = commits.filter((c) =>
|
|
58
|
-
const { kind, type } = classifyCommit(c.message);
|
|
59
|
-
return all || kind === "breaking" || (type !== undefined && types.includes(type));
|
|
60
|
-
});
|
|
70
|
+
export function changelogNotes(commits, filter = {}) {
|
|
71
|
+
const f = Array.isArray(filter) ? { types: filter } : filter;
|
|
72
|
+
const listed = commits.filter((c) => notesListCommit(c.message, f));
|
|
61
73
|
const { groups } = releaseChangelog(listed);
|
|
62
74
|
const out = [];
|
|
63
75
|
for (const [kind, title] of NOTES_GROUPS) {
|
|
@@ -75,7 +75,9 @@ export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green"
|
|
|
75
75
|
/** #5149: `release.green: "none"` under a security group or release gate that needs a green commit. */
|
|
76
76
|
| "release-green-none-refused"
|
|
77
77
|
/** #5149: `release.green: "forge-checks"`, and the forge could not be asked. */
|
|
78
|
-
| "release-forge-checks-unavailable" | "release-worktree-dirty"
|
|
78
|
+
| "release-forge-checks-unavailable" | "release-worktree-dirty"
|
|
79
|
+
/** #5261: a `release.check` line exited non-zero. */
|
|
80
|
+
| "release-check-failed" | "release-no-environments" | "release-no-components" | "release-build-inputs-differ" | "release-image-invalid" | "release-image-unknown-component" | "release-image-name-taken" | "release-image-build-failed" | "release-image-archive-in-dist"
|
|
79
81
|
/** #5151: `release.artifacts`, as ./release-artifacts.ts refuses it. */
|
|
80
82
|
| "release-artifact-invalid" | "release-artifact-name-invalid" | "release-artifact-name-taken" | "release-artifact-outside" | "release-artifact-build-failed" | "release-artifact-no-output" | "release-artifact-output-taken" | "release-artifact-no-label" | "release-artifact-version-mismatch" | "release-artifact-checksums-name-taken"
|
|
81
83
|
/** #5183: an entry with no build command whose files are not there, or are read from a checkout of another commit. */
|
|
@@ -84,6 +86,8 @@ export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green"
|
|
|
84
86
|
| "publish-npm-carries-image" | "publish-npm-pack-failed"
|
|
85
87
|
/** #5230: an npm target names a package the registry has never published, or the registry can't say. */
|
|
86
88
|
| "publish-npm-never-published" | "publish-npm-registry-unreadable";
|
|
89
|
+
/** The first chant whose `chant release cut` runs `release.check`, shell lines that refuse the cut with `release-check-failed` before anything is recorded or tagged, in a dry run too (#5261). */
|
|
90
|
+
export declare const RELEASE_CHECK_FLOOR = "0.124.104";
|
|
87
91
|
export declare class ReleaseCutError extends Error {
|
|
88
92
|
readonly code: ReleaseCutCode;
|
|
89
93
|
readonly fix?: string | undefined;
|
|
@@ -178,6 +182,14 @@ export interface CutRequest {
|
|
|
178
182
|
* environments, so a commit that does not build is not cut.
|
|
179
183
|
*/
|
|
180
184
|
build?: () => void | Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Run `release.check` (#5261), once the label is stamped and the images,
|
|
187
|
+
* files and build command have run, and before any environment is
|
|
188
|
+
* compiled or anything recorded or tagged. Given the commit being cut;
|
|
189
|
+
* throws {@link ReleaseCutError} `release-check-failed` to refuse the cut.
|
|
190
|
+
* A dry run runs it too, so it refuses the same label.
|
|
191
|
+
*/
|
|
192
|
+
check?: (commit: string) => void | Promise<void>;
|
|
181
193
|
/** The intent files the cut consumes (#5159), recorded on its cut line. */
|
|
182
194
|
intents?: readonly ReleaseCutIntent[];
|
|
183
195
|
}
|
|
@@ -80,6 +80,8 @@ export function greenOverrideRule(lane) {
|
|
|
80
80
|
}
|
|
81
81
|
/** How long a recorded request for an override stands before a cut records a fresh one. */
|
|
82
82
|
const OVERRIDE_REQUEST_HOURS = 48;
|
|
83
|
+
/** The first chant whose `chant release cut` runs `release.check`, shell lines that refuse the cut with `release-check-failed` before anything is recorded or tagged, in a dry run too (#5261). */
|
|
84
|
+
export const RELEASE_CHECK_FLOOR = "0.124.104";
|
|
83
85
|
export class ReleaseCutError extends Error {
|
|
84
86
|
constructor(code, message, fix,
|
|
85
87
|
/** The cut recorded a request for an override on `chant/lifecycle` (#4693), which the caller pushes. */
|
|
@@ -410,6 +412,7 @@ async function prepare(req, record = false) {
|
|
|
410
412
|
const builtFiles = req.buildArtifacts ? await req.buildArtifacts(commit) : [];
|
|
411
413
|
if (artifactRelease)
|
|
412
414
|
await req.build?.();
|
|
415
|
+
await req.check?.(commit);
|
|
413
416
|
const compiled = [];
|
|
414
417
|
for (const env of envs)
|
|
415
418
|
compiled.push(await req.compiler.compile(env));
|
|
@@ -63,6 +63,13 @@ export interface DoctorEnvironment {
|
|
|
63
63
|
repository: string | null;
|
|
64
64
|
/** The release workflow file, from the repository root: `release.workflow.file` or the forge's default. */
|
|
65
65
|
releaseWorkflow: string | null;
|
|
66
|
+
/**
|
|
67
|
+
* `cut` under `chant release doctor --from cut`: this is the cut job of a
|
|
68
|
+
* release workflow, which runs without OIDC on purpose (it runs the
|
|
69
|
+
* project's build), and the publish job holds the credentials. The checks
|
|
70
|
+
* that need an OIDC token then can't tell from here, rather than fail.
|
|
71
|
+
*/
|
|
72
|
+
from?: "cut";
|
|
66
73
|
}
|
|
67
74
|
export interface DoctorReport {
|
|
68
75
|
environment: DoctorEnvironment;
|
|
@@ -95,6 +102,7 @@ export declare const DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
|
95
102
|
export declare function doctorEnvironment(env: NodeJS.ProcessEnv, req: {
|
|
96
103
|
cwd: string;
|
|
97
104
|
releaseWorkflow: string | null;
|
|
105
|
+
from?: "cut";
|
|
98
106
|
}): DoctorEnvironment;
|
|
99
107
|
/** Check every declared target. Nothing is published, tagged or changed. */
|
|
100
108
|
export declare function releaseDoctor(req: {
|
|
@@ -102,6 +110,8 @@ export declare function releaseDoctor(req: {
|
|
|
102
110
|
publish: readonly PublishDeclaration[];
|
|
103
111
|
env?: NodeJS.ProcessEnv;
|
|
104
112
|
releaseWorkflow: string | null;
|
|
113
|
+
/** `cut` when the doctor runs in the cut job of the release workflow, whose publish job holds the OIDC credentials. */
|
|
114
|
+
from?: "cut";
|
|
105
115
|
/** The cut's green gate (#5149); `forge-checks` adds the check that the forge answers for the commit's checks. */
|
|
106
116
|
green?: import("./release-green.js").ReleaseGreenSource;
|
|
107
117
|
/** The commit whose checks are read under `forge-checks`. Default: HEAD of `cwd`. */
|