@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
|
@@ -34,8 +34,19 @@
|
|
|
34
34
|
* dispatched run publishes in its own publish job.
|
|
35
35
|
*/
|
|
36
36
|
import { ACTION_PINS, tagComments, usesRef } from "../action-pins.js";
|
|
37
|
-
import { gateScript, githubSetup, jobPermissions, LEDGER_FETCH_FIRST } from "./release-workflow.js";
|
|
37
|
+
import { field, gateScript, GIT_TOKEN_ENV, githubSetup, jobPermissions, LEDGER_FETCH_FIRST } from "./release-workflow.js";
|
|
38
38
|
import { RELEASE_ARTIFACTS_ARTIFACT } from "./release-steps/artifacts.js";
|
|
39
|
+
import { packLine, unpackLine } from "./release-steps/builds.js";
|
|
40
|
+
import { releaseBuildArchive, releaseBuildArtifact } from "./release-toolchains.js";
|
|
41
|
+
/** The gate's output, and GitLab variable, that carries the label a build job's member is planned at. */
|
|
42
|
+
const labelOutput = (b) => `label-${b.name}`;
|
|
43
|
+
const labelVariable = (b) => `CHANT_TRAIN_LABEL_${b.name.toUpperCase().replaceAll("-", "_")}`;
|
|
44
|
+
/** The plan's label of a build's member, read from the plan file: empty when the member is not in the train. */
|
|
45
|
+
const plannedLabel = (b, file) => `${field(`d.members.find((m)=>m.member===${JSON.stringify(b.member)})?.label`)} ${file}`;
|
|
46
|
+
/** The gate's plan (#5237): the train's members and labels at the gate's commit, with no member's dry run. */
|
|
47
|
+
const planLine = (o, file) => `${o.chant} workspace train cut ${o.env} --at "$commit" --levels "\${CHANT_RELEASE_LEVELS:-auto}" --plan-only --json > ${file}`;
|
|
48
|
+
/** A shell word for a directory. */
|
|
49
|
+
const sq = (s) => (/^[A-Za-z0-9_./@+-]+$/.test(s) ? s : `'${s.replaceAll("'", "'\\''")}'`);
|
|
39
50
|
/** Where the cut job stages the members' images and files, and the publish job finds them (#5216): outside the checkout. */
|
|
40
51
|
const TRAIN_STAGE = "$RUNNER_TEMP/chant-release-artifacts";
|
|
41
52
|
/** The tag a train's cut pushes, as a GitHub tag filter: `*` stops at `/`, so a member's own tag starts nothing. */
|
|
@@ -78,6 +89,54 @@ export function renderTrainWorkflow(o) {
|
|
|
78
89
|
const ledgerFetch = run("git fetch origin chant/lifecycle:chant/lifecycle");
|
|
79
90
|
const dispatch = o.trigger === "dispatch";
|
|
80
91
|
const env = o.env;
|
|
92
|
+
const builds = dispatch ? (o.builds ?? []) : [];
|
|
93
|
+
const download = usesRef(o.forge === "forgejo" ? ACTION_PINS.downloadArtifact3 : ACTION_PINS.downloadArtifact4);
|
|
94
|
+
const built = (b) => `needs.build-${b.name}.result == 'success'`;
|
|
95
|
+
// #5237: each build's archive, from the run's build job, unpacked into its member: in the cut with -k, so it replaces no file of the commit.
|
|
96
|
+
const unpackSteps = (cut) => builds.flatMap((b) => [
|
|
97
|
+
` - if: ${built(b)}`,
|
|
98
|
+
` uses: ${download}`,
|
|
99
|
+
" with:",
|
|
100
|
+
` name: ${releaseBuildArtifact(b.name)}`,
|
|
101
|
+
" path: ${{ runner.temp }}/chant-release-builds",
|
|
102
|
+
` - if: ${built(b)}`,
|
|
103
|
+
` run: ${unpackLine(`"$RUNNER_TEMP/chant-release-builds/${releaseBuildArchive(b.name)}"`, cut)} -C ${sq(b.memberDir)}`,
|
|
104
|
+
]);
|
|
105
|
+
const q = (v) => JSON.stringify(v);
|
|
106
|
+
const buildJobs = builds.flatMap((b) => {
|
|
107
|
+
const install = b.install === false ? [] : b.install !== undefined ? [run(b.install)] : o.install ? [run(o.install), ` working-directory: ${o.root ?? "."}`] : [];
|
|
108
|
+
const runner = Array.isArray(b.runner) ? `[${b.runner.map(q).join(", ")}]` : q(b.runner);
|
|
109
|
+
const vars = Object.entries(b.env ?? {});
|
|
110
|
+
for (const [k] of vars)
|
|
111
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(k))
|
|
112
|
+
throw new Error(`release.workflow.builds.${b.name}.env: ${JSON.stringify(k)} is not a variable name`);
|
|
113
|
+
return [
|
|
114
|
+
` build-${b.name}:`,
|
|
115
|
+
" needs: gate",
|
|
116
|
+
` if: needs.gate.outputs.${labelOutput(b)} != ''`,
|
|
117
|
+
` runs-on: ${runner}`,
|
|
118
|
+
" permissions:",
|
|
119
|
+
" contents: read",
|
|
120
|
+
" defaults:",
|
|
121
|
+
" run:",
|
|
122
|
+
" shell: bash",
|
|
123
|
+
` working-directory: ${b.path}`,
|
|
124
|
+
" env:",
|
|
125
|
+
` CHANT_RELEASE_LABEL: \${{ needs.gate.outputs.${labelOutput(b)} }}`,
|
|
126
|
+
...vars.map(([k, v]) => ` ${k}: ${q(v)}`),
|
|
127
|
+
" steps:",
|
|
128
|
+
...githubSetup("${{ needs.gate.outputs.commit }}", b.setup, false),
|
|
129
|
+
...install,
|
|
130
|
+
` - run: ${q(b.build)}`,
|
|
131
|
+
` - run: ${q(packLine(b))}`,
|
|
132
|
+
` - uses: ${usesRef(o.forge === "forgejo" ? ACTION_PINS.uploadArtifact3 : ACTION_PINS.uploadArtifact4)}`,
|
|
133
|
+
" with:",
|
|
134
|
+
` name: ${releaseBuildArtifact(b.name)}`,
|
|
135
|
+
` path: ${b.path === "." ? "" : `${b.path}/`}${releaseBuildArchive(b.name)}`,
|
|
136
|
+
" if-no-files-found: error",
|
|
137
|
+
" retention-days: 1",
|
|
138
|
+
];
|
|
139
|
+
});
|
|
81
140
|
const lines = [
|
|
82
141
|
"name: chant release train",
|
|
83
142
|
"on:",
|
|
@@ -107,10 +166,23 @@ export function renderTrainWorkflow(o) {
|
|
|
107
166
|
"jobs:",
|
|
108
167
|
];
|
|
109
168
|
if (dispatch) {
|
|
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 }}",
|
|
169
|
+
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 }}", ...(builds.length > 0 ? [" planned: ${{ steps.green.outputs.planned }}", ...builds.map((b) => ` ${labelOutput(b)}: \${{ steps.green.outputs.${labelOutput(b)} }}`)] : []), ...(builds.length > 0 ? [" env:", " CHANT_RELEASE_LEVELS: ${{ inputs.levels }}"] : []), " steps:", ...githubSetup(undefined, o.chantSetup), ...installLines, ciFetch, " - id: green", ...block([
|
|
170
|
+
...gateScript(o, "$GITHUB_SHA"),
|
|
171
|
+
'echo "commit=$commit" >> "$GITHUB_OUTPUT"',
|
|
172
|
+
// #5237: the plan, so each build job builds with the label its member is cut at.
|
|
173
|
+
...(builds.length > 0
|
|
174
|
+
? [
|
|
175
|
+
planLine(o, '"$RUNNER_TEMP/chant-train-plan.json"'),
|
|
176
|
+
`echo "planned=$(${field("d.planned")} "$RUNNER_TEMP/chant-train-plan.json")" >> "$GITHUB_OUTPUT"`,
|
|
177
|
+
...builds.map((b) => `echo "${labelOutput(b)}=$(${plannedLabel(b, '"$RUNNER_TEMP/chant-train-plan.json"')})" >> "$GITHUB_OUTPUT"`),
|
|
178
|
+
]
|
|
179
|
+
: []),
|
|
180
|
+
]), ...buildJobs, " cut:", ...(builds.length > 0 ? [` needs: [gate, ${builds.map((b) => `build-${b.name}`).join(", ")}]`, " if: ${{ !cancelled() && needs.gate.result == 'success' && !contains(needs.*.result, 'failure') }}"] : [" 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 }}", ...(builds.length > 0 ? [" CHANT_TRAIN_PLANNED: ${{ needs.gate.outputs.planned }}"] : []), ...new Set([...(o.cutToken ?? []), ...(o.doctor ? o.forgeToken : [])]), ...(o.files ? GIT_TOKEN_ENV : [])]), " steps:",
|
|
181
|
+
// #5268: a cut that hands files on keeps no token in .git/config.
|
|
182
|
+
...githubSetup("${{ needs.gate.outputs.commit }}", o.fullSetup, !o.files), ...installLines, ...o.extra.githubSteps, ...(o.goreleaser ?? []), ciFetch, run(LEDGER_FETCH_FIRST), ...unpackSteps(true), " - id: cut", ...block([
|
|
111
183
|
'git config user.name "chant release"',
|
|
112
184
|
'git config user.email "chant-release@localhost"',
|
|
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"`,
|
|
185
|
+
`${o.chant} workspace train cut ${env} --at "$CHANT_RELEASE_COMMIT" --levels "\${CHANT_RELEASE_LEVELS:-auto}"${builds.length > 0 ? ' --planned "$CHANT_TRAIN_PLANNED"' : ""}${o.doctor ? " --doctor" : ""} --yes --json > "$RUNNER_TEMP/chant-train.json"`,
|
|
114
186
|
`train="$(${trainIdScript("$RUNNER_TEMP/chant-train.json")})" || exit 1`,
|
|
115
187
|
'echo "train=$train" >> "$GITHUB_OUTPUT"',
|
|
116
188
|
]), ...(o.files
|
|
@@ -132,7 +204,7 @@ export function renderTrainWorkflow(o) {
|
|
|
132
204
|
const dispatchedTrain = "${{ inputs.train || needs.cut.outputs.train }}";
|
|
133
205
|
const checkoutRef = `\${{ needs.gate.outputs.commit || (inputs.train != '' && ${dispatchedTrainRef(env)}) || github.sha }}`;
|
|
134
206
|
const trainFromRef = `echo "CHANT_RELEASE_TRAIN=\${CHANT_RELEASE_TRAIN:-\${GITHUB_REF_NAME#release-train/${env}/}}" >> "$GITHUB_ENV"`;
|
|
135
|
-
lines.push(" publish:", ...(dispatch ? [
|
|
207
|
+
lines.push(" publish:", ...(dispatch ? [` needs: [gate, cut${builds.map((b) => `, build-${b.name}`).join("")}]`, 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), ...unpackSteps(false), run(`${o.chant} workspace train prepare ${env} "$CHANT_RELEASE_TRAIN"`), ...(o.build ? [run(o.build)] : []), ...(o.files
|
|
136
208
|
? dispatch
|
|
137
209
|
? [
|
|
138
210
|
" - if: needs.cut.outputs.train != ''",
|
|
@@ -195,8 +267,62 @@ function renderGitlabTrainWorkflow(o) {
|
|
|
195
267
|
"git checkout --detach FETCH_HEAD",
|
|
196
268
|
];
|
|
197
269
|
const lines = [];
|
|
270
|
+
const builds = dispatch ? (o.builds ?? []) : [];
|
|
271
|
+
const archiveIn = (b) => `${b.memberDir === "." ? "" : `${b.memberDir}/`}${releaseBuildArchive(b.name)}`;
|
|
272
|
+
// #5237: GitLab hands each build's archive into the project directory, in its member; it is unpacked there and moved out, from the workspace root.
|
|
273
|
+
const unpack = (b, cut) => `if [ ${cut ? `-n "$${labelVariable(b)}"` : `-f ${sq(archiveIn(b))}`} ]; then ${unpackLine(sq(archiveIn(b)), cut)} -C ${sq(b.memberDir)}; mv ${sq(archiveIn(b))} /tmp/; fi`;
|
|
274
|
+
const buildJobs = builds.flatMap((b) => {
|
|
275
|
+
const install = b.install === false ? [] : b.install !== undefined ? [b.install] : o.install ? [o.install] : [];
|
|
276
|
+
const vars = Object.entries(b.env ?? {});
|
|
277
|
+
for (const [k] of vars)
|
|
278
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(k))
|
|
279
|
+
throw new Error(`release.workflow.builds.${b.name}.env: ${JSON.stringify(k)} is not a variable name`);
|
|
280
|
+
const tags = Array.isArray(b.runner) ? b.runner : [b.runner];
|
|
281
|
+
const cdMember = b.memberDir === "." ? [] : [`cd ${sq(b.memberDir)}`];
|
|
282
|
+
return [
|
|
283
|
+
`chant-release-build-${b.name}:`,
|
|
284
|
+
" rules:",
|
|
285
|
+
` - if: ${cutRule}`,
|
|
286
|
+
...variables(vars.map(([k, v]) => ` ${k}: ${JSON.stringify(v)}`)),
|
|
287
|
+
" needs: [chant-release-gate]",
|
|
288
|
+
` tags: [${tags.map((t) => JSON.stringify(t)).join(", ")}]`,
|
|
289
|
+
" artifacts:",
|
|
290
|
+
" paths:",
|
|
291
|
+
` - ${JSON.stringify(`${b.path === "." ? "" : `${b.path}/`}${releaseBuildArchive(b.name)}`)}`,
|
|
292
|
+
" expire_in: 1 day",
|
|
293
|
+
" script:",
|
|
294
|
+
...[
|
|
295
|
+
`export CHANT_RELEASE_LABEL="$${labelVariable(b)}"`,
|
|
296
|
+
`if [ -z "$CHANT_RELEASE_LABEL" ]; then echo "${b.member} is not in this train, so build-${b.name} builds nothing"; exit 0; fi`,
|
|
297
|
+
'git checkout --detach "$CHANT_RELEASE_COMMIT"',
|
|
298
|
+
...cd,
|
|
299
|
+
// The workflow's install runs at the workspace root, a build's own in its member.
|
|
300
|
+
...(b.install === undefined ? install : []),
|
|
301
|
+
...cdMember,
|
|
302
|
+
...(b.install !== undefined ? install : []),
|
|
303
|
+
b.build,
|
|
304
|
+
packLine(b),
|
|
305
|
+
].map(q),
|
|
306
|
+
"",
|
|
307
|
+
];
|
|
308
|
+
});
|
|
198
309
|
if (dispatch) {
|
|
199
|
-
|
|
310
|
+
const plan = "/tmp/chant-train-plan.json";
|
|
311
|
+
lines.push("chant-release-gate:", " rules:", ` - if: ${cutRule}`, ...variables([]), " artifacts:", " reports:", " dotenv: chant-release-gate.env", " script:", ...[
|
|
312
|
+
...cd,
|
|
313
|
+
...install,
|
|
314
|
+
ciFetch,
|
|
315
|
+
...gateScript(o, "$CI_COMMIT_SHA"),
|
|
316
|
+
'printf \'CHANT_RELEASE_COMMIT=%s\\n\' "$commit" > "$CI_PROJECT_DIR/chant-release-gate.env"',
|
|
317
|
+
// #5237: the plan, so each build job builds with the label its member is cut at.
|
|
318
|
+
...(builds.length > 0
|
|
319
|
+
? [
|
|
320
|
+
planLine(o, plan),
|
|
321
|
+
`printf 'CHANT_TRAIN_PLANNED=%s\\n' "$(${field("d.planned")} ${plan})" >> "$CI_PROJECT_DIR/chant-release-gate.env"`,
|
|
322
|
+
...builds.map((b) => `printf '${labelVariable(b)}=%s\\n' "$(${plannedLabel(b, plan)})" >> "$CI_PROJECT_DIR/chant-release-gate.env"`),
|
|
323
|
+
]
|
|
324
|
+
: []),
|
|
325
|
+
].map(q), "", ...buildJobs, "chant-release-cut:", " rules:", ` - if: ${cutRule}`, ...variables(o.extra.gitlabVariables), ` needs: [chant-release-gate${builds.map((b) => `, chant-release-build-${b.name}`).join("")}]`, " 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
326
|
'git checkout --detach "$CHANT_RELEASE_COMMIT"',
|
|
201
327
|
...cd,
|
|
202
328
|
...install,
|
|
@@ -205,9 +331,10 @@ function renderGitlabTrainWorkflow(o) {
|
|
|
205
331
|
ciFetch,
|
|
206
332
|
...auth,
|
|
207
333
|
LEDGER_FETCH_FIRST,
|
|
334
|
+
...builds.map((b) => unpack(b, true)),
|
|
208
335
|
'git config user.name "chant release"',
|
|
209
336
|
'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`,
|
|
337
|
+
`${o.chant} workspace train cut ${env} --at "$CHANT_RELEASE_COMMIT" --levels "\${CHANT_RELEASE_LEVELS:-auto}"${builds.length > 0 ? ' --planned "$CHANT_TRAIN_PLANNED"' : ""}${o.doctor ? " --doctor" : ""} --yes --json > /tmp/chant-train.json`,
|
|
211
338
|
`train="$(${trainIdScript("/tmp/chant-train.json", "gitlab")})" || exit 1`,
|
|
212
339
|
'printf \'CHANT_TRAIN_CUT=%s\\n\' "$train" > "$CI_PROJECT_DIR/chant-release-train.env"',
|
|
213
340
|
...(o.files ? [`if [ -n "$train" ]; then ${o.chant} workspace train artifacts ${env} "$train" -o "${GITLAB_TRAIN_STAGE}"; fi`] : []),
|
|
@@ -224,6 +351,7 @@ function renderGitlabTrainWorkflow(o) {
|
|
|
224
351
|
ciFetch,
|
|
225
352
|
ledgerFetch,
|
|
226
353
|
...(dispatch ? auth : []),
|
|
354
|
+
...(handed ? builds.map((b) => unpack(b, false)) : []),
|
|
227
355
|
`${o.chant} workspace train prepare ${env} "$CHANT_RELEASE_TRAIN"`,
|
|
228
356
|
...(o.build ? [o.build] : []),
|
|
229
357
|
...(o.files ? [`${o.chant} workspace train artifacts ${env} "$CHANT_RELEASE_TRAIN"${handed ? ` --from ${GITLAB_TRAIN_FROM}` : ""}`] : []),
|
|
@@ -233,7 +361,7 @@ function renderGitlabTrainWorkflow(o) {
|
|
|
233
361
|
`${o.chant} workspace train publish ${env} "$CHANT_RELEASE_TRAIN" ${o.flags}`,
|
|
234
362
|
];
|
|
235
363
|
const publishRules = dispatch ? [` - if: $CHANT_RELEASE_TRAIN && ${manual}`, ` - if: ${cutRule}`] : [` - if: ${tagRule}`];
|
|
236
|
-
const publishNeeds = dispatch ? [" needs:", " - job: chant-release-cut", " optional: true"] : [];
|
|
364
|
+
const publishNeeds = dispatch ? [" needs:", " - job: chant-release-cut", " optional: true", ...builds.flatMap((b) => [` - job: chant-release-build-${b.name}`, " optional: true"])] : [];
|
|
237
365
|
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
366
|
if (o.after.length > 0) {
|
|
239
367
|
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}`));
|
|
@@ -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>] [--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]";
|
|
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>] [--plan-only] [--planned <member=label ...|none>] [--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);
|
|
@@ -57,6 +57,9 @@ export interface ReleasePipelineConfig {
|
|
|
57
57
|
* hands its `outputs` to the cut and publish jobs, where they land at the
|
|
58
58
|
* same paths in the checkout before `chant release cut` runs. `dispatch`
|
|
59
59
|
* only: with the tag trigger the release was cut before the workflow ran.
|
|
60
|
+
* In a train (#5237) each member declares its own, in its directory, and
|
|
61
|
+
* the root's train workflow runs them with the label the gate plans for
|
|
62
|
+
* that member; the root itself declares none.
|
|
60
63
|
*/
|
|
61
64
|
builds?: ReleaseBuildConfig[];
|
|
62
65
|
/** Where the workflow is written, from the repository root, such as `.github/workflows/publish.yml` for an npm trusted publisher that names that file. Default {@link RELEASE_WORKFLOW_FILES}. */
|
|
@@ -182,6 +185,19 @@ export interface ReleaseWorkflowInput {
|
|
|
182
185
|
goreleaser?: boolean;
|
|
183
186
|
/** The directory, from the workspace root, of the member whose goreleaser build Go is set up for: its `go.mod` names the Go. */
|
|
184
187
|
goreleaserDir?: string;
|
|
188
|
+
/**
|
|
189
|
+
* The members' `release.workflow.builds` (#5237): each a per-platform
|
|
190
|
+
* build job of the member at `dir` (from the workspace root), run with
|
|
191
|
+
* the label the gate's plan gives that member. `files` are the toolchain
|
|
192
|
+
* marker files in the member's directory, which a build with no
|
|
193
|
+
* `toolchains` sets up from.
|
|
194
|
+
*/
|
|
195
|
+
builds?: Array<{
|
|
196
|
+
member: string;
|
|
197
|
+
dir: string;
|
|
198
|
+
files?: string[];
|
|
199
|
+
build: ReleaseBuildConfig;
|
|
200
|
+
}>;
|
|
185
201
|
};
|
|
186
202
|
}
|
|
187
203
|
/** What the generator reads of a `release.publish` target: enough to know which credentials and tools its job needs. */
|
|
@@ -253,6 +269,16 @@ export interface JobExtras {
|
|
|
253
269
|
export declare function jobPermissions(extra: Pick<JobExtras, "permissions">, base: Record<string, string>, job: "gate" | "cut" | "publish" | "after", indent?: string): string[];
|
|
254
270
|
/** `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. */
|
|
255
271
|
export declare function jobExtras(p: ReleasePipelineConfig, forge: ReleaseWorkflowForge): JobExtras;
|
|
272
|
+
/**
|
|
273
|
+
* A job that uploads a workflow artifact checks out without persisting the
|
|
274
|
+
* token in `.git/config` (#5268), where the upload could sweep it up, and
|
|
275
|
+
* these lines give its git the job's token instead: a credential helper for
|
|
276
|
+
* the forge's own host only, read from the job's environment, which no
|
|
277
|
+
* upload carries. The cut's fetches, the ledger push and the tag push use it.
|
|
278
|
+
*/
|
|
279
|
+
export declare const GIT_TOKEN_ENV: string[];
|
|
280
|
+
/** The job's steps upload a workflow artifact (#5268). */
|
|
281
|
+
export declare const uploadsArtifact: (steps: readonly string[]) => boolean;
|
|
256
282
|
/** The checkout and toolchain setup a GitHub or Forgejo job starts with (#5152); `ref` checks out that commit. */
|
|
257
283
|
export declare function githubSetup(ref: string | undefined, setup: readonly string[], persist?: boolean): string[];
|
|
258
284
|
interface DispatchInput {
|
|
@@ -46,15 +46,15 @@
|
|
|
46
46
|
import { readFileSync } from "node:fs";
|
|
47
47
|
import { ACTION_PINS, tagComments, usesRef } from "../action-pins.js";
|
|
48
48
|
import { TOOL_PINS } from "../tool-pins.js";
|
|
49
|
-
import { releaseImagePlatforms, resolveReleaseImages } from "../lifecycle/release-images.js";
|
|
49
|
+
import { placeReleaseImages, releaseImagePlatforms, resolveReleaseImages } from "../lifecycle/release-images.js";
|
|
50
50
|
import { GENERATED_MARKER } from "../discovery/files.js";
|
|
51
51
|
import { tagShape } from "../lifecycle/release-tag.js";
|
|
52
|
-
import { checkBuilds, releaseBuildArchive, releaseBuildArtifact, resolveToolchains, toolchainLines } from "./release-toolchains.js";
|
|
52
|
+
import { buildJobToolchains, checkBuilds, releaseBuildArchive, releaseBuildArtifact, resolveToolchains, toolchainLines } from "./release-toolchains.js";
|
|
53
53
|
import { releaseJobSteps, releaseSetupSteps } from "./release-steps/index.js";
|
|
54
54
|
import { packLine } from "./release-steps/builds.js";
|
|
55
55
|
import { RELEASE_BINFMT_IMAGE, qemuArchitectures } from "./release-steps/qemu.js";
|
|
56
56
|
import { targetExtras } from "./release-steps/targets.js";
|
|
57
|
-
import { goreleaserSetup } from "./release-steps/goreleaser.js";
|
|
57
|
+
import { goreleaserSetup, setsUpGo } from "./release-steps/goreleaser.js";
|
|
58
58
|
import { renderTrainWorkflow } from "./release-train-workflow.js";
|
|
59
59
|
export const RELEASE_WORKFLOW_FORGES = ["github", "forgejo", "gitlab"];
|
|
60
60
|
/** Where each forge's publish workflow is written, relative to the repository root. */
|
|
@@ -96,7 +96,7 @@ export function renderReleaseWorkflow(input) {
|
|
|
96
96
|
throw new Error("release.workflow.toolchains: a GitLab job runs in its runner's image, which brings the toolchain; name the image in .gitlab-ci.yml (default: image:) and leave toolchains out");
|
|
97
97
|
}
|
|
98
98
|
const chantSetup = toolchainLines(resolveToolchains(p.toolchains === false ? false : (p.toolchains ?? []).filter((t) => (typeof t === "string" ? t : t.name) === "node"), new Set(), root, p.toolchains !== false));
|
|
99
|
-
const fullSetup = toolchainLines(
|
|
99
|
+
const fullSetup = toolchainLines(buildJobToolchains(p.toolchains, input.projectFiles, root));
|
|
100
100
|
const builds = p.builds ?? [];
|
|
101
101
|
if (builds.length > 0) {
|
|
102
102
|
if (p.trigger !== "dispatch")
|
|
@@ -145,10 +145,31 @@ export function renderReleaseWorkflow(input) {
|
|
|
145
145
|
// #5154: the root's members released as a train.
|
|
146
146
|
if (input.train) {
|
|
147
147
|
if (builds.length > 0)
|
|
148
|
-
throw new Error("release.workflow.builds: a train
|
|
148
|
+
throw new Error("release.workflow.builds at the root: a train releases its members, not the root; declare each build in the release.workflow.builds of the member whose files it builds");
|
|
149
149
|
if (images || input.artifacts)
|
|
150
150
|
throw new Error("release.images and release.artifacts at the root: a train releases its members, not the root; declare them in the member that publishes them");
|
|
151
151
|
const t = input.train;
|
|
152
|
+
// #5237: the members' per-platform builds, each run with the label the gate's plan gives its member.
|
|
153
|
+
const memberBuilds = t.builds ?? [];
|
|
154
|
+
if (memberBuilds.length > 0) {
|
|
155
|
+
if (p.trigger !== "dispatch")
|
|
156
|
+
throw new Error('release.workflow.builds in a member: the tag trigger publishes a train cut before the workflow ran, so nothing built here would be in it; use trigger: "dispatch"');
|
|
157
|
+
try {
|
|
158
|
+
checkBuilds(memberBuilds.map((b) => b.build));
|
|
159
|
+
}
|
|
160
|
+
catch (err) {
|
|
161
|
+
throw new Error(`${err instanceof Error ? err.message : String(err)} (a train runs every member's builds in one workflow, so each job name is used once across the members)`);
|
|
162
|
+
}
|
|
163
|
+
if (input.forge === "gitlab" && memberBuilds.some((b) => b.build.toolchains && b.build.toolchains.length > 0))
|
|
164
|
+
throw new Error("release.workflow.builds: toolchains: a GitLab job runs in its runner's image, which brings the toolchain; leave toolchains out");
|
|
165
|
+
}
|
|
166
|
+
const trainBuilds = memberBuilds.map((b) => {
|
|
167
|
+
const dir = [root, b.dir].filter((d) => !!d && d !== ".").join("/") || ".";
|
|
168
|
+
// The toolchains the build names, else those the member's files name, else the root's.
|
|
169
|
+
const own = (b.files ?? []).length > 0;
|
|
170
|
+
const setup = toolchainLines(resolveToolchains(b.build.toolchains !== undefined ? b.build.toolchains : p.toolchains === false ? false : own ? undefined : p.toolchains, own ? new Set(b.files) : files, own ? (dir === "." ? null : dir) : root, false));
|
|
171
|
+
return { ...b.build, member: b.member, memberDir: b.dir, path: dir, setup };
|
|
172
|
+
});
|
|
152
173
|
const trainContext = { forge: input.forge, shape: "dispatch", input: { ...input, imagePlatforms: t.imagePlatforms ?? [] }, pipeline: p, chant, root, verify: false, images: t.images === true, archives: [], artifacts: false, version: false, doctor: false, signing: input.signing === true, green, builds: [] };
|
|
153
174
|
return renderTrainWorkflow({
|
|
154
175
|
forge: input.forge,
|
|
@@ -170,11 +191,12 @@ export function renderReleaseWorkflow(input) {
|
|
|
170
191
|
...(input.lane ? { lane: input.lane } : {}),
|
|
171
192
|
// #5216: the members' images and files, from the cut to the publish; the doctor before the cut; verify before the publish.
|
|
172
193
|
files: t.images === true || t.artifacts === true,
|
|
173
|
-
...(t.artifacts && t.goreleaser ? { goreleaser: ((g) => (input.forge === "gitlab" ? g.gitlab : g.github))(goreleaserSetup(input.forge, [root, t.goreleaserDir].filter((d) => !!d && d !== ".").join("/") || null, p)) } : {}),
|
|
194
|
+
...(t.artifacts && t.goreleaser ? { goreleaser: ((g) => (input.forge === "gitlab" ? g.gitlab : g.github))(goreleaserSetup(input.forge, [root, t.goreleaserDir].filter((d) => !!d && d !== ".").join("/") || null, p, setsUpGo(p, input.projectFiles, root))) } : {}),
|
|
174
195
|
...(input.signing ? { signing: true } : {}),
|
|
175
196
|
...(input.forge === "gitlab" ? { idTokens: stepLines(releaseJobSteps({ ...trainContext, job: "publish", label: '"$CHANT_RELEASE_TRAIN"' })("idTokens"), (l) => l) } : {}),
|
|
176
197
|
doctor: p.trigger === "dispatch" && p.doctor !== false,
|
|
177
198
|
verify: input.groups.has("verified-releases"),
|
|
199
|
+
...(trainBuilds.length > 0 ? { builds: trainBuilds } : {}),
|
|
178
200
|
});
|
|
179
201
|
}
|
|
180
202
|
if (shape === "dispatch") {
|
|
@@ -439,6 +461,21 @@ export function jobExtras(p, forge) {
|
|
|
439
461
|
gitlabScript: setup.flatMap((s) => ("uses" in s ? [] : [...Object.entries(s.env ?? {}).map(([k, v]) => `export ${k}=${q(v)}`), s.run])),
|
|
440
462
|
};
|
|
441
463
|
}
|
|
464
|
+
/**
|
|
465
|
+
* A job that uploads a workflow artifact checks out without persisting the
|
|
466
|
+
* token in `.git/config` (#5268), where the upload could sweep it up, and
|
|
467
|
+
* these lines give its git the job's token instead: a credential helper for
|
|
468
|
+
* the forge's own host only, read from the job's environment, which no
|
|
469
|
+
* upload carries. The cut's fetches, the ledger push and the tag push use it.
|
|
470
|
+
*/
|
|
471
|
+
export const GIT_TOKEN_ENV = [
|
|
472
|
+
" CHANT_RELEASE_GIT_TOKEN: ${{ github.token }}",
|
|
473
|
+
' GIT_CONFIG_COUNT: "1"',
|
|
474
|
+
" GIT_CONFIG_KEY_0: credential.${{ github.server_url }}.helper",
|
|
475
|
+
` GIT_CONFIG_VALUE_0: ${JSON.stringify('!f() { test "$1" = get && echo username=x-access-token && echo "password=$CHANT_RELEASE_GIT_TOKEN"; }; f')}`,
|
|
476
|
+
];
|
|
477
|
+
/** The job's steps upload a workflow artifact (#5268). */
|
|
478
|
+
export const uploadsArtifact = (steps) => steps.some((l) => /uses:\s*actions\/upload-artifact@/.test(l));
|
|
442
479
|
/** The checkout and toolchain setup a GitHub or Forgejo job starts with (#5152); `ref` checks out that commit. */
|
|
443
480
|
export function githubSetup(ref, setup, persist = true) {
|
|
444
481
|
return [
|
|
@@ -570,6 +607,8 @@ function renderGithubDispatch(o) {
|
|
|
570
607
|
const cutStep = (slot) => stepLines(cut(slot), run);
|
|
571
608
|
const publishStep = (slot) => stepLines(publish(slot), run);
|
|
572
609
|
const built = o.builds.map((b) => `build-${b.name}`);
|
|
610
|
+
// #5268: a cut that hands files on keeps no token in .git/config.
|
|
611
|
+
const cutUploads = uploadsArtifact(cutStep("afterCut"));
|
|
573
612
|
const lines = [
|
|
574
613
|
"name: chant release",
|
|
575
614
|
"on:",
|
|
@@ -607,9 +646,9 @@ function renderGithubDispatch(o) {
|
|
|
607
646
|
" runs-on: ubuntu-latest",
|
|
608
647
|
...jobPermissions(o.extra, { contents: "write", ...(o.context.signing && o.context.doctor ? { "id-token": "write" } : {}) }, "cut"),
|
|
609
648
|
...defaults,
|
|
610
|
-
...o.extra.githubEnv([` CHANT_RELEASE_COMMIT: ${commit}`, ` CHANT_RELEASE_LABEL: ${GATE_LABEL}`, ...cutEnvToken(o)]),
|
|
649
|
+
...o.extra.githubEnv([` CHANT_RELEASE_COMMIT: ${commit}`, ` CHANT_RELEASE_LABEL: ${GATE_LABEL}`, ...cutEnvToken(o), ...(cutUploads ? GIT_TOKEN_ENV : [])]),
|
|
611
650
|
" steps:",
|
|
612
|
-
...githubSetup(commit, o.fullSetup),
|
|
651
|
+
...githubSetup(commit, o.fullSetup, !cutUploads),
|
|
613
652
|
...installLines,
|
|
614
653
|
...o.extra.githubSteps,
|
|
615
654
|
...cutStep("prepare"),
|
|
@@ -809,6 +848,8 @@ export async function runReleaseWorkflow(ctx) {
|
|
|
809
848
|
// #5154: a train publishes its members' targets, so their credentials, tools and signing are the workflow's.
|
|
810
849
|
const memberReleases = [];
|
|
811
850
|
let goreleaserDir;
|
|
851
|
+
// #5237: the members' per-platform builds, each with its member.
|
|
852
|
+
const memberBuilds = [];
|
|
812
853
|
if (release?.train) {
|
|
813
854
|
const { locateWorkspace } = await import("./which-chant.js");
|
|
814
855
|
const { readDeclaration } = await import("./declaration.js");
|
|
@@ -819,6 +860,12 @@ export async function runReleaseWorkflow(ctx) {
|
|
|
819
860
|
const r = (await loadChantConfig(join(root, m.dir))).config.release;
|
|
820
861
|
if (r)
|
|
821
862
|
memberReleases.push(r);
|
|
863
|
+
if ((r?.workflow?.builds?.length ?? 0) > 0) {
|
|
864
|
+
const { TOOLCHAIN_MARKERS } = await import("./release-toolchains.js");
|
|
865
|
+
const files = TOOLCHAIN_MARKERS.filter((f) => existsSync(join(root, m.dir, f)));
|
|
866
|
+
for (const build of r.workflow.builds)
|
|
867
|
+
memberBuilds.push({ member: m.name, dir: m.dir.split(sep).join("/"), files, build });
|
|
868
|
+
}
|
|
822
869
|
if (r?.artifacts && goreleaserDir === undefined && (await import("../lifecycle/release-artifacts.js")).usesGoreleaser(r.artifacts))
|
|
823
870
|
goreleaserDir = m.dir.split(sep).join("/");
|
|
824
871
|
}
|
|
@@ -827,18 +874,18 @@ export async function runReleaseWorkflow(ctx) {
|
|
|
827
874
|
return 1;
|
|
828
875
|
}
|
|
829
876
|
}
|
|
830
|
-
// #5216: a member's files are built by its cut, in the train's cut job;
|
|
877
|
+
// #5216: a member's files are built by its cut, in the train's cut job; #5237: or by the member's own release.workflow.builds, which builtBy names.
|
|
831
878
|
const { checkReleaseArtifacts, ReleaseArtifactError } = await import("../lifecycle/release-artifacts.js");
|
|
832
879
|
for (const r of memberReleases) {
|
|
833
880
|
if ((r.artifacts?.length ?? 0) === 0)
|
|
834
881
|
continue;
|
|
835
882
|
try {
|
|
836
|
-
checkReleaseArtifacts(r.artifacts, { builds: [] });
|
|
883
|
+
checkReleaseArtifacts(r.artifacts, { builds: r.workflow?.builds ?? [] });
|
|
837
884
|
}
|
|
838
885
|
catch (err) {
|
|
839
886
|
if (!(err instanceof ReleaseArtifactError))
|
|
840
887
|
throw err;
|
|
841
|
-
console.error(formatError({ message: `release.train: a member's ${err.message} [${err.code}]`, hint:
|
|
888
|
+
console.error(formatError({ message: `release.train: a member's ${err.message} [${err.code}]`, hint: err.fix ?? "Fix release.artifacts in the member's chant.config.ts." }));
|
|
842
889
|
return 1;
|
|
843
890
|
}
|
|
844
891
|
}
|
|
@@ -877,7 +924,7 @@ export async function runReleaseWorkflow(ctx) {
|
|
|
877
924
|
workspaceRoot,
|
|
878
925
|
tags,
|
|
879
926
|
...(release?.workflow ? { pipeline: release.workflow } : {}),
|
|
880
|
-
...((release?.images?.length ?? 0) > 0 ? { images: true, imageArchives: resolveReleaseImages(release.images).map((i) => i.archive), imagePlatforms: releaseImagePlatforms(release.images) } : {}),
|
|
927
|
+
...((release?.images?.length ?? 0) > 0 ? { images: true, imageArchives: resolveReleaseImages(placeReleaseImages(release.images, release.artifacts ?? [])).map((i) => i.archive), imagePlatforms: releaseImagePlatforms(release.images) } : {}),
|
|
881
928
|
...((release?.artifacts?.length ?? 0) > 0 ? { artifacts: true, ...((await import("../lifecycle/release-artifacts.js")).usesGoreleaser(release.artifacts) ? { goreleaser: true } : {}), ...((await import("../lifecycle/release-artifacts.js")).usesNfpm(release.artifacts) ? { nfpm: true } : {}) } : {}),
|
|
882
929
|
...(release?.lane ? { lane: release.lane } : {}),
|
|
883
930
|
green: await (async () => {
|
|
@@ -902,6 +949,7 @@ export async function runReleaseWorkflow(ctx) {
|
|
|
902
949
|
env: release.train.env,
|
|
903
950
|
...(memberImages.length > 0 ? { images: true, imagePlatforms: releaseImagePlatforms(memberImages) } : {}),
|
|
904
951
|
...(memberArtifacts.length > 0 ? { artifacts: true, ...((await import("../lifecycle/release-artifacts.js")).usesGoreleaser(memberArtifacts) ? { goreleaser: true, ...(goreleaserDir ? { goreleaserDir } : {}) } : {}) } : {}),
|
|
952
|
+
...(memberBuilds.length > 0 ? { builds: memberBuilds } : {}),
|
|
905
953
|
},
|
|
906
954
|
}
|
|
907
955
|
: {}),
|
|
@@ -32,9 +32,8 @@ import { readDeclaration } from "./declaration.js";
|
|
|
32
32
|
import { findTrain, readReleaseTrains } from "./release-train.js";
|
|
33
33
|
import { ownChant, TrainCutError } from "./train-cut.js";
|
|
34
34
|
import { locateWorkspace } from "./which-chant.js";
|
|
35
|
-
import { NEXT_RELEASE } from "../release-floors.js";
|
|
36
35
|
/** The first chant with `chant workspace train artifacts`, `train verify` and `train cut --doctor`, and a train publish that gives a member with images its digests in `CHANT_RELEASE_DIGESTS` (#5216): what the train workflow's cut and publish jobs run. */
|
|
37
|
-
export const TRAIN_ARTIFACTS_FLOOR =
|
|
36
|
+
export const TRAIN_ARTIFACTS_FLOOR = "0.124.103";
|
|
38
37
|
/** The file `-o` writes beside the staged files, naming the members staged. */
|
|
39
38
|
export const TRAIN_ARTIFACTS_INDEX = "chant-train-artifacts.json";
|
|
40
39
|
/** The train, and its members cut from the commit checked out at the workspace root. */
|
|
@@ -77,7 +76,7 @@ export async function trainArtifacts(q) {
|
|
|
77
76
|
const { loadChantConfig } = await import("../config.js");
|
|
78
77
|
const { resolveRelease } = await import("../lifecycle/release-store.js");
|
|
79
78
|
const { releaseArtifactFiles } = await import("../lifecycle/release-artifacts.js");
|
|
80
|
-
const { resolveReleaseImages } = await import("../lifecycle/release-images.js");
|
|
79
|
+
const { placeReleaseImages, resolveReleaseImages } = await import("../lifecycle/release-images.js");
|
|
81
80
|
const chant = q.chant ?? spawnMemberChant;
|
|
82
81
|
const say = q.say ?? (() => undefined);
|
|
83
82
|
const out = [];
|
|
@@ -91,7 +90,7 @@ export async function trainArtifacts(q) {
|
|
|
91
90
|
const found = await resolveRelease(m.releaseDigest, { cwd: m.dir });
|
|
92
91
|
if (!found)
|
|
93
92
|
throw new TrainCutError("release-not-found", `${m.member}: the train pins release ${m.releaseDigest}, which no cut in the member names`, `Fetch chant/lifecycle (git fetch origin chant/lifecycle:chant/lifecycle) in the train's checkout.`);
|
|
94
|
-
const images = resolveReleaseImages(declaredImages).map((i) => i.archive.replace(/^\.\//, ""));
|
|
93
|
+
const images = resolveReleaseImages(placeReleaseImages(declaredImages, declaredFiles)).map((i) => i.archive.replace(/^\.\//, ""));
|
|
95
94
|
const files = releaseArtifactFiles(found.release, declaredFiles.map((d) => d.name)).map((f) => f.path);
|
|
96
95
|
let copied = 0;
|
|
97
96
|
if (q.from !== undefined) {
|
|
@@ -37,9 +37,17 @@
|
|
|
37
37
|
* the commit. A workflow on that tag publishes the train.
|
|
38
38
|
*
|
|
39
39
|
* Without `--yes` it plans: it prints the members and labels, runs each
|
|
40
|
-
* cut's dry run, and cuts, records, tags and pushes nothing.
|
|
40
|
+
* cut's dry run, and cuts, records, tags and pushes nothing. `--plan-only`
|
|
41
|
+
* (#5237) prints the members and labels and runs no member's dry run: what
|
|
42
|
+
* a workflow's gate reads to give each per-platform build job its member's
|
|
43
|
+
* label. `--planned "<member>=<label> ..."` (or `none`) then makes the cut
|
|
44
|
+
* refuse (`train-plan-changed`) unless it plans exactly those members at
|
|
45
|
+
* those labels, so the files the build jobs made carry the labels the cut
|
|
46
|
+
* records.
|
|
41
47
|
*/
|
|
42
48
|
import { type ReleaseBump } from "./release-changed.js";
|
|
49
|
+
/** The first chant with `chant workspace train cut --plan-only` and `--planned` (#5237): what the train workflow's gate and cut jobs run when a member declares `release.workflow.builds`. */
|
|
50
|
+
export declare const TRAIN_BUILDS_FLOOR = "0.124.104";
|
|
43
51
|
/** `release.train` in a workspace root's `chant.config.ts` (#5154). */
|
|
44
52
|
export interface ReleaseTrainConfig {
|
|
45
53
|
/** The environment the train is recorded for, and the middle of its tag `release-train/<env>/<id>`. */
|
|
@@ -126,6 +134,12 @@ export interface TrainCutQuery {
|
|
|
126
134
|
/** The commit; the trunk's tip without it. */
|
|
127
135
|
at?: string;
|
|
128
136
|
levels?: TrainLevels;
|
|
137
|
+
/**
|
|
138
|
+
* The members and labels a plan made earlier gave (#5237), by member: the
|
|
139
|
+
* cut refuses (`train-plan-changed`) unless its own plan names exactly
|
|
140
|
+
* these, before any check, doctor or cut runs. Empty for a plan of nothing.
|
|
141
|
+
*/
|
|
142
|
+
planned?: Record<string, string>;
|
|
129
143
|
/** Reads the registry's versions. Default: {@link npmVersions}. */
|
|
130
144
|
registry?: NpmVersionsReader;
|
|
131
145
|
}
|
|
@@ -187,6 +201,13 @@ export interface TrainCutOutcome extends TrainCutPlan {
|
|
|
187
201
|
/** Why the record did not reach the remote, when it did not. */
|
|
188
202
|
pushWarning?: string;
|
|
189
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Parse `--planned` (#5237): `<member>=<label>` words separated by spaces or
|
|
206
|
+
* commas, as a plan's members give them, or `none` for a plan of nothing.
|
|
207
|
+
*/
|
|
208
|
+
export declare function parseTrainPlanned(text: string): Record<string, string>;
|
|
209
|
+
/** The members and labels of a plan, as `--planned` takes them: `none` for a plan of nothing. */
|
|
210
|
+
export declare function plannedText(plan: Pick<TrainCutPlan, "members">): string;
|
|
190
211
|
/** Plan, and with `yes` cut, record, tag and push, a release train (#5154). */
|
|
191
212
|
export declare function cutTrain(q: TrainCutRun): Promise<TrainCutOutcome>;
|
|
192
213
|
/** `chant workspace train cut <env>` (#5154). */
|