@intentius/chant 0.124.102 → 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.
Files changed (79) hide show
  1. package/dist/audit/secrets.d.ts +6 -0
  2. package/dist/audit/secrets.js +9 -2
  3. package/dist/cli/commands/import-index.d.ts +15 -0
  4. package/dist/cli/commands/import-index.js +37 -3
  5. package/dist/cli/commands/onboard.js +8 -8
  6. package/dist/cli/handlers/lifecycle.js +6 -0
  7. package/dist/cli/handlers/release-config.d.ts +15 -0
  8. package/dist/cli/handlers/release-config.js +58 -0
  9. package/dist/cli/handlers/release-init.js +3 -1
  10. package/dist/cli/handlers/release.js +36 -3
  11. package/dist/cli/main.js +24 -3
  12. package/dist/cli/parse-args.js +12 -0
  13. package/dist/cli/registry.d.ts +4 -0
  14. package/dist/cli/release-commands/cut.js +3 -0
  15. package/dist/cloud-lister/kubernetes-components.js +1 -2
  16. package/dist/config-import.js +26 -4
  17. package/dist/config.d.ts +14 -0
  18. package/dist/config.js +4 -0
  19. package/dist/floor-table.data.js +13 -11
  20. package/dist/floor-table.js +3 -1
  21. package/dist/graph-refs.d.ts +9 -0
  22. package/dist/graph-refs.js +9 -7
  23. package/dist/lifecycle/cloud-index.d.ts +6 -0
  24. package/dist/lifecycle/cloud-index.js +32 -5
  25. package/dist/lifecycle/identity-match.d.ts +18 -2
  26. package/dist/lifecycle/identity-match.js +10 -5
  27. package/dist/lifecycle/index-drift.d.ts +13 -0
  28. package/dist/lifecycle/index-drift.js +21 -3
  29. package/dist/lifecycle/index-import.d.ts +15 -0
  30. package/dist/lifecycle/index-import.js +25 -2
  31. package/dist/lifecycle/index-join.d.ts +1 -1
  32. package/dist/lifecycle/index-join.js +1 -1
  33. package/dist/lifecycle/publish-declaration.d.ts +6 -0
  34. package/dist/lifecycle/publish-declaration.js +19 -3
  35. package/dist/lifecycle/publish-forge.d.ts +2 -0
  36. package/dist/lifecycle/publish-forge.js +3 -1
  37. package/dist/lifecycle/publish-helm.js +1 -2
  38. package/dist/lifecycle/publish-maven.js +1 -2
  39. package/dist/lifecycle/publish-npm.js +1 -1
  40. package/dist/lifecycle/publish-nuget.js +1 -2
  41. package/dist/lifecycle/publish-oci.d.ts +27 -0
  42. package/dist/lifecycle/publish-oci.js +63 -8
  43. package/dist/lifecycle/publish-rubygems.js +1 -2
  44. package/dist/lifecycle/release-artifacts.js +1 -2
  45. package/dist/lifecycle/release-changelog.d.ts +18 -5
  46. package/dist/lifecycle/release-changelog.js +22 -10
  47. package/dist/lifecycle/release-cut.d.ts +13 -1
  48. package/dist/lifecycle/release-cut.js +3 -0
  49. package/dist/lifecycle/release-images.d.ts +32 -2
  50. package/dist/lifecycle/release-images.js +70 -2
  51. package/dist/lifecycle/release-init-goreleaser-images.d.ts +21 -0
  52. package/dist/lifecycle/release-init-goreleaser-images.js +160 -0
  53. package/dist/lifecycle/release-init.d.ts +22 -0
  54. package/dist/lifecycle/release-init.js +96 -16
  55. package/dist/local-chant.d.ts +3 -0
  56. package/dist/local-chant.js +28 -2
  57. package/dist/release-floors.d.ts +10 -6
  58. package/dist/release-floors.js +10 -6
  59. package/dist/ts-loader.d.ts +12 -3
  60. package/dist/ts-loader.js +27 -11
  61. package/dist/wave-runtime.mjs +291 -290
  62. package/dist/workspace/catalog-edges.d.ts +22 -0
  63. package/dist/workspace/catalog-edges.js +23 -0
  64. package/dist/workspace/release-steps/goreleaser.d.ts +6 -3
  65. package/dist/workspace/release-steps/goreleaser.js +12 -6
  66. package/dist/workspace/release-toolchains.d.ts +6 -0
  67. package/dist/workspace/release-toolchains.js +8 -0
  68. package/dist/workspace/release-train-workflow.d.ts +39 -3
  69. package/dist/workspace/release-train-workflow.js +258 -9
  70. package/dist/workspace/release-train.js +5 -1
  71. package/dist/workspace/release-workflow.d.ts +37 -0
  72. package/dist/workspace/release-workflow.js +97 -16
  73. package/dist/workspace/train-artifacts.d.ts +107 -0
  74. package/dist/workspace/train-artifacts.js +238 -0
  75. package/dist/workspace/train-cut.d.ts +34 -1
  76. package/dist/workspace/train-cut.js +98 -14
  77. package/dist/workspace/train-publish.d.ts +9 -0
  78. package/dist/workspace/train-publish.js +27 -1
  79. package/package.json +2 -2
@@ -62,8 +62,7 @@ export const NpmPublishSchema = z
62
62
  stage: z.boolean().optional(),
63
63
  /**
64
64
  * A variable holding an npm token to retry with when a package's publish
65
- * fails to authenticate (#4040), as chant's own publish-packages.sh does:
66
- * a package whose trusted-publisher record is broken publishes with the
65
+ * fails to authenticate (#4040): a package whose trusted-publisher record is broken publishes with the
67
66
  * token rather than failing the release. Unset or empty, there is no retry.
68
67
  */
69
68
  tokenEnv: envName.optional(),
@@ -92,8 +91,18 @@ export const OciPublishSchema = z
92
91
  image: z.string().min(1),
93
92
  /** `<registry host>/<name>`, such as `ghcr.io/acme/api` or `docker.io/acme/api`. */
94
93
  repository: z.string().min(1),
95
- /** 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. */
96
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(),
97
106
  /** The variable holding the registry user name. Default `OCI_USERNAME`. */
98
107
  usernameEnv: envName.optional(),
99
108
  /** The variable holding the registry password or token. Default `OCI_PASSWORD`. */
@@ -140,6 +149,10 @@ export const ForgePublishSchema = z
140
149
  generate: z.enum(["forge", "commits"]).optional(),
141
150
  /** With `generate: "commits"`: the commit types listed. Default `feat`, `fix` and `perf`. A breaking change is listed whatever its type; `*` lists every commit. */
142
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(),
143
156
  /** A paragraph before the notes, with the same placeholders. */
144
157
  before: z.string().min(1).optional(),
145
158
  /** A paragraph after the notes, with the same placeholders. */
@@ -149,6 +162,9 @@ export const ForgePublishSchema = z
149
162
  .refine((n) => (n.file === undefined) === (n.heading === undefined), { message: "notes.file and notes.heading go together", path: ["heading"] })
150
163
  .refine((n) => n.file !== undefined || n.generate !== undefined, { message: "notes need a file section, generate, or both", path: ["generate"] })
151
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"] })
152
168
  .optional(),
153
169
  /** The forge release's tag. Default: the tag the cut made, from `release.tag` (#5150; `release/<label>` or `release/<member>/<label>` when unset). */
154
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.
@@ -41,10 +41,9 @@ import { Registry, ociCredential, parseRepository } from "./publish-oci.js";
41
41
  import { bytesDigest, checkReleaseDigest, expandArtifactAssets, memberFile, publishTargetKey } from "./publish-targets.js";
42
42
  import { trainName, waitUntilServed } from "./publish-train-names.js";
43
43
  import { PublishTargetError } from "./release-publish.js";
44
- import { NEXT_RELEASE } from "../release-floors.js";
45
44
  import { emitYAML, parseYAML } from "../yaml.js";
46
45
  /** The first chant that publishes a `helm` target (#5233). */
47
- export const PUBLISH_HELM_FLOOR = NEXT_RELEASE;
46
+ export const PUBLISH_HELM_FLOOR = "0.124.102";
48
47
  /** The media type of a chart's config blob: its metadata as JSON. */
49
48
  export const HELM_CONFIG_MEDIA_TYPE = "application/vnd.cncf.helm.config.v1+json";
50
49
  /** The media type of a chart's archive layer. */
@@ -46,10 +46,9 @@ import { zipEntry, zipEntryNames } from "./publish-pypi.js";
46
46
  import { bytesDigest, checkReleaseDigest, expandArtifactAssets, memberFile, publishTargetKey } from "./publish-targets.js";
47
47
  import { trainName, waitUntilServed } from "./publish-train-names.js";
48
48
  import { zipArchive } from "./release-artifacts.js";
49
- import { NEXT_RELEASE } from "../release-floors.js";
50
49
  import { PublishTargetError } from "./release-publish.js";
51
50
  /** The first chant that publishes a `maven` target (#5232). */
52
- export const PUBLISH_MAVEN_FLOOR = NEXT_RELEASE;
51
+ export const PUBLISH_MAVEN_FLOOR = "0.124.102";
53
52
  export const CENTRAL_PORTAL = "https://central.sonatype.com";
54
53
  export const MAVEN_CENTRAL_REPOSITORY = "https://repo1.maven.org/maven2/";
55
54
  /** How often the stage asks the Portal whether it has validated the bundle. */
@@ -61,7 +61,7 @@ import { trainName } from "./publish-train-names.js";
61
61
  import { readPins, unknownPins } from "./release-images.js";
62
62
  import { NPM_STAGE_TAG, PublishTargetError, statusMessage } from "./release-publish.js";
63
63
  import { prereleaseOf } from "./release-prerelease.js";
64
- /** npm's output when a publish could not authenticate, as publish-packages.sh matches it. */
64
+ /** npm's output when a publish could not authenticate. */
65
65
  const NPM_AUTH_FAILED = /ENEEDAUTH|E401|need auth/;
66
66
  /** Read a package's name and version, from its directory or its packed `.tgz`, and find the SBOM it carries. */
67
67
  function readPackage(ctx, path, sbom) {
@@ -52,10 +52,9 @@ import { packageFiles } from "./publish-package-files.js";
52
52
  import { zipEntry, zipEntryNames } from "./publish-pypi.js";
53
53
  import { bytesDigest, checkReleaseDigest, hasIdToken, publishTargetKey, runIdToken } from "./publish-targets.js";
54
54
  import { trainName, waitUntilServed } from "./publish-train-names.js";
55
- import { NEXT_RELEASE } from "../release-floors.js";
56
55
  import { PublishTargetError } from "./release-publish.js";
57
56
  /** The first chant that publishes a `nuget` target (#5232). */
58
- export const PUBLISH_NUGET_FLOOR = NEXT_RELEASE;
57
+ export const PUBLISH_NUGET_FLOOR = "0.124.102";
59
58
  export const NUGET_ORG = { label: "nuget.org", site: "https://www.nuget.org", push: "https://www.nuget.org/api/v2/package", flat: "https://api.nuget.org/v3-flatcontainer/", token: "https://www.nuget.org/api/v2/token" };
60
59
  /** The audience nuget.org takes an OIDC ID token for. */
61
60
  export const NUGET_AUDIENCE = "https://www.nuget.org";
@@ -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.includes("{label}")).map((t) => t.split("{label}").join(ctx.label ?? ""));
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.includes("{label}"));
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
- const item = (ctx, digest) => {
464
- const tags = ociTags(decl, ctx);
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((t) => t.includes("{label}")).map((t) => t.split("{label}").join(label));
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();
@@ -47,10 +47,9 @@ import { packageFiles } from "./publish-package-files.js";
47
47
  import { tarEntries } from "./publish-pypi.js";
48
48
  import { bytesDigest, checkReleaseDigest, hasIdToken, publishTargetKey, runIdToken } from "./publish-targets.js";
49
49
  import { trainName, waitUntilServed } from "./publish-train-names.js";
50
- import { NEXT_RELEASE } from "../release-floors.js";
51
50
  import { PublishTargetError } from "./release-publish.js";
52
51
  /** The first chant that publishes a `rubygems` target (#5232). */
53
- export const PUBLISH_RUBYGEMS_FLOOR = NEXT_RELEASE;
52
+ export const PUBLISH_RUBYGEMS_FLOOR = "0.124.102";
54
53
  export const RUBYGEMS_ORG = "https://rubygems.org";
55
54
  /** The audience RubyGems.org takes an OIDC ID token for. */
56
55
  export const RUBYGEMS_AUDIENCE = "rubygems.org";
@@ -73,7 +73,6 @@ import { createHash } from "node:crypto";
73
73
  import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
74
74
  import { dirname, isAbsolute, posix, relative, resolve } from "node:path";
75
75
  import { deflateRawSync, gzipSync } from "node:zlib";
76
- import { NEXT_RELEASE } from "../release-floors.js";
77
76
  import { stampVersionFile } from "./release-version-formats.js";
78
77
  import { parseYAML } from "../yaml.js";
79
78
  /** The first chant with `release.artifacts`, `chant release artifacts` and `artifact:<name>` in a forge or homebrew target's `assets` (#5151). */
@@ -81,7 +80,7 @@ export const RELEASE_ARTIFACTS_FLOOR = "0.124.101";
81
80
  /** The variable naming the goreleaser binary the cut runs. */
82
81
  export const GORELEASER_ENV = "CHANT_GORELEASER";
83
82
  /** The first chant with `helm` and `nfpm` entries in `release.artifacts` (#5233). */
84
- export const RELEASE_ARTIFACTS_PACKAGES_FLOOR = NEXT_RELEASE;
83
+ export const RELEASE_ARTIFACTS_PACKAGES_FLOOR = "0.124.102";
85
84
  /** The variable naming the nfpm binary the cut runs (#5233). */
86
85
  export const NFPM_ENV = "CHANT_NFPM";
87
86
  /** The package formats an nfpm entry builds. */
@@ -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 whose conventional type is in `types`, grouped by
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. A breaking change is listed whatever its
49
- * type; `*` in `types` lists every commit, conventional or not. Empty when
50
- * no commit is listed.
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[], types?: readonly string[]): string;
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 whose conventional type is in `types`, grouped by
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. A breaking change is listed whatever its
52
- * type; `*` in `types` lists every commit, conventional or not. Empty when
53
- * no commit is listed.
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, types = DEFAULT_NOTES_TYPES) {
56
- const all = types.includes("*");
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" | "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"
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));
@@ -48,6 +48,13 @@ export declare const RELEASE_IMAGES_FLOOR = "0.124.71";
48
48
  export declare const RELEASE_IMAGE_DOCKERFILE_FLOOR = "0.124.78";
49
49
  /** The first chant whose Dockerfile entry in `release.images` takes `args`, build arguments beside the two chant passes (#4908). */
50
50
  export declare const RELEASE_IMAGE_ARGS_FLOOR = "0.124.88";
51
+ /**
52
+ * The first chant whose Dockerfile entry takes `labels`, OCI labels on the
53
+ * image, and `{label}` and `{version}` in `args` and `labels` values, and
54
+ * whose image builds see `CHANT_RELEASE_VERSION`; and whose default archive
55
+ * moves out of a goreleaser entry's `dist` (#5269).
56
+ */
57
+ export declare const RELEASE_IMAGE_LABELS_FLOOR = "0.124.104";
51
58
  /** One image a release builds in its cut with a command of the product's. */
52
59
  export interface ReleaseImageBuild {
53
60
  /** The image's name: its key in the digests file, and its artifact's `component` in the release. */
@@ -80,9 +87,17 @@ export interface ReleaseImageDockerfile {
80
87
  * Build arguments beside `SOURCE_DATE_EPOCH` and `CHANT_RELEASE_LABEL`
81
88
  * (#4908), such as the packed package's file and the chant packages the
82
89
  * image installs beside it, as sql-yodeler's `release-image.sh` passed
83
- * them. Values are literal; the config computes them.
90
+ * them. `{label}` in a value is the release's label and `{version}` the
91
+ * label from its first digit (#5269), such as `{ VERSION: "{version}" }`;
92
+ * the rest is literal.
84
93
  */
85
94
  args?: Record<string, string>;
95
+ /**
96
+ * OCI labels on the image (#5269), such as
97
+ * `{ "org.opencontainers.image.version": "{version}" }`, with the same
98
+ * placeholders as `args`.
99
+ */
100
+ labels?: Record<string, string>;
86
101
  }
87
102
  /** One image a release builds in its cut. */
88
103
  export type ReleaseImageDeclaration = ReleaseImageBuild | ReleaseImageDockerfile;
@@ -100,6 +115,20 @@ export declare const RELEASE_IMAGE_BUILDER = "chant-release";
100
115
  export declare function releaseImageBuildCommand(i: ReleaseImageDockerfile, o?: {
101
116
  versionArg?: boolean;
102
117
  }): string;
118
+ /** The archive of a Dockerfile entry that names none and whose default would be inside a goreleaser entry's `dist` (#5269). */
119
+ export declare const imageArchiveBesideGoreleaser: (name: string) => string;
120
+ /**
121
+ * A member's `release.images` with each archive placed (#5269). goreleaser
122
+ * empties its `dist` (`--clean`) when it builds, after the images, so an
123
+ * archive there would be gone before the cut records it: a Dockerfile entry
124
+ * that names no archive, whose default `dist/images/<name>.tar` is inside a
125
+ * goreleaser entry's `dist`, writes {@link imageArchiveBesideGoreleaser}
126
+ * instead. An archive named inside it is left for
127
+ * {@link checkImagesOutsideGoreleaser} to refuse.
128
+ */
129
+ export declare function placeReleaseImages(images: readonly ReleaseImageDeclaration[], artifacts?: readonly unknown[]): ReleaseImageDeclaration[];
130
+ /** Refuse an image archive inside a goreleaser entry's `dist` (#5269), which goreleaser empties after the images are built. */
131
+ export declare function checkImagesOutsideGoreleaser(images: readonly ReleaseImageDeclaration[], artifacts?: readonly unknown[]): void;
103
132
  /** Each entry as a command and an archive: a Dockerfile entry's command is {@link releaseImageBuildCommand}, its archive the default when it names none. */
104
133
  export declare function resolveReleaseImages(images: readonly ReleaseImageDeclaration[], o?: {
105
134
  versionArg?: boolean;
@@ -142,7 +171,8 @@ export interface BuildImagesInput {
142
171
  /**
143
172
  * Build each image and return it as the release's image artifact. The
144
173
  * command runs with `SOURCE_DATE_EPOCH` and, for a cut with a label,
145
- * `CHANT_RELEASE_LABEL`; an archive it did not write, or a command that
174
+ * `CHANT_RELEASE_LABEL` and `CHANT_RELEASE_VERSION` (the label from its
175
+ * first digit, when it has one); an archive it did not write, or a command that
146
176
  * fails, stops the cut.
147
177
  */
148
178
  export declare function buildReleaseImages(i: BuildImagesInput): ReleaseArtifact[];