@intentius/chant 0.124.101 → 0.124.103
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/ci-evidence-claims.d.ts +12 -0
- package/dist/ci-evidence-claims.js +12 -0
- package/dist/cli/commands/onboard.js +8 -8
- package/dist/cli/handlers/release-init.js +53 -19
- package/dist/cli/handlers/release.d.ts +1 -1
- package/dist/cli/handlers/release.js +12 -9
- package/dist/cli/main.js +13 -2
- package/dist/cli/parse-args.js +5 -0
- package/dist/cli/registry.d.ts +2 -0
- package/dist/cli/release-commands/cut.js +4 -3
- package/dist/cli/release-commands/init.js +4 -1
- package/dist/cli/release-commands/workflow.js +4 -2
- package/dist/cloud-lister/index.d.ts +4 -1
- package/dist/cloud-lister/index.js +2 -1
- package/dist/cloud-lister/kubernetes-components.d.ts +56 -0
- package/dist/cloud-lister/kubernetes-components.js +641 -0
- package/dist/cloud-lister/kubernetes.d.ts +18 -0
- package/dist/cloud-lister/kubernetes.js +26 -1
- package/dist/cloud-lister/mask.d.ts +5 -1
- package/dist/cloud-lister/mask.js +14 -5
- package/dist/config-import.d.ts +1 -1
- package/dist/config-import.js +6 -2
- package/dist/config-sandbox.d.ts +1 -1
- package/dist/config-sandbox.js +3 -3
- package/dist/config.d.ts +75 -1
- package/dist/config.js +27 -2
- package/dist/deep-observation.js +9 -3
- package/dist/floor-table.data.js +13 -6
- package/dist/lexicon.d.ts +4 -2
- package/dist/lifecycle/__fixtures__/package-files.d.ts +32 -0
- package/dist/lifecycle/__fixtures__/package-files.js +72 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.js +5 -0
- package/dist/lifecycle/publish-credentials.d.ts +1 -1
- package/dist/lifecycle/publish-credentials.js +5 -0
- package/dist/lifecycle/publish-declaration.d.ts +123 -0
- package/dist/lifecycle/publish-declaration.js +141 -2
- package/dist/lifecycle/publish-helm.d.ts +83 -0
- package/dist/lifecycle/publish-helm.js +451 -0
- package/dist/lifecycle/publish-maven.d.ts +79 -0
- package/dist/lifecycle/publish-maven.js +363 -0
- package/dist/lifecycle/publish-mcp-registry.js +1 -2
- package/dist/lifecycle/publish-npm.d.ts +27 -1
- package/dist/lifecycle/publish-npm.js +52 -2
- package/dist/lifecycle/publish-nuget.d.ts +93 -0
- package/dist/lifecycle/publish-nuget.js +376 -0
- package/dist/lifecycle/publish-oci.d.ts +57 -1
- package/dist/lifecycle/publish-oci.js +1 -1
- package/dist/lifecycle/publish-package-files.d.ts +16 -0
- package/dist/lifecycle/publish-package-files.js +39 -0
- package/dist/lifecycle/publish-pypi.d.ts +2 -0
- package/dist/lifecycle/publish-pypi.js +1 -1
- package/dist/lifecycle/publish-rubygems.d.ts +84 -0
- package/dist/lifecycle/publish-rubygems.js +365 -0
- package/dist/lifecycle/publish-targets.d.ts +10 -0
- package/dist/lifecycle/publish-targets.js +22 -0
- package/dist/lifecycle/publish-train-names.d.ts +4 -1
- package/dist/lifecycle/publish-train-names.js +5 -0
- package/dist/lifecycle/release-artifacts.d.ts +80 -2
- package/dist/lifecycle/release-artifacts.js +241 -5
- package/dist/lifecycle/release-cut.d.ts +6 -1
- package/dist/lifecycle/release-cut.js +15 -0
- package/dist/lifecycle/release-doctor.js +208 -6
- package/dist/lifecycle/release-init-registries.d.ts +48 -0
- package/dist/lifecycle/release-init-registries.js +97 -0
- package/dist/lifecycle/release-init.d.ts +22 -2
- package/dist/lifecycle/release-init.js +139 -13
- package/dist/lifecycle/release-next.js +1 -2
- package/dist/lifecycle/release-publish.d.ts +1 -1
- package/dist/lifecycle/release-publish.js +1 -1
- package/dist/lifecycle/release-tag.js +1 -2
- package/dist/op/local-executor.d.ts +1 -1
- package/dist/op/local-executor.js +2 -2
- package/dist/op/op-waves-evidence.js +9 -2
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/sensitive-key.d.ts +12 -0
- package/dist/sensitive-key.js +52 -0
- package/dist/tool-pins.d.ts +2 -0
- package/dist/tool-pins.js +12 -0
- package/dist/ts-loader.d.ts +8 -0
- package/dist/ts-loader.js +19 -0
- package/dist/wave-runtime.mjs +325 -325
- package/dist/workspace/lexicon-outputs.d.ts +1 -1
- package/dist/workspace/lexicon-outputs.js +1 -1
- package/dist/workspace/release-steps/index.js +4 -0
- package/dist/workspace/release-steps/nfpm.d.ts +13 -0
- package/dist/workspace/release-steps/nfpm.js +29 -0
- package/dist/workspace/release-steps/nuget.d.ts +14 -0
- package/dist/workspace/release-steps/nuget.js +16 -0
- package/dist/workspace/release-steps/targets.d.ts +2 -2
- package/dist/workspace/release-steps/targets.js +3 -3
- package/dist/workspace/release-train-workflow.d.ts +27 -2
- package/dist/workspace/release-train-workflow.js +171 -14
- package/dist/workspace/release-train.js +5 -1
- package/dist/workspace/release-workflow.d.ts +39 -3
- package/dist/workspace/release-workflow.js +80 -24
- package/dist/workspace/train-artifacts.d.ts +107 -0
- package/dist/workspace/train-artifacts.js +239 -0
- package/dist/workspace/train-cut.d.ts +14 -2
- package/dist/workspace/train-cut.js +49 -7
- package/dist/workspace/train-prepare.d.ts +6 -3
- package/dist/workspace/train-prepare.js +54 -8
- package/dist/workspace/train-publish.d.ts +9 -0
- package/dist/workspace/train-publish.js +29 -4
- package/dist/workspace/train-shell.d.ts +5 -0
- package/dist/workspace/train-shell.js +17 -0
- package/dist/workspace/trust/check-evidence-report.d.ts +3 -7
- package/dist/workspace/trust/check-evidence-report.js +3 -7
- package/package.json +1 -1
|
@@ -53,7 +53,7 @@ export interface OutputsPlugin {
|
|
|
53
53
|
outputs: LexiconWorkspaceOutput[];
|
|
54
54
|
gaps?: string[];
|
|
55
55
|
} | undefined;
|
|
56
|
-
workspaceLinks?: (entities: ReadonlyMap<string, Declarable>, unread?: readonly LexiconUnreadSource[]) => LexiconWorkspaceLinks | undefined
|
|
56
|
+
workspaceLinks?: (entities: ReadonlyMap<string, Declarable>, unread?: readonly LexiconUnreadSource[]) => LexiconWorkspaceLinks | undefined | Promise<LexiconWorkspaceLinks | undefined>;
|
|
57
57
|
}
|
|
58
58
|
/** Loads a lexicon plugin by name; `loadPlugin` from the CLI unless a test swaps it. */
|
|
59
59
|
export type OutputsPluginLoader = (name: string) => Promise<OutputsPlugin>;
|
|
@@ -317,7 +317,7 @@ export async function gatherLexiconLinks(root, declaration, tree, groups, kinds,
|
|
|
317
317
|
for (const { name, plugin } of member.reporting) {
|
|
318
318
|
const read = { reader: `lexicon ${name}`, links: [], gaps: member.gaps.map((message) => ({ file: where, line: 1, message })) };
|
|
319
319
|
try {
|
|
320
|
-
const report = plugin.workspaceLinks(member.entities, member.unread);
|
|
320
|
+
const report = await plugin.workspaceLinks(member.entities, member.unread);
|
|
321
321
|
if (!report)
|
|
322
322
|
continue;
|
|
323
323
|
for (const l of report.links) {
|
|
@@ -10,6 +10,8 @@ import { doctorFeature } from "./doctor.js";
|
|
|
10
10
|
import { goreleaserFeature } from "./goreleaser.js";
|
|
11
11
|
import { greenFeature } from "./green.js";
|
|
12
12
|
import { imagesFeature } from "./images.js";
|
|
13
|
+
import { nfpmFeature } from "./nfpm.js";
|
|
14
|
+
import { nugetFeature } from "./nuget.js";
|
|
13
15
|
import { pypiFeature } from "./pypi.js";
|
|
14
16
|
import { qemuFeature } from "./qemu.js";
|
|
15
17
|
import { signingFeature } from "./signing.js";
|
|
@@ -24,6 +26,8 @@ export const RELEASE_WORKFLOW_FEATURES = [
|
|
|
24
26
|
goreleaserFeature,
|
|
25
27
|
greenFeature,
|
|
26
28
|
imagesFeature,
|
|
29
|
+
nfpmFeature,
|
|
30
|
+
nugetFeature,
|
|
27
31
|
pypiFeature,
|
|
28
32
|
qemuFeature,
|
|
29
33
|
signingFeature,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ReleasePipelineConfig, ReleaseWorkflowForge } from "../release-workflow.js";
|
|
2
|
+
import { type ReleaseWorkflowFeature } from "./types.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a job that packages nfpm entries runs first: the pinned nfpm,
|
|
5
|
+
* downloaded, checked by SHA-256 and named by `CHANT_NFPM`. A config that
|
|
6
|
+
* sets `CHANT_NFPM` in `release.workflow.env` gets no install.
|
|
7
|
+
*/
|
|
8
|
+
export declare function nfpmSetup(forge: ReleaseWorkflowForge, p: ReleasePipelineConfig): {
|
|
9
|
+
github: string[];
|
|
10
|
+
gitlab: string[];
|
|
11
|
+
};
|
|
12
|
+
/** In the job that builds the files: a dispatched release's cut, or a tag's publish. */
|
|
13
|
+
export declare const nfpmFeature: ReleaseWorkflowFeature;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** nfpm for the `release.artifacts` entries it packages (#5233). */
|
|
2
|
+
import { TOOL_PINS, toolInstallLine } from "../../tool-pins.js";
|
|
3
|
+
import { RELEASE_RUNNER_PLATFORM } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* What a job that packages nfpm entries runs first: the pinned nfpm,
|
|
6
|
+
* downloaded, checked by SHA-256 and named by `CHANT_NFPM`. A config that
|
|
7
|
+
* sets `CHANT_NFPM` in `release.workflow.env` gets no install.
|
|
8
|
+
*/
|
|
9
|
+
export function nfpmSetup(forge, p) {
|
|
10
|
+
if (p.env?.CHANT_NFPM !== undefined)
|
|
11
|
+
return { github: [], gitlab: [] };
|
|
12
|
+
if (forge === "gitlab")
|
|
13
|
+
return { github: [], gitlab: [`${toolInstallLine(TOOL_PINS.nfpm, RELEASE_RUNNER_PLATFORM, "/tmp/nfpm")} && export CHANT_NFPM=/tmp/nfpm/nfpm`] };
|
|
14
|
+
const line = `${toolInstallLine(TOOL_PINS.nfpm, RELEASE_RUNNER_PLATFORM, "$RUNNER_TEMP/nfpm")} && echo "CHANT_NFPM=$RUNNER_TEMP/nfpm/nfpm" >> "$GITHUB_ENV"`;
|
|
15
|
+
return { github: [` - name: nfpm ${TOOL_PINS.nfpm.version}`, ` run: ${JSON.stringify(line)}`], gitlab: [] };
|
|
16
|
+
}
|
|
17
|
+
/** In the job that builds the files: a dispatched release's cut, or a tag's publish. */
|
|
18
|
+
export const nfpmFeature = {
|
|
19
|
+
name: "nfpm",
|
|
20
|
+
steps: (c) => {
|
|
21
|
+
if (!c.artifacts || c.input.nfpm !== true)
|
|
22
|
+
return [];
|
|
23
|
+
if (c.job !== (c.shape === "dispatch" ? "cut" : "publish"))
|
|
24
|
+
return [];
|
|
25
|
+
const n = nfpmSetup(c.forge, c.pipeline);
|
|
26
|
+
const items = c.forge !== "gitlab" ? [{ lines: n.github }] : c.shape === "dispatch" ? n.gitlab : [{ lines: n.gitlab.map((l) => ` - ${JSON.stringify(l)}`) }];
|
|
27
|
+
return [{ slot: "prepare", order: 21, items }];
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** nuget.org trusted publishing on GitLab (#5232): the ID token the `nuget` target reads. */
|
|
2
|
+
import type { ReleaseWorkflowTarget } from "../release-workflow.js";
|
|
3
|
+
import type { ReleaseWorkflowFeature } from "./types.js";
|
|
4
|
+
/** The audience nuget.org takes an OIDC ID token for. */
|
|
5
|
+
export declare const NUGET_ID_TOKEN_AUDIENCE = "https://www.nuget.org";
|
|
6
|
+
/**
|
|
7
|
+
* True when a `nuget` target may use trusted publishing: it does not set
|
|
8
|
+
* `auth: "token"` and pushes to nuget.org. With `auth` unset the target uses
|
|
9
|
+
* trusted publishing when its key's variable is not set, which the generator
|
|
10
|
+
* can't see, so the job gets the token; declaring it costs nothing.
|
|
11
|
+
*/
|
|
12
|
+
export declare function nugetIdTokenNeeded(targets: ReadonlyArray<ReleaseWorkflowTarget>): boolean;
|
|
13
|
+
/** `NUGET_ID_TOKEN` in the GitLab publish job's `id_tokens`. GitHub asks for the token at run time from `id-token: write`, which the job already has. */
|
|
14
|
+
export declare const nugetFeature: ReleaseWorkflowFeature;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The audience nuget.org takes an OIDC ID token for. */
|
|
2
|
+
export const NUGET_ID_TOKEN_AUDIENCE = "https://www.nuget.org";
|
|
3
|
+
/**
|
|
4
|
+
* True when a `nuget` target may use trusted publishing: it does not set
|
|
5
|
+
* `auth: "token"` and pushes to nuget.org. With `auth` unset the target uses
|
|
6
|
+
* trusted publishing when its key's variable is not set, which the generator
|
|
7
|
+
* can't see, so the job gets the token; declaring it costs nothing.
|
|
8
|
+
*/
|
|
9
|
+
export function nugetIdTokenNeeded(targets) {
|
|
10
|
+
return targets.some((x) => x.type === "nuget" && x.auth !== "token" && x.pushUrl === undefined);
|
|
11
|
+
}
|
|
12
|
+
/** `NUGET_ID_TOKEN` in the GitLab publish job's `id_tokens`. GitHub asks for the token at run time from `id-token: write`, which the job already has. */
|
|
13
|
+
export const nugetFeature = {
|
|
14
|
+
name: "nuget",
|
|
15
|
+
steps: (c) => (c.forge === "gitlab" && c.job === "publish" && nugetIdTokenNeeded(c.input.publish ?? []) ? [{ slot: "idTokens", order: 20, items: [{ lines: [" NUGET_ID_TOKEN:", ` aud: ${NUGET_ID_TOKEN_AUDIENCE}`] }] }] : []),
|
|
16
|
+
};
|
|
@@ -15,8 +15,8 @@ export declare const NPM_TRUSTED_PUBLISHING_SETUP = "have=\"$(npm --version)\";
|
|
|
15
15
|
* What a GitHub release workflow needs for its targets, worked out from them
|
|
16
16
|
* (#4786), so no product wires it by hand:
|
|
17
17
|
*
|
|
18
|
-
* - an `oci` target on `ghcr.io` that
|
|
19
|
-
* job's token: `packages: write`, and `OCI_USERNAME` and `OCI_PASSWORD`
|
|
18
|
+
* - an `oci` target, or a `helm` target's `oci` (#5233), on `ghcr.io` that
|
|
19
|
+
* names no credentials pushes with the job's token: `packages: write`, and `OCI_USERNAME` and `OCI_PASSWORD`
|
|
20
20
|
* from `github.actor` and `github.token`;
|
|
21
21
|
* - an `npm` target on npmjs publishes with trusted publishing, which needs
|
|
22
22
|
* npm {@link NPM_TRUSTED_PUBLISHING_MIN}: the jobs upgrade npm when the
|
|
@@ -12,8 +12,8 @@ export const NPM_TRUSTED_PUBLISHING_SETUP = `have="$(npm --version)"; if [ "$(pr
|
|
|
12
12
|
* What a GitHub release workflow needs for its targets, worked out from them
|
|
13
13
|
* (#4786), so no product wires it by hand:
|
|
14
14
|
*
|
|
15
|
-
* - an `oci` target on `ghcr.io` that
|
|
16
|
-
* job's token: `packages: write`, and `OCI_USERNAME` and `OCI_PASSWORD`
|
|
15
|
+
* - an `oci` target, or a `helm` target's `oci` (#5233), on `ghcr.io` that
|
|
16
|
+
* names no credentials pushes with the job's token: `packages: write`, and `OCI_USERNAME` and `OCI_PASSWORD`
|
|
17
17
|
* from `github.actor` and `github.token`;
|
|
18
18
|
* - an `npm` target on npmjs publishes with trusted publishing, which needs
|
|
19
19
|
* npm {@link NPM_TRUSTED_PUBLISHING_MIN}: the jobs upgrade npm when the
|
|
@@ -26,7 +26,7 @@ export const NPM_TRUSTED_PUBLISHING_SETUP = `have="$(npm --version)"; if [ "$(pr
|
|
|
26
26
|
export function targetExtras(forge, targets, p) {
|
|
27
27
|
if (forge !== "github")
|
|
28
28
|
return {};
|
|
29
|
-
const ghcr = targets.some((t) => t.type === "oci" && /^ghcr\.io\//.test(t.repository ?? "") && !t.usernameEnv && !t.passwordEnv);
|
|
29
|
+
const ghcr = targets.some((t) => (t.type === "oci" && /^ghcr\.io\//.test(t.repository ?? "") && !t.usernameEnv && !t.passwordEnv) || (t.type === "helm" && /^ghcr\.io\//.test(t.oci?.repository ?? "") && !t.oci?.usernameEnv && !t.oci?.passwordEnv));
|
|
30
30
|
const npm = targets.some((t) => t.type === "npm" && (t.registry === undefined || /^https:\/\/registry\.npmjs\.org\/?$/.test(t.registry)));
|
|
31
31
|
const permissions = ghcr && p.permissions?.packages === undefined ? { packages: "write" } : undefined;
|
|
32
32
|
const env = ghcr ? Object.fromEntries(["OCI_USERNAME", "OCI_PASSWORD"].filter((k) => p.env?.[k] === undefined).map((k) => [k, k === "OCI_USERNAME" ? "${{ github.actor }}" : "${{ github.token }}"])) : {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReleaseGreenSource } from "../lifecycle/release-green.js";
|
|
2
2
|
import { type JobExtras, type ReleaseWorkflowForge } from "./release-workflow.js";
|
|
3
3
|
export interface TrainWorkflowInput {
|
|
4
|
-
forge:
|
|
4
|
+
forge: ReleaseWorkflowForge;
|
|
5
5
|
env: string;
|
|
6
6
|
trigger: "dispatch" | "tag";
|
|
7
7
|
chant: string;
|
|
@@ -22,8 +22,33 @@ export interface TrainWorkflowInput {
|
|
|
22
22
|
green: ReleaseGreenSource;
|
|
23
23
|
gate: "last-green" | "head";
|
|
24
24
|
lane?: string;
|
|
25
|
+
/**
|
|
26
|
+
* A member declares `release.images` or `release.artifacts` (#5216): the cut
|
|
27
|
+
* job stages what the cut built with `chant workspace train artifacts -o`
|
|
28
|
+
* and hands it to the publish job, which checks it (`--from`) after its
|
|
29
|
+
* build. A publish with nothing handed to it (a pushed train tag, a
|
|
30
|
+
* dispatched `train`) builds them again and checks them.
|
|
31
|
+
*/
|
|
32
|
+
files?: boolean;
|
|
33
|
+
/** Steps that set up goreleaser, in the cut and publish jobs, for a member's `release.artifacts` it builds (#5216); on GitLab, script lines. */
|
|
34
|
+
goreleaser?: string[];
|
|
35
|
+
/** GitLab: the publish signs with Sigstore, so a cut that runs the doctor gets `SIGSTORE_ID_TOKEN` to check it. */
|
|
36
|
+
signing?: boolean;
|
|
37
|
+
/** GitLab: entries the members' targets add under the publish job's `id_tokens:` beside `SIGSTORE_ID_TOKEN`, such as `PYPI_ID_TOKEN`. */
|
|
38
|
+
idTokens?: string[];
|
|
39
|
+
/** `chant release doctor` in each member before the cut (#5216): `--doctor` on the dispatched cut. */
|
|
40
|
+
doctor?: boolean;
|
|
41
|
+
/** `verified-releases`: `chant workspace train verify` before the publish (#5216). */
|
|
42
|
+
verify?: boolean;
|
|
25
43
|
}
|
|
26
44
|
/** The tag a train's cut pushes, as a GitHub tag filter: `*` stops at `/`, so a member's own tag starts nothing. */
|
|
27
45
|
export declare function trainTagFilter(env: string): string;
|
|
28
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* The cut step's script that reads the train id from the cut's JSON. It exits
|
|
48
|
+
* 1 when the file is not JSON, or names members cut and no train, so a train
|
|
49
|
+
* that was cut and recorded is never left unpublished by a skipped job. A
|
|
50
|
+
* file that is not JSON may still hold the id, and the error names it.
|
|
51
|
+
*/
|
|
52
|
+
export declare function trainIdScript(file: string, forge?: ReleaseWorkflowForge): string;
|
|
53
|
+
/** The train workflow (#5154), for GitHub and Forgejo, or GitLab (#5216). */
|
|
29
54
|
export declare function renderTrainWorkflow(o: TrainWorkflowInput): string;
|
|
@@ -14,26 +14,62 @@
|
|
|
14
14
|
* --yes`, which picks the members, labels each past every version it
|
|
15
15
|
* already has, cuts them, records the train and pushes the member tags
|
|
16
16
|
* and `release-train/<env>/<id>` in one push. A commit with nothing to
|
|
17
|
-
* release ends the run here.
|
|
17
|
+
* release ends the run here. A cut that recorded a train and whose JSON
|
|
18
|
+
* names no train id fails the job, so the publish is never skipped
|
|
19
|
+
* silently.
|
|
18
20
|
* - publish: in a checkout of the commit, `chant workspace train prepare`
|
|
19
21
|
* (stamp each member, build the packages they need), the build, and
|
|
20
22
|
* `chant workspace train publish <env> <id> --yes`, which stages, runs the
|
|
21
23
|
* members' `release.verify`, and reveals layer by layer.
|
|
22
24
|
*
|
|
25
|
+
* Dispatched with `train`, a recorded train's id, the gate and the cut are
|
|
26
|
+
* skipped and the publish job publishes that train from its tag's commit,
|
|
27
|
+
* resuming what an earlier run staged or revealed: the way to finish a
|
|
28
|
+
* publish that stopped or was skipped, with no new cut and no tag pushed.
|
|
29
|
+
*
|
|
23
30
|
* The publish job also runs on a pushed `release-train/<env>/*` tag, so a
|
|
24
31
|
* train cut from a workstation with `chant workspace train cut <env> --yes`
|
|
25
32
|
* publishes from the same file. With the tag trigger (the default) that is
|
|
26
33
|
* the whole workflow. A tag the job's own token pushed starts nothing, so a
|
|
27
34
|
* dispatched run publishes in its own publish job.
|
|
28
35
|
*/
|
|
29
|
-
import { tagComments } from "../action-pins.js";
|
|
30
|
-
import {
|
|
36
|
+
import { ACTION_PINS, tagComments, usesRef } from "../action-pins.js";
|
|
37
|
+
import { gateScript, githubSetup, jobPermissions, LEDGER_FETCH_FIRST } from "./release-workflow.js";
|
|
38
|
+
import { RELEASE_ARTIFACTS_ARTIFACT } from "./release-steps/artifacts.js";
|
|
39
|
+
/** Where the cut job stages the members' images and files, and the publish job finds them (#5216): outside the checkout. */
|
|
40
|
+
const TRAIN_STAGE = "$RUNNER_TEMP/chant-release-artifacts";
|
|
31
41
|
/** The tag a train's cut pushes, as a GitHub tag filter: `*` stops at `/`, so a member's own tag starts nothing. */
|
|
32
42
|
export function trainTagFilter(env) {
|
|
33
43
|
return `release-train/${env}/*`;
|
|
34
44
|
}
|
|
35
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* The cut step's script that reads the train id from the cut's JSON. It exits
|
|
47
|
+
* 1 when the file is not JSON, or names members cut and no train, so a train
|
|
48
|
+
* that was cut and recorded is never left unpublished by a skipped job. A
|
|
49
|
+
* file that is not JSON may still hold the id, and the error names it.
|
|
50
|
+
*/
|
|
51
|
+
export function trainIdScript(file, forge = "github") {
|
|
52
|
+
// How to publish a recorded train: dispatch the workflow with its id, or on GitLab run a pipeline with CHANT_RELEASE_TRAIN.
|
|
53
|
+
const rerun = (id) => (forge === "gitlab" ? `run a pipeline with CHANT_RELEASE_TRAIN=${id}` : `dispatch this workflow with train=${id}`);
|
|
54
|
+
const js = [
|
|
55
|
+
'const t=require("fs").readFileSync(process.argv[1],"utf8");',
|
|
56
|
+
"let d;",
|
|
57
|
+
"try{d=JSON.parse(t)}catch(e){",
|
|
58
|
+
'const m=/"id": *"(train-[^"]+)"/.exec(t);',
|
|
59
|
+
`console.error("the train cut printed more than its JSON document, so the train id can not be read ("+e.message+")."+(m?" The cut recorded "+m[1]+": ${rerun('"+m[1]+"')} to publish it.":" If it recorded a train, ${rerun("<id>")} to publish it."));`,
|
|
60
|
+
"process.exit(1)}",
|
|
61
|
+
'const id=d.train?.id??"";',
|
|
62
|
+
'if(!id&&d.released==null&&(d.members??[]).length>0){console.error("the train cut "+d.members.length+" member(s), and its JSON names no train id to publish");process.exit(1)}',
|
|
63
|
+
"process.stdout.write(id)",
|
|
64
|
+
].join("");
|
|
65
|
+
return `node -e '${js}' "${file}"`;
|
|
66
|
+
}
|
|
67
|
+
/** The ref of a train's tag, as an expression: what the publish job checks out for a dispatched `train`. */
|
|
68
|
+
const dispatchedTrainRef = (env) => `format('refs/tags/release-train/${env}/{0}', inputs.train)`;
|
|
69
|
+
/** The train workflow (#5154), for GitHub and Forgejo, or GitLab (#5216). */
|
|
36
70
|
export function renderTrainWorkflow(o) {
|
|
71
|
+
if (o.forge === "gitlab")
|
|
72
|
+
return renderGitlabTrainWorkflow(o);
|
|
37
73
|
const defaults = o.root ? [" defaults:", " run:", ` working-directory: ${o.root}`] : [];
|
|
38
74
|
const run = (l) => ` - run: ${l}`;
|
|
39
75
|
const block = (lines) => [" run: |", ...lines.map((l) => ` ${l}`)];
|
|
@@ -54,32 +90,153 @@ export function renderTrainWorkflow(o) {
|
|
|
54
90
|
" required: false",
|
|
55
91
|
" default: auto",
|
|
56
92
|
" type: string",
|
|
93
|
+
" train:",
|
|
94
|
+
" description: a recorded train's id (train-...) to publish instead of cutting one; the gate and cut are skipped, and the publish resumes from its tag",
|
|
95
|
+
" required: false",
|
|
96
|
+
" default: \"\"",
|
|
97
|
+
" type: string",
|
|
57
98
|
]
|
|
58
99
|
: []),
|
|
59
100
|
" push:",
|
|
60
101
|
` tags: [${JSON.stringify(trainTagFilter(env))}]`,
|
|
61
102
|
"permissions:",
|
|
62
|
-
" contents:
|
|
63
|
-
" id-token: write",
|
|
64
|
-
...o.extra.permissions,
|
|
103
|
+
" contents: read",
|
|
65
104
|
"concurrency:",
|
|
66
105
|
" group: chant-release",
|
|
67
106
|
" cancel-in-progress: false",
|
|
68
107
|
"jobs:",
|
|
69
108
|
];
|
|
70
109
|
if (dispatch) {
|
|
71
|
-
lines.push(" gate:", " if: github.event_name == 'workflow_dispatch'", " runs-on: ubuntu-latest", ...defaults, " outputs:", " commit: ${{ steps.green.outputs.commit }}", " steps:", ...githubSetup(undefined, o.chantSetup), ...installLines, ciFetch, " - id: green", ...block([...gateScript(o, "$GITHUB_SHA"), 'echo "commit=$commit" >> "$GITHUB_OUTPUT"']), " cut:", " needs: gate", " runs-on: ubuntu-latest", ...defaults, " outputs:", " train: ${{ steps.cut.outputs.train }}", ...o.extra.githubEnv([" CHANT_RELEASE_COMMIT: ${{ needs.gate.outputs.commit }}", " CHANT_RELEASE_LEVELS: ${{ inputs.levels }}", ...(o.cutToken ?? [])]), " steps:", ...githubSetup("${{ needs.gate.outputs.commit }}", o.fullSetup), ...installLines, ...o.extra.githubSteps, ciFetch, run(LEDGER_FETCH_FIRST), " - id: cut", ...block([
|
|
110
|
+
lines.push(" gate:", " if: github.event_name == 'workflow_dispatch' && inputs.train == ''", " runs-on: ubuntu-latest", ...jobPermissions(o.extra, { contents: "read" }, "gate"), ...defaults, " outputs:", " commit: ${{ steps.green.outputs.commit }}", " steps:", ...githubSetup(undefined, o.chantSetup), ...installLines, ciFetch, " - id: green", ...block([...gateScript(o, "$GITHUB_SHA"), 'echo "commit=$commit" >> "$GITHUB_OUTPUT"']), " cut:", " needs: gate", " runs-on: ubuntu-latest", ...jobPermissions(o.extra, { contents: "write" }, "cut"), ...defaults, " outputs:", " train: ${{ steps.cut.outputs.train }}", ...o.extra.githubEnv([" CHANT_RELEASE_COMMIT: ${{ needs.gate.outputs.commit }}", " CHANT_RELEASE_LEVELS: ${{ inputs.levels }}", ...new Set([...(o.cutToken ?? []), ...(o.doctor ? o.forgeToken : [])])]), " steps:", ...githubSetup("${{ needs.gate.outputs.commit }}", o.fullSetup), ...installLines, ...o.extra.githubSteps, ...(o.goreleaser ?? []), ciFetch, run(LEDGER_FETCH_FIRST), " - id: cut", ...block([
|
|
72
111
|
'git config user.name "chant release"',
|
|
73
112
|
'git config user.email "chant-release@localhost"',
|
|
74
|
-
`${o.chant} workspace train cut ${env} --at "$CHANT_RELEASE_COMMIT" --levels "\${CHANT_RELEASE_LEVELS:-auto}" --yes --json > "$RUNNER_TEMP/chant-train.json"`,
|
|
75
|
-
`
|
|
76
|
-
|
|
113
|
+
`${o.chant} workspace train cut ${env} --at "$CHANT_RELEASE_COMMIT" --levels "\${CHANT_RELEASE_LEVELS:-auto}"${o.doctor ? " --doctor" : ""} --yes --json > "$RUNNER_TEMP/chant-train.json"`,
|
|
114
|
+
`train="$(${trainIdScript("$RUNNER_TEMP/chant-train.json")})" || exit 1`,
|
|
115
|
+
'echo "train=$train" >> "$GITHUB_OUTPUT"',
|
|
116
|
+
]), ...(o.files
|
|
117
|
+
? [
|
|
118
|
+
" - if: steps.cut.outputs.train != ''",
|
|
119
|
+
` run: ${o.chant} workspace train artifacts ${env} "\${{ steps.cut.outputs.train }}" -o "${TRAIN_STAGE}"`,
|
|
120
|
+
" - if: steps.cut.outputs.train != ''",
|
|
121
|
+
` uses: ${usesRef(o.forge === "forgejo" ? ACTION_PINS.uploadArtifact3 : ACTION_PINS.uploadArtifact4)}`,
|
|
122
|
+
" with:",
|
|
123
|
+
` name: ${RELEASE_ARTIFACTS_ARTIFACT}`,
|
|
124
|
+
" path: ${{ runner.temp }}/chant-release-artifacts",
|
|
125
|
+
" if-no-files-found: error",
|
|
126
|
+
" retention-days: 1",
|
|
127
|
+
]
|
|
128
|
+
: []));
|
|
77
129
|
}
|
|
78
|
-
const publishIf = dispatch ? " if: ${{ always() && (github.event_name == 'push' || (needs.cut.result == 'success' && needs.cut.outputs.train != '')) }}" : null;
|
|
130
|
+
const publishIf = dispatch ? " if: ${{ always() && (github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.train != '') || (needs.cut.result == 'success' && needs.cut.outputs.train != '')) }}" : null;
|
|
131
|
+
// A dispatched `train` names the train itself, and its tag the commit to check out.
|
|
132
|
+
const dispatchedTrain = "${{ inputs.train || needs.cut.outputs.train }}";
|
|
133
|
+
const checkoutRef = `\${{ needs.gate.outputs.commit || (inputs.train != '' && ${dispatchedTrainRef(env)}) || github.sha }}`;
|
|
79
134
|
const trainFromRef = `echo "CHANT_RELEASE_TRAIN=\${CHANT_RELEASE_TRAIN:-\${GITHUB_REF_NAME#release-train/${env}/}}" >> "$GITHUB_ENV"`;
|
|
80
|
-
lines.push(" publish:", ...(dispatch ? [" needs: [gate, cut]", publishIf] : []), " runs-on: ubuntu-latest", ...defaults, ...o.extra.githubEnv([...(dispatch ? [
|
|
135
|
+
lines.push(" publish:", ...(dispatch ? [" needs: [gate, cut]", publishIf] : []), " runs-on: ubuntu-latest", ...jobPermissions(o.extra, { contents: "write", "id-token": "write" }, "publish"), ...defaults, ...o.extra.githubEnv([...(dispatch ? [` CHANT_RELEASE_TRAIN: ${dispatchedTrain}`] : []), ...o.forgeToken]), " steps:", ...githubSetup(dispatch ? checkoutRef : undefined, o.fullSetup), ...installLines, ...o.extra.githubSteps, ...(o.goreleaser ?? []), ciFetch, ledgerFetch, run(trainFromRef), run(`${o.chant} workspace train prepare ${env} "$CHANT_RELEASE_TRAIN"`), ...(o.build ? [run(o.build)] : []), ...(o.files
|
|
136
|
+
? dispatch
|
|
137
|
+
? [
|
|
138
|
+
" - if: needs.cut.outputs.train != ''",
|
|
139
|
+
` uses: ${usesRef(o.forge === "forgejo" ? ACTION_PINS.downloadArtifact3 : ACTION_PINS.downloadArtifact4)}`,
|
|
140
|
+
" with:",
|
|
141
|
+
` name: ${RELEASE_ARTIFACTS_ARTIFACT}`,
|
|
142
|
+
" path: ${{ runner.temp }}/chant-release-artifacts",
|
|
143
|
+
run(`${o.chant} workspace train artifacts ${env} "$CHANT_RELEASE_TRAIN" --from "${TRAIN_STAGE}"`),
|
|
144
|
+
]
|
|
145
|
+
: [run(`${o.chant} workspace train artifacts ${env} "$CHANT_RELEASE_TRAIN"`)]
|
|
146
|
+
: []), ...(o.verify ? [run(`${o.chant} workspace train verify ${env} "$CHANT_RELEASE_TRAIN"`)] : []), run('git config user.name "chant release"'), run('git config user.email "chant-release@localhost"'), run(`${o.chant} workspace train publish ${env} "$CHANT_RELEASE_TRAIN" ${o.flags}`));
|
|
81
147
|
if (o.after.length > 0) {
|
|
82
|
-
lines.push(" after-release:", ` needs: ${dispatch ? "[gate, cut, publish]" : "publish"}`, ...(dispatch ? [" if: ${{ always() && needs.publish.result == 'success' }}"] : []), " runs-on: ubuntu-latest", ...defaults, ...(dispatch ? [" env:",
|
|
148
|
+
lines.push(" after-release:", ` needs: ${dispatch ? "[gate, cut, publish]" : "publish"}`, ...(dispatch ? [" if: ${{ always() && needs.publish.result == 'success' }}"] : []), " runs-on: ubuntu-latest", ...jobPermissions(o.extra, { contents: "read" }, "after"), ...defaults, ...(dispatch ? [" env:", ` CHANT_RELEASE_TRAIN: ${dispatchedTrain}`] : []), " steps:", ...githubSetup(dispatch ? checkoutRef : undefined, o.fullSetup), run(trainFromRef), ...installLines, ...o.after.map(run));
|
|
83
149
|
}
|
|
84
150
|
return tagComments(`${lines.join("\n")}\n`);
|
|
85
151
|
}
|
|
152
|
+
/** Where a GitLab cut job stages the members' files: GitLab keeps a job's artifacts only inside the project directory (#5216). */
|
|
153
|
+
const GITLAB_TRAIN_STAGE = "$CI_PROJECT_DIR/.chant-release-artifacts";
|
|
154
|
+
/** Where the GitLab publish job moves them, out of the checkout, before it checks out the train's commit. */
|
|
155
|
+
const GITLAB_TRAIN_FROM = "/tmp/chant-release-artifacts";
|
|
156
|
+
/**
|
|
157
|
+
* GitLab (#5216). With `trigger: "dispatch"` a person runs a pipeline
|
|
158
|
+
* ("Run pipeline", the API or a trigger) with `CHANT_RELEASE_LEVELS` set
|
|
159
|
+
* (`auto`, or the levels): the gate names the commit, the cut job cuts the
|
|
160
|
+
* train and pushes its tags with `CHANT_RELEASE_TOKEN` (a project access
|
|
161
|
+
* token with `write_repository`, since a job token cannot push), and the
|
|
162
|
+
* publish job publishes it. Run with `CHANT_RELEASE_TRAIN` set to a recorded
|
|
163
|
+
* train's id instead, the gate and cut are left out and the publish job
|
|
164
|
+
* publishes that train from its tag, resuming. The dispatched file has no
|
|
165
|
+
* tag rule: the cut's own push would start a second publish of the same
|
|
166
|
+
* train. With `trigger: "tag"` the file is one publish job on a pushed
|
|
167
|
+
* `release-train/<env>/*` tag.
|
|
168
|
+
*
|
|
169
|
+
* Every job's script runs in one shell, so a variable set on one line is
|
|
170
|
+
* there on the next. The publish job checks out the commit the train's tag
|
|
171
|
+
* names in every case.
|
|
172
|
+
*/
|
|
173
|
+
function renderGitlabTrainWorkflow(o) {
|
|
174
|
+
const env = o.env;
|
|
175
|
+
const q = (l) => ` - ${JSON.stringify(l)}`;
|
|
176
|
+
const cd = o.root ? [`cd ${o.root}`] : [];
|
|
177
|
+
const install = o.install ? [o.install] : [];
|
|
178
|
+
const ciFetch = "git fetch origin 'refs/tags/ci/*:refs/tags/ci/*'";
|
|
179
|
+
const ledgerFetch = "git fetch origin chant/lifecycle:chant/lifecycle";
|
|
180
|
+
const auth = [
|
|
181
|
+
`chant_auth="$(printf 'oauth2:%s' "$CHANT_RELEASE_TOKEN" | base64 | tr -d '\\n')"`,
|
|
182
|
+
'export GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.extraheader GIT_CONFIG_VALUE_0="AUTHORIZATION: basic $chant_auth"',
|
|
183
|
+
"unset chant_auth",
|
|
184
|
+
];
|
|
185
|
+
const dispatch = o.trigger === "dispatch";
|
|
186
|
+
const manual = "$CI_PIPELINE_SOURCE =~ /^(web|api|trigger)$/";
|
|
187
|
+
const tagRule = `$CI_COMMIT_TAG =~ /^release-train\\/${env.replace(/[.*+?^${}()|[\]\\/]/g, (c) => `\\${c}`)}\\//`;
|
|
188
|
+
const cutRule = `$CHANT_RELEASE_LEVELS && ($CHANT_RELEASE_TRAIN == null || $CHANT_RELEASE_TRAIN == "") && ${manual}`;
|
|
189
|
+
const variables = (vars) => [" variables:", ' GIT_DEPTH: "0"', ...vars];
|
|
190
|
+
// The train: the one the pipeline names, else the one this pipeline's cut recorded, else the tag's. Then its commit, from its tag.
|
|
191
|
+
const trainLines = [
|
|
192
|
+
`export CHANT_RELEASE_TRAIN="\${CHANT_RELEASE_TRAIN:-\${CHANT_TRAIN_CUT:-\${CI_COMMIT_TAG#release-train/${env}/}}}"`,
|
|
193
|
+
'if [ -z "$CHANT_RELEASE_TRAIN" ]; then echo "no release train was cut or named, so there is nothing to publish"; exit 0; fi',
|
|
194
|
+
`git fetch origin "refs/tags/release-train/${env}/$CHANT_RELEASE_TRAIN"`,
|
|
195
|
+
"git checkout --detach FETCH_HEAD",
|
|
196
|
+
];
|
|
197
|
+
const lines = [];
|
|
198
|
+
if (dispatch) {
|
|
199
|
+
lines.push("chant-release-gate:", " rules:", ` - if: ${cutRule}`, ...variables([]), " artifacts:", " reports:", " dotenv: chant-release-gate.env", " script:", ...[...cd, ...install, ciFetch, ...gateScript(o, "$CI_COMMIT_SHA"), 'printf \'CHANT_RELEASE_COMMIT=%s\\n\' "$commit" > "$CI_PROJECT_DIR/chant-release-gate.env"'].map(q), "", "chant-release-cut:", " rules:", ` - if: ${cutRule}`, ...variables(o.extra.gitlabVariables), " needs: [chant-release-gate]", " artifacts:", ...(o.files ? [" paths:", ' - ".chant-release-artifacts/"', " expire_in: 1 day"] : []), " reports:", " dotenv: chant-release-train.env", ...(o.doctor && o.signing ? [" id_tokens:", " SIGSTORE_ID_TOKEN:", " aud: sigstore"] : []), " script:", ...[
|
|
200
|
+
'git checkout --detach "$CHANT_RELEASE_COMMIT"',
|
|
201
|
+
...cd,
|
|
202
|
+
...install,
|
|
203
|
+
...o.extra.gitlabScript,
|
|
204
|
+
...(o.goreleaser ?? []),
|
|
205
|
+
ciFetch,
|
|
206
|
+
...auth,
|
|
207
|
+
LEDGER_FETCH_FIRST,
|
|
208
|
+
'git config user.name "chant release"',
|
|
209
|
+
'git config user.email "chant-release@localhost"',
|
|
210
|
+
`${o.chant} workspace train cut ${env} --at "$CHANT_RELEASE_COMMIT" --levels "\${CHANT_RELEASE_LEVELS:-auto}"${o.doctor ? " --doctor" : ""} --yes --json > /tmp/chant-train.json`,
|
|
211
|
+
`train="$(${trainIdScript("/tmp/chant-train.json", "gitlab")})" || exit 1`,
|
|
212
|
+
'printf \'CHANT_TRAIN_CUT=%s\\n\' "$train" > "$CI_PROJECT_DIR/chant-release-train.env"',
|
|
213
|
+
...(o.files ? [`if [ -n "$train" ]; then ${o.chant} workspace train artifacts ${env} "$train" -o "${GITLAB_TRAIN_STAGE}"; fi`] : []),
|
|
214
|
+
].map(q), "");
|
|
215
|
+
}
|
|
216
|
+
const publishScript = (handed) => [
|
|
217
|
+
// The cut's staged files leave the checkout before it moves to the train's commit.
|
|
218
|
+
...(handed && o.files ? [`if [ -d "${GITLAB_TRAIN_STAGE}" ]; then mv "${GITLAB_TRAIN_STAGE}" ${GITLAB_TRAIN_FROM}; fi`] : []),
|
|
219
|
+
...trainLines,
|
|
220
|
+
...cd,
|
|
221
|
+
...install,
|
|
222
|
+
...o.extra.gitlabScript,
|
|
223
|
+
...(o.goreleaser ?? []),
|
|
224
|
+
ciFetch,
|
|
225
|
+
ledgerFetch,
|
|
226
|
+
...(dispatch ? auth : []),
|
|
227
|
+
`${o.chant} workspace train prepare ${env} "$CHANT_RELEASE_TRAIN"`,
|
|
228
|
+
...(o.build ? [o.build] : []),
|
|
229
|
+
...(o.files ? [`${o.chant} workspace train artifacts ${env} "$CHANT_RELEASE_TRAIN"${handed ? ` --from ${GITLAB_TRAIN_FROM}` : ""}`] : []),
|
|
230
|
+
...(o.verify ? [`${o.chant} workspace train verify ${env} "$CHANT_RELEASE_TRAIN"`] : []),
|
|
231
|
+
'git config user.name "chant release"',
|
|
232
|
+
'git config user.email "chant-release@localhost"',
|
|
233
|
+
`${o.chant} workspace train publish ${env} "$CHANT_RELEASE_TRAIN" ${o.flags}`,
|
|
234
|
+
];
|
|
235
|
+
const publishRules = dispatch ? [` - if: $CHANT_RELEASE_TRAIN && ${manual}`, ` - if: ${cutRule}`] : [` - if: ${tagRule}`];
|
|
236
|
+
const publishNeeds = dispatch ? [" needs:", " - job: chant-release-cut", " optional: true"] : [];
|
|
237
|
+
lines.push("chant-release-publish:", " rules:", ...publishRules, ...variables(o.extra.gitlabVariables), ...publishNeeds, " resource_group: chant-release", " id_tokens:", " SIGSTORE_ID_TOKEN:", " aud: sigstore", ...(o.idTokens ?? []), " script:", ...publishScript(dispatch).map(q));
|
|
238
|
+
if (o.after.length > 0) {
|
|
239
|
+
lines.push("", "chant-release-after:", " rules:", ...publishRules, ...variables([]), ...(dispatch ? [" needs:", " - job: chant-release-cut", " optional: true", " - job: chant-release-publish"] : [" needs: [chant-release-publish]"]), " script:", ...[...trainLines, ...cd, ...install].map(q), ...o.after.map((l) => ` - ${l}`));
|
|
240
|
+
}
|
|
241
|
+
return `${lines.join("\n")}\n`;
|
|
242
|
+
}
|
|
@@ -494,7 +494,7 @@ async function promoteAcrossRepos(query, train, now) {
|
|
|
494
494
|
}
|
|
495
495
|
return { kind: "ran", train, record, pending: null, approved: null, ledgerError };
|
|
496
496
|
}
|
|
497
|
-
const USAGE = "chant workspace train <env> [--pin <member>=<label|digest>]... [--dry-run] [--json] | chant workspace train list <env> [--json] | chant workspace train promote <env> [<train id|digest>] [--gate <name>] [--continue] [--dry-run] [--json] | chant workspace train cut <env> [--at <sha>] [--levels <levels>] [--yes] [--no-push] [--json] | chant workspace train prepare <env> [<train id|digest>] [--json] | chant workspace train publish <env> [<train id|digest>] [--yes] [--json]";
|
|
497
|
+
const USAGE = "chant workspace train <env> [--pin <member>=<label|digest>]... [--dry-run] [--json] | chant workspace train list <env> [--json] | chant workspace train promote <env> [<train id|digest>] [--gate <name>] [--continue] [--dry-run] [--json] | chant workspace train cut <env> [--at <sha>] [--levels <levels>] [--doctor] [--yes] [--no-push] [--json] | chant workspace train prepare <env> [<train id|digest>] [--json] | chant workspace train artifacts <env> [<train id|digest>] [--from <dir>] [-o <dir>] [--no-build] [--json] | chant workspace train verify <env> [<train id|digest>] [--json] | chant workspace train publish <env> [<train id|digest>] [--yes] [--json]";
|
|
498
498
|
/** Each train with the runs that promoted it, oldest first. */
|
|
499
499
|
export function trainsWithPromotions(trains, runs) {
|
|
500
500
|
const latest = latestRuns(runs);
|
|
@@ -525,6 +525,10 @@ export async function runWorkspaceTrain(ctx) {
|
|
|
525
525
|
const { runTrainPrepare } = await import("./train-prepare.js");
|
|
526
526
|
return runTrainPrepare(ctx, rest.slice(1));
|
|
527
527
|
}
|
|
528
|
+
if (rest[0] === "artifacts" || rest[0] === "verify") {
|
|
529
|
+
const m = await import("./train-artifacts.js");
|
|
530
|
+
return rest[0] === "artifacts" ? m.runTrainArtifacts(ctx, rest.slice(1)) : m.runTrainVerify(ctx, rest.slice(1));
|
|
531
|
+
}
|
|
528
532
|
if (rest[0] === "publish") {
|
|
529
533
|
const { runTrainPublish } = await import("./train-publish.js");
|
|
530
534
|
return runTrainPublish(ctx, rest.slice(1));
|
|
@@ -124,6 +124,12 @@ export interface ReleaseWorkflowInput {
|
|
|
124
124
|
* member's `go.mod`.
|
|
125
125
|
*/
|
|
126
126
|
goreleaser?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* An entry of `release.artifacts` is packaged by nfpm (#5233): the job that
|
|
129
|
+
* builds the files installs the nfpm {@link TOOL_PINS} pin, checked by
|
|
130
|
+
* SHA-256, and names it in `CHANT_NFPM`.
|
|
131
|
+
*/
|
|
132
|
+
nfpm?: boolean;
|
|
127
133
|
/**
|
|
128
134
|
* The green gate the cut checks (#5149), `release.green` resolved. Under
|
|
129
135
|
* `forge-checks` or `none` a dispatched release's gate names the
|
|
@@ -165,6 +171,17 @@ export interface ReleaseWorkflowInput {
|
|
|
165
171
|
*/
|
|
166
172
|
train?: {
|
|
167
173
|
env: string;
|
|
174
|
+
/**
|
|
175
|
+
* What the members declare (#5216): `release.images` (with the platforms
|
|
176
|
+
* they build, for QEMU), `release.artifacts`, and an artifact goreleaser
|
|
177
|
+
* builds. The jobs hand them from the cut to the publish.
|
|
178
|
+
*/
|
|
179
|
+
imagePlatforms?: string[];
|
|
180
|
+
images?: boolean;
|
|
181
|
+
artifacts?: boolean;
|
|
182
|
+
goreleaser?: boolean;
|
|
183
|
+
/** The directory, from the workspace root, of the member whose goreleaser build Go is set up for: its `go.mod` names the Go. */
|
|
184
|
+
goreleaserDir?: string;
|
|
168
185
|
};
|
|
169
186
|
}
|
|
170
187
|
/** What the generator reads of a `release.publish` target: enough to know which credentials and tools its job needs. */
|
|
@@ -180,8 +197,19 @@ export interface ReleaseWorkflowTarget {
|
|
|
180
197
|
registry?: string;
|
|
181
198
|
/** A `pypi` target's `auth`, `index` and `uploadUrl`. */
|
|
182
199
|
auth?: string;
|
|
183
|
-
index
|
|
200
|
+
/** A `pypi` target's index name, or a `helm` target's chart repository (#5233). */
|
|
201
|
+
index?: string | {
|
|
202
|
+
repo: string;
|
|
203
|
+
};
|
|
184
204
|
uploadUrl?: string;
|
|
205
|
+
/** A `helm` target's registry (#5233). */
|
|
206
|
+
oci?: {
|
|
207
|
+
repository: string;
|
|
208
|
+
usernameEnv?: string;
|
|
209
|
+
passwordEnv?: string;
|
|
210
|
+
};
|
|
211
|
+
/** A `nuget` target's `pushUrl` (#5232). */
|
|
212
|
+
pushUrl?: string;
|
|
185
213
|
}
|
|
186
214
|
export { RELEASE_RUNNER_PLATFORM } from "./release-steps/types.js";
|
|
187
215
|
export { NPM_TRUSTED_PUBLISHING_MIN, NPM_TRUSTED_PUBLISHING_SETUP, NPM_TRUSTED_PUBLISHING_VERSION, targetExtras } from "./release-steps/targets.js";
|
|
@@ -204,8 +232,8 @@ export declare function releaseTagFilters(tags: MemberTags): {
|
|
|
204
232
|
gitlabRule: string;
|
|
205
233
|
};
|
|
206
234
|
export interface JobExtras {
|
|
207
|
-
/**
|
|
208
|
-
permissions: string
|
|
235
|
+
/** The scopes the config and the targets add, which the jobs that need them take (#5234). */
|
|
236
|
+
permissions: Array<[string, string]>;
|
|
209
237
|
/** The job's `env:` block with `base` entries first, or nothing when there is neither. */
|
|
210
238
|
githubEnv: (base: string[]) => string[];
|
|
211
239
|
/** Steps after the install. */
|
|
@@ -215,6 +243,14 @@ export interface JobExtras {
|
|
|
215
243
|
/** GitLab: script lines after the install. */
|
|
216
244
|
gitlabScript: string[];
|
|
217
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* A job's `permissions:` block (#5234): the scopes it needs, then the config's
|
|
248
|
+
* and targets' extras it takes, one per line at the job's indent. The workflow
|
|
249
|
+
* itself grants `contents: read`, so no job holds a scope it does not name.
|
|
250
|
+
* The cut never takes `packages` (the publish pushes the images), and the
|
|
251
|
+
* extras the config set by hand go to both.
|
|
252
|
+
*/
|
|
253
|
+
export declare function jobPermissions(extra: Pick<JobExtras, "permissions">, base: Record<string, string>, job: "gate" | "cut" | "publish" | "after", indent?: string): string[];
|
|
218
254
|
/** `release.workflow`'s `permissions`, `env` and `setup` (#4751) as lines of the forge's file. Empty for a config without them, so its file is what it was. */
|
|
219
255
|
export declare function jobExtras(p: ReleasePipelineConfig, forge: ReleaseWorkflowForge): JobExtras;
|
|
220
256
|
/** The checkout and toolchain setup a GitHub or Forgejo job starts with (#5152); `ref` checks out that commit. */
|