@intentius/chant 0.124.63 → 0.124.65
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/cli/handlers/approve.d.ts +8 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +27 -4
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +2 -1
- package/dist/cli/handlers/release.d.ts +6 -4
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +101 -16
- package/dist/cli/handlers/run.d.ts +30 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +108 -7
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +34 -7
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +19 -0
- package/dist/cli/registry.d.ts +10 -2
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +19 -1
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +11 -3
- package/dist/components/component.d.ts +19 -0
- package/dist/components/component.d.ts.map +1 -1
- package/dist/components/component.schema.json +17 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/release-run.d.ts +48 -0
- package/dist/components/release-run.d.ts.map +1 -0
- package/dist/components/release-run.js +166 -0
- package/dist/components/starter-plugin.d.ts +1 -0
- package/dist/components/starter-plugin.d.ts.map +1 -1
- package/dist/components/starter-plugin.js +5 -1
- package/dist/components/unchanged-inputs.d.ts +81 -0
- package/dist/components/unchanged-inputs.d.ts.map +1 -0
- package/dist/components/unchanged-inputs.js +122 -0
- package/dist/components/verbs/index.d.ts +1 -0
- package/dist/components/verbs/index.d.ts.map +1 -1
- package/dist/components/verbs/index.js +1 -0
- package/dist/components/verbs/release-image.d.ts +36 -0
- package/dist/components/verbs/release-image.d.ts.map +1 -0
- package/dist/components/verbs/release-image.js +33 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/gate-statement.schema.json +4 -2
- package/dist/lifecycle/delivery-metrics.d.ts.map +1 -1
- package/dist/lifecycle/delivery-metrics.js +4 -2
- package/dist/lifecycle/gate-ledger.d.ts +11 -2
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +6 -0
- package/dist/lifecycle/gate-seal.d.ts +20 -4
- package/dist/lifecycle/gate-seal.d.ts.map +1 -1
- package/dist/lifecycle/gate-seal.js +18 -5
- package/dist/lifecycle/gate-statement.d.ts +27 -2
- package/dist/lifecycle/gate-statement.d.ts.map +1 -1
- package/dist/lifecycle/gate-statement.js +37 -2
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +6 -1
- package/dist/lifecycle/ledger-read.js +1 -1
- package/dist/lifecycle/plan-stale.d.ts.map +1 -1
- package/dist/lifecycle/plan-stale.js +1 -2
- package/dist/lifecycle/publish-declaration.d.ts +20 -0
- package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
- package/dist/lifecycle/publish-declaration.js +24 -1
- package/dist/lifecycle/publish-forge.d.ts.map +1 -1
- package/dist/lifecycle/publish-forge.js +1 -2
- package/dist/lifecycle/publish-git-ssh.d.ts +82 -0
- package/dist/lifecycle/publish-git-ssh.d.ts.map +1 -0
- package/dist/lifecycle/publish-git-ssh.js +180 -0
- package/dist/lifecycle/publish-homebrew.d.ts +11 -0
- package/dist/lifecycle/publish-homebrew.d.ts.map +1 -1
- package/dist/lifecycle/publish-homebrew.js +96 -5
- package/dist/lifecycle/publish-marketplace.d.ts +36 -2
- package/dist/lifecycle/publish-marketplace.d.ts.map +1 -1
- package/dist/lifecycle/publish-marketplace.js +173 -30
- package/dist/lifecycle/publish-tauri.d.ts.map +1 -1
- package/dist/lifecycle/publish-tauri.js +1 -2
- package/dist/lifecycle/query.d.ts +2 -2
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +3 -3
- package/dist/lifecycle/release-cut.d.ts +82 -6
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +209 -20
- package/dist/lifecycle/release-ledger.d.ts +11 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-publish.d.ts +13 -0
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/lifecycle/release-publish.js +5 -0
- package/dist/lifecycle/release-revocation.d.ts +4 -3
- package/dist/lifecycle/release-revocation.d.ts.map +1 -1
- package/dist/lifecycle/release-revocation.js +5 -4
- package/dist/lifecycle/release-store.d.ts +49 -3
- package/dist/lifecycle/release-store.d.ts.map +1 -1
- package/dist/lifecycle/release-store.js +22 -3
- package/dist/op/gate.d.ts +1 -1
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +2 -1
- package/dist/op/op-waves-run.js +5 -3
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +26 -6
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/wave-runtime.mjs +284 -283
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +1 -2
- package/dist/workspace/ci-quarantine-report.d.ts.map +1 -1
- package/dist/workspace/ci-quarantine-report.js +1 -2
- package/dist/workspace/ci-quarantine.d.ts.map +1 -1
- package/dist/workspace/ci-quarantine.js +1 -2
- package/dist/workspace/delivery-metrics.schema.json +1 -1
- package/dist/workspace/intent.d.ts.map +1 -1
- package/dist/workspace/intent.js +1 -2
- package/dist/workspace/release-candidates.d.ts +9 -1
- package/dist/workspace/release-candidates.d.ts.map +1 -1
- package/dist/workspace/release-candidates.js +16 -5
- package/dist/workspace/release-candidates.schema.json +7 -0
- package/dist/workspace/releases.schema.json +54 -2
- package/package.json +1 -1
- package/src/cli/handlers/approve-external-signature.test.ts +105 -3
- package/src/cli/handlers/approve.ts +34 -4
- package/src/cli/handlers/pr.ts +2 -1
- package/src/cli/handlers/release.ts +91 -16
- package/src/cli/handlers/run-unchanged.e2e.test.ts +112 -0
- package/src/cli/handlers/run.ts +117 -7
- package/src/cli/main.ts +34 -7
- package/src/cli/parse-args.ts +15 -0
- package/src/cli/registry.ts +10 -2
- package/src/components/cli-support.test.ts +53 -0
- package/src/components/cli-support.ts +26 -4
- package/src/components/component.schema.json +17 -0
- package/src/components/component.ts +20 -0
- package/src/components/index.ts +1 -0
- package/src/components/registry.test.ts +1 -1
- package/src/components/release-run.test.ts +127 -0
- package/src/components/release-run.ts +188 -0
- package/src/components/starter-plugin.ts +5 -0
- package/src/components/unchanged-inputs.test.ts +98 -0
- package/src/components/unchanged-inputs.ts +151 -0
- package/src/components/verbs/index.ts +1 -0
- package/src/components/verbs/release-image.ts +52 -0
- package/src/config.ts +8 -0
- package/src/gate-statement.schema.json +4 -2
- package/src/lifecycle/delivery-metrics.ts +4 -2
- package/src/lifecycle/gate-ledger.ts +17 -2
- package/src/lifecycle/gate-seal.ts +24 -6
- package/src/lifecycle/gate-statement.ts +40 -4
- package/src/lifecycle/git.test.ts +15 -0
- package/src/lifecycle/git.ts +5 -1
- package/src/lifecycle/ledger-read.ts +1 -1
- package/src/lifecycle/plan-stale.test.ts +3 -4
- package/src/lifecycle/plan-stale.ts +1 -2
- package/src/lifecycle/publish-declaration.ts +24 -1
- package/src/lifecycle/publish-forge.ts +1 -2
- package/src/lifecycle/publish-git-ssh.ts +202 -0
- package/src/lifecycle/publish-homebrew.test.ts +181 -2
- package/src/lifecycle/publish-homebrew.ts +101 -6
- package/src/lifecycle/publish-marketplace.test.ts +158 -6
- package/src/lifecycle/publish-marketplace.ts +192 -31
- package/src/lifecycle/publish-resume.test.ts +40 -0
- package/src/lifecycle/publish-tauri.ts +1 -2
- package/src/lifecycle/query.ts +3 -3
- package/src/lifecycle/release-cut-lane.test.ts +195 -0
- package/src/lifecycle/release-cut-override.test.ts +225 -0
- package/src/lifecycle/release-cut.test.ts +45 -0
- package/src/lifecycle/release-cut.ts +262 -21
- package/src/lifecycle/release-ledger.ts +11 -0
- package/src/lifecycle/release-publish.ts +18 -0
- package/src/lifecycle/release-revocation.ts +5 -4
- package/src/lifecycle/release-store.ts +73 -5
- package/src/op/gate.ts +2 -1
- package/src/op/op-waves-run.ts +4 -2
- package/src/pr-forge.ts +25 -6
- package/src/pr-requires.test.ts +9 -0
- package/src/release-floors.ts +1 -1
- package/src/workspace/ci-green.ts +1 -2
- package/src/workspace/ci-quarantine-report.test.ts +2 -3
- package/src/workspace/ci-quarantine-report.ts +1 -2
- package/src/workspace/ci-quarantine.test.ts +2 -3
- package/src/workspace/ci-quarantine.ts +1 -2
- package/src/workspace/delivery-metrics.schema.json +1 -1
- package/src/workspace/delivery-metrics.test.ts +8 -0
- package/src/workspace/intent.ts +1 -2
- package/src/workspace/release-candidates.schema.json +7 -0
- package/src/workspace/release-candidates.ts +19 -5
- package/src/workspace/releases.schema.json +54 -2
- package/src/workspace/trust/gate-seal.test.ts +44 -0
|
@@ -30,22 +30,74 @@
|
|
|
30
30
|
*
|
|
31
31
|
* The token is read from `tokenEnv`, else `VSCE_PAT` or `OVSX_PAT`, the
|
|
32
32
|
* variables `vsce` and `ovsx` read, and is masked in all output.
|
|
33
|
+
*
|
|
34
|
+
* Or the target authenticates with the run's identity, with no stored
|
|
35
|
+
* token (#4698):
|
|
36
|
+
*
|
|
37
|
+
* - `auth: "azure-credential"` (VS Code Marketplace): `vsce` runs with
|
|
38
|
+
* `--azure-credential`, which gets a Microsoft Entra token from the job's
|
|
39
|
+
* Azure sign-in, such as the one `azure/login` makes from the run's OIDC
|
|
40
|
+
* token. `VSCE_PAT` is taken out of vsce's environment, since vsce prefers
|
|
41
|
+
* a PAT it finds there. The stage runs
|
|
42
|
+
* `vsce verify-pat --azure-credential <publisher>`, which signs in and asks
|
|
43
|
+
* the marketplace for the identity's role on the publisher, and changes
|
|
44
|
+
* nothing.
|
|
45
|
+
* - `auth: "trusted-publishing"` (Open VSX): the run's OIDC ID token, from
|
|
46
|
+
* GitHub Actions (a job with `id-token: write`) or from `OVSX_ID_TOKEN`, is
|
|
47
|
+
* exchanged at `POST {registry}/api/-/trusted-publishing/token` for a
|
|
48
|
+
* publishing token that lasts minutes, as `ovsx publish --trusted-publishing`
|
|
49
|
+
* does. The stage makes the exchange to check that Open VSX takes this
|
|
50
|
+
* workflow as a trusted publisher of the extension, and drops the token;
|
|
51
|
+
* the reveal exchanges again for the upload.
|
|
52
|
+
*
|
|
53
|
+
* With `onRefusal: "warn"`, a marketplace that refuses the reveal's upload,
|
|
54
|
+
* or a request around it, is a warning: the reveal returns the target with
|
|
55
|
+
* its items `refused` and a `warning`, and the publish goes on. Every check
|
|
56
|
+
* the stage makes still refuses, and so does a digest that differs after an
|
|
57
|
+
* upload.
|
|
33
58
|
*/
|
|
34
59
|
import { spawn } from "node:child_process";
|
|
35
60
|
import { readFileSync } from "node:fs";
|
|
36
61
|
import { inflateRawSync } from "node:zlib";
|
|
37
62
|
import { readCredential } from "./publish-credentials.js";
|
|
38
63
|
import { bytesDigest, checkReleaseDigest, memberFile, publishTargetKey } from "./publish-targets.js";
|
|
39
|
-
import { PublishTargetError } from "./release-publish.js";
|
|
40
|
-
import { NEXT_RELEASE } from "../release-floors.js";
|
|
64
|
+
import { PublishTargetError, } from "./release-publish.js";
|
|
41
65
|
/** The first chant that publishes a `marketplace` target (#4676). */
|
|
42
|
-
export const PUBLISH_MARKETPLACE_FLOOR =
|
|
66
|
+
export const PUBLISH_MARKETPLACE_FLOOR = "0.124.63";
|
|
67
|
+
/** The first chant that reads a marketplace target's `auth` (#4698). */
|
|
68
|
+
export const PUBLISH_MARKETPLACE_AUTH_FLOOR = "0.124.64";
|
|
69
|
+
/** The first chant that reads a marketplace target's `onRefusal` (#4698). */
|
|
70
|
+
export const PUBLISH_MARKETPLACE_ON_REFUSAL_FLOOR = "0.124.64";
|
|
43
71
|
export const OPEN_VSX_REGISTRY = "https://open-vsx.org";
|
|
44
72
|
export const VSCODE_GALLERY = "https://marketplace.visualstudio.com";
|
|
45
|
-
/** The
|
|
73
|
+
/** The variable an OIDC ID token for Open VSX is read from outside GitHub Actions, as `ovsx` reads it. */
|
|
74
|
+
export const OVSX_ID_TOKEN_ENV = "OVSX_ID_TOKEN";
|
|
75
|
+
/** The declaration's `auth`, refused when the marketplace does not take it or when `tokenEnv` is set with another. */
|
|
76
|
+
export function marketplaceAuth(decl) {
|
|
77
|
+
const auth = decl.auth ?? "token";
|
|
78
|
+
const wrong = auth === "azure-credential" && decl.marketplace !== "vscode"
|
|
79
|
+
? "auth: azure-credential is the VS Code Marketplace's; Open VSX takes token or trusted-publishing"
|
|
80
|
+
: auth === "trusted-publishing" && decl.marketplace !== "openvsx"
|
|
81
|
+
? "auth: trusted-publishing is Open VSX's; the VS Code Marketplace takes token or azure-credential"
|
|
82
|
+
: auth !== "token" && decl.tokenEnv !== undefined
|
|
83
|
+
? `tokenEnv names a token, and auth: ${auth} reads none`
|
|
84
|
+
: null;
|
|
85
|
+
if (wrong)
|
|
86
|
+
throw new PublishTargetError("publish-marketplace-auth-invalid", `a marketplace target for ${decl.marketplace}: ${wrong}`, "Fix the target in release.publish in chant.config.ts.");
|
|
87
|
+
return auth;
|
|
88
|
+
}
|
|
89
|
+
/** The variables a marketplace's credential is read from, whose values are masked. */
|
|
46
90
|
export function marketplaceTokenEnv(decl) {
|
|
91
|
+
const auth = decl.auth ?? "token";
|
|
92
|
+
// vsce's Entra sign-in reads a client secret from AZURE_CLIENT_SECRET when one is set; chant reads none.
|
|
93
|
+
if (auth === "azure-credential")
|
|
94
|
+
return ["AZURE_CLIENT_SECRET"];
|
|
95
|
+
if (auth === "trusted-publishing")
|
|
96
|
+
return [OVSX_ID_TOKEN_ENV];
|
|
47
97
|
return [decl.tokenEnv ?? (decl.marketplace === "vscode" ? "VSCE_PAT" : "OVSX_PAT")];
|
|
48
98
|
}
|
|
99
|
+
/** The codes a reveal turns into a warning under `onRefusal: "warn"`: the marketplace refused or failed a request. */
|
|
100
|
+
const REFUSALS = new Set(["publish-marketplace-failed", "publish-marketplace-trusted-publishing"]);
|
|
49
101
|
/** One file of a zip archive, or null when it holds none by that name. Reads stored and deflated entries; refuses a zip64 archive. */
|
|
50
102
|
export function readZipEntry(zip, name) {
|
|
51
103
|
let end = -1;
|
|
@@ -115,6 +167,7 @@ function run(bin, args, ctx, env) {
|
|
|
115
167
|
}
|
|
116
168
|
export function marketplaceTarget(decl, deps) {
|
|
117
169
|
const fetchImpl = deps.fetch ?? ((url, init) => fetch(url, init));
|
|
170
|
+
const auth = marketplaceAuth(decl);
|
|
118
171
|
const tokenNames = marketplaceTokenEnv(decl);
|
|
119
172
|
const label = decl.marketplace === "vscode" ? "VS Code Marketplace" : "Open VSX";
|
|
120
173
|
const registry = (decl.registry ?? (decl.marketplace === "vscode" ? VSCODE_GALLERY : OPEN_VSX_REGISTRY)).replace(/\/+$/, "");
|
|
@@ -124,9 +177,15 @@ export function marketplaceTarget(decl, deps) {
|
|
|
124
177
|
const digest = bytesDigest(new Uint8Array(bytes));
|
|
125
178
|
checkReleaseDigest(ctx.release, "asset", ctx.cwd, decl.vsix, [digest]);
|
|
126
179
|
const id = vsixIdentity(bytes, decl.vsix);
|
|
127
|
-
|
|
128
|
-
if (
|
|
129
|
-
|
|
180
|
+
let token = null;
|
|
181
|
+
if (auth === "token") {
|
|
182
|
+
token = readCredential(ctx.env, tokenNames, ctx.redactor);
|
|
183
|
+
if (!token) {
|
|
184
|
+
throw new PublishTargetError("publish-credentials-missing", `the ${label} target reads its token from ${tokenNames[0]}, and it is not set`, `Set ${tokenNames[0]} in the job's or the shell's environment.`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (auth === "trusted-publishing" && !ctx.env[OVSX_ID_TOKEN_ENV] && !(ctx.env.ACTIONS_ID_TOKEN_REQUEST_URL && ctx.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN)) {
|
|
188
|
+
throw new PublishTargetError("publish-credentials-missing", `the Open VSX target publishes with trusted publishing, and this run has no OIDC ID token: not a GitHub Actions job with id-token: write, and ${OVSX_ID_TOKEN_ENV} is not set`, `In GitHub Actions, give the job permissions: id-token: write. Elsewhere, put an ID token whose audience is ${registry} in ${OVSX_ID_TOKEN_ENV}.`);
|
|
130
189
|
}
|
|
131
190
|
const destination = decl.marketplace === "vscode" ? `${registry}/items?itemName=${id.publisher}.${id.name}` : `${registry}/extension/${id.publisher}/${id.name}/${id.version}`;
|
|
132
191
|
const item = { name: `${id.publisher}.${id.name}@${id.version}`, destination, digest };
|
|
@@ -156,6 +215,60 @@ export function marketplaceTarget(decl, deps) {
|
|
|
156
215
|
throw new PublishTargetError("publish-marketplace-failed", "the fetch this publish runs with can't read a response's bytes, so the download's digest can't be checked");
|
|
157
216
|
return bytesDigest(new Uint8Array(await res.arrayBuffer()));
|
|
158
217
|
};
|
|
218
|
+
/** The run's OIDC ID token for Open VSX: `OVSX_ID_TOKEN`, else one GitHub Actions issues with the registry as its audience. */
|
|
219
|
+
const idToken = async (ctx) => {
|
|
220
|
+
const direct = readCredential(ctx.env, [OVSX_ID_TOKEN_ENV], ctx.redactor);
|
|
221
|
+
if (direct)
|
|
222
|
+
return direct.value;
|
|
223
|
+
const url = new URL(ctx.env.ACTIONS_ID_TOKEN_REQUEST_URL ?? "");
|
|
224
|
+
url.searchParams.set("audience", registry);
|
|
225
|
+
const res = await fetchImpl(url.toString(), { method: "GET", headers: { authorization: `Bearer ${ctx.env.ACTIONS_ID_TOKEN_REQUEST_TOKEN ?? ""}`, accept: "application/json" } });
|
|
226
|
+
const text = await res.text().catch(() => "");
|
|
227
|
+
const value = res.status === 200 ? JSON.parse(text).value : undefined;
|
|
228
|
+
if (typeof value !== "string" || !value) {
|
|
229
|
+
throw new PublishTargetError("publish-marketplace-trusted-publishing", ctx.redactor.redact(`GitHub Actions gave no OIDC ID token for ${registry}: it answered ${res.status}`), "Give the job permissions: id-token: write.");
|
|
230
|
+
}
|
|
231
|
+
ctx.redactor.add(value);
|
|
232
|
+
return value;
|
|
233
|
+
};
|
|
234
|
+
/** Open VSX trusted publishing: a publishing token for the extension, exchanged for the run's ID token. It lasts minutes. */
|
|
235
|
+
const trustedToken = async (ctx, id) => {
|
|
236
|
+
const token = await idToken(ctx);
|
|
237
|
+
const res = await get(`${registry}/api/-/trusted-publishing/token`, {
|
|
238
|
+
method: "POST",
|
|
239
|
+
headers: { "content-type": "application/json" },
|
|
240
|
+
body: JSON.stringify({ namespace: id.publisher, extension: id.name, token }),
|
|
241
|
+
});
|
|
242
|
+
let body = {};
|
|
243
|
+
try {
|
|
244
|
+
body = JSON.parse(res.text);
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
// An answer that is not JSON is reported by its status.
|
|
248
|
+
}
|
|
249
|
+
if (res.status < 200 || res.status > 299 || typeof body.value !== "string" || !body.value) {
|
|
250
|
+
const why = typeof body.error === "string" ? body.error : `it answered ${res.status}${res.text ? `: ${res.text.slice(0, 300)}` : ""}`;
|
|
251
|
+
throw new PublishTargetError("publish-marketplace-trusted-publishing", ctx.redactor.redact(`Open VSX at ${registry} gave no trusted-publishing token for ${id.publisher}.${id.name}: ${why}`), `Register this workflow as a trusted publisher of ${id.publisher}.${id.name} at ${registry}/user-settings/trusted-publishers.`);
|
|
252
|
+
}
|
|
253
|
+
ctx.redactor.add(body.value);
|
|
254
|
+
return body.value;
|
|
255
|
+
};
|
|
256
|
+
/** Runs vsce with the target's credential: `VSCE_PAT` for a token, `--azure-credential` and no `VSCE_PAT` for an Entra identity. */
|
|
257
|
+
const vsce = async (ctx, args, token) => {
|
|
258
|
+
const env = { ...ctx.env };
|
|
259
|
+
if (token)
|
|
260
|
+
env.VSCE_PAT = token.value;
|
|
261
|
+
else
|
|
262
|
+
delete env.VSCE_PAT;
|
|
263
|
+
return run(deps.vsce ?? "vsce", token ? args : [...args, "--azure-credential"], ctx, env).catch((err) => {
|
|
264
|
+
throw new PublishTargetError("publish-marketplace-vsce-missing", `vsce could not be run: ${err instanceof Error ? err.message : String(err)}`, "Install it on the job's PATH: npm install -g @vscode/vsce");
|
|
265
|
+
});
|
|
266
|
+
};
|
|
267
|
+
/** The reveal of a target the marketplace refused, under `onRefusal: "warn"`. */
|
|
268
|
+
const refusedResult = (ctx, items, err) => {
|
|
269
|
+
const warning = ctx.redactor.redact(`${label} refused ${items[0]?.name ?? decl.vsix}: ${err.message}. onRefusal is warn, so the publish goes on without it, and the same publish run again tries it again`);
|
|
270
|
+
return { target: target.name, destination: target.destination, items: items.map((i) => ({ ...i, refused: true })), warning };
|
|
271
|
+
};
|
|
159
272
|
/** VS Code Marketplace: whether the gallery lists the version. */
|
|
160
273
|
const galleryHas = async (ctx, id) => {
|
|
161
274
|
const res = await get(`${registry}/_apis/public/gallery/extensionquery`, {
|
|
@@ -179,9 +292,14 @@ export function marketplaceTarget(decl, deps) {
|
|
|
179
292
|
},
|
|
180
293
|
async stage(ctx) {
|
|
181
294
|
const { id, digest, token, item } = setup(ctx);
|
|
182
|
-
|
|
295
|
+
if (token)
|
|
296
|
+
ctx.log(`using the token from ${token.from}`);
|
|
183
297
|
const done = (present) => ({ target: target.name, destination: target.destination, items: [{ ...item, ...(present ? { present: true } : {}) }], state: present ? { present: "true" } : {} });
|
|
184
298
|
if (decl.marketplace === "openvsx") {
|
|
299
|
+
if (auth === "trusted-publishing") {
|
|
300
|
+
await trustedToken(ctx, id);
|
|
301
|
+
ctx.log(`Open VSX takes this run as a trusted publisher of ${id.publisher}.${id.name}; the reveal asks for a new token, since one lasts minutes`);
|
|
302
|
+
}
|
|
185
303
|
const ns = await get(`${registry}/api/${encodeURIComponent(id.publisher)}`);
|
|
186
304
|
if (ns.status === 404) {
|
|
187
305
|
throw new PublishTargetError("publish-marketplace-no-namespace", `Open VSX at ${registry} has no namespace ${id.publisher}`, `Create it once with: npx ovsx create-namespace ${id.publisher}`);
|
|
@@ -199,6 +317,15 @@ export function marketplaceTarget(decl, deps) {
|
|
|
199
317
|
ctx.log(`${item.name} is already on Open VSX with the same bytes`);
|
|
200
318
|
return done(true);
|
|
201
319
|
}
|
|
320
|
+
if (auth === "azure-credential") {
|
|
321
|
+
ctx.log(`checking the job's Microsoft Entra identity may publish as ${id.publisher}: vsce verify-pat --azure-credential ${id.publisher}`);
|
|
322
|
+
const check = await vsce(ctx, ["verify-pat", id.publisher], null);
|
|
323
|
+
for (const l of check.output)
|
|
324
|
+
ctx.log(`vsce: ${l}`);
|
|
325
|
+
if (check.code !== 0) {
|
|
326
|
+
throw new PublishTargetError("publish-marketplace-azure-credential", `vsce could not sign in with a Microsoft Entra identity that has a role on publisher ${id.publisher}: vsce verify-pat exited ${check.code}${check.output.length ? `: ${check.output.slice(-3).join(" ")}` : ""}`, `Sign in to Azure in the publish's job before it runs, such as with azure/login and the run's OIDC token, as an identity added to the publisher ${id.publisher}.`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
202
329
|
if (await galleryHas(ctx, id)) {
|
|
203
330
|
ctx.log(`${item.name} is already on the VS Code Marketplace; it reports no digest to compare`);
|
|
204
331
|
return done(true);
|
|
@@ -211,44 +338,60 @@ export function marketplaceTarget(decl, deps) {
|
|
|
211
338
|
if (staged.state.present === "true")
|
|
212
339
|
return { target: target.name, destination: target.destination, items: items.map((i) => ({ ...i, present: true })) };
|
|
213
340
|
const { abs, bytes, id, digest, token, item } = setup(ctx);
|
|
341
|
+
const refusable = async (step) => {
|
|
342
|
+
try {
|
|
343
|
+
return await step();
|
|
344
|
+
}
|
|
345
|
+
catch (err) {
|
|
346
|
+
if (decl.onRefusal === "warn" && err instanceof PublishTargetError && REFUSALS.has(err.code))
|
|
347
|
+
return refusedResult(ctx, items, err);
|
|
348
|
+
throw err;
|
|
349
|
+
}
|
|
350
|
+
};
|
|
214
351
|
if (decl.marketplace === "openvsx") {
|
|
215
352
|
// Run again after an upload whose record was lost, the version is there: check it rather than send it twice.
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
353
|
+
const uploaded = await refusable(async () => {
|
|
354
|
+
const before = await openVsxServed(ctx, id);
|
|
355
|
+
if (before !== null)
|
|
356
|
+
return before;
|
|
357
|
+
const publishToken = token ? token.value : await trustedToken(ctx, id);
|
|
358
|
+
ctx.log(`uploading ${item.name} (${bytes.byteLength} bytes) to Open VSX${token ? "" : " with a trusted-publishing token"}`);
|
|
359
|
+
const res = await fetchImpl(`${registry}/api/-/publish?token=${encodeURIComponent(publishToken)}`, {
|
|
220
360
|
method: "POST",
|
|
221
361
|
headers: { "user-agent": "chant", "content-type": "application/octet-stream" },
|
|
222
362
|
body: new Uint8Array(bytes),
|
|
223
363
|
});
|
|
224
364
|
if (res.status !== 201 && res.status !== 200)
|
|
225
365
|
fail(ctx, `publishing ${item.name}`, res.status, await res.text().catch(() => ""));
|
|
226
|
-
|
|
366
|
+
return null;
|
|
367
|
+
});
|
|
368
|
+
if (uploaded !== null && typeof uploaded === "object")
|
|
369
|
+
return uploaded;
|
|
370
|
+
const before = uploaded;
|
|
227
371
|
const served = before ?? (await openVsxServed(ctx, id));
|
|
228
372
|
if (served !== digest) {
|
|
229
373
|
throw new PublishTargetError("publish-marketplace-digest-mismatch", `Open VSX serves ${item.name} with digest ${served ?? "none"}, and the file published is ${digest}`);
|
|
230
374
|
}
|
|
231
375
|
return { target: target.name, destination: target.destination, items: before === null ? items : items.map((i) => ({ ...i, present: true })) };
|
|
232
376
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
377
|
+
const outcome = await refusable(async () => {
|
|
378
|
+
if (await galleryHas(ctx, id)) {
|
|
379
|
+
ctx.log(`${item.name} is already on the VS Code Marketplace`);
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
ctx.log(`running vsce publish --packagePath ${decl.vsix}${token ? "" : " --azure-credential"}`);
|
|
383
|
+
const result = await vsce(ctx, ["publish", "--packagePath", abs], token);
|
|
384
|
+
for (const l of result.output)
|
|
385
|
+
ctx.log(`vsce: ${l}`);
|
|
386
|
+
if (result.code !== 0) {
|
|
387
|
+
throw new PublishTargetError("publish-marketplace-failed", `vsce publish of ${item.name} exited ${result.code}${result.output.length ? `: ${result.output.slice(-3).join(" ")}` : ""}`);
|
|
388
|
+
}
|
|
389
|
+
return false;
|
|
240
390
|
});
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
throw new PublishTargetError("publish-marketplace-failed", `vsce publish of ${item.name} exited ${result.code}${result.output.length ? `: ${result.output.slice(-3).join(" ")}` : ""}`);
|
|
245
|
-
}
|
|
246
|
-
return { target: target.name, destination: target.destination, items };
|
|
391
|
+
if (typeof outcome === "object")
|
|
392
|
+
return outcome;
|
|
393
|
+
return { target: target.name, destination: target.destination, items: outcome ? items.map((i) => ({ ...i, present: true })) : items };
|
|
247
394
|
},
|
|
248
395
|
};
|
|
249
396
|
return target;
|
|
250
397
|
}
|
|
251
|
-
/** The environment vsce runs with: the run's, with the token in `VSCE_PAT`. */
|
|
252
|
-
function vsceEnv(env, token) {
|
|
253
|
-
return { ...env, VSCE_PAT: token.value };
|
|
254
|
-
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish-tauri.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-tauri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAKH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAI5E,OAAO,EAA2C,KAAK,WAAW,EAAuC,KAAK,aAAa,EAAqB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"publish-tauri.d.ts","sourceRoot":"","sources":["../../src/lifecycle/publish-tauri.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAKH,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,uBAAuB,CAAC;AAI5E,OAAO,EAA2C,KAAK,WAAW,EAAuC,KAAK,aAAa,EAAqB,MAAM,mBAAmB,CAAC;AAE1K,uEAAuE;AACvE,eAAO,MAAM,2BAA2B,aAAa,CAAC;AAStD,oHAAoH;AACpH,wBAAgB,aAAa,CAAC,CAAC,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,UAAU,CAK7K;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,8BAA8B,EAAE,IAAI,EAAE,WAAW,GAAG,aAAa,CA4HzG"}
|
|
@@ -50,9 +50,8 @@ import { GitHubRepo, githubApi } from "./publish-github.js";
|
|
|
50
50
|
import { fillUrl, releaseVersion } from "./publish-homebrew.js";
|
|
51
51
|
import { bytesDigest, checkReleaseDigest, memberFile, publishTargetKey } from "./publish-targets.js";
|
|
52
52
|
import { PublishTargetError } from "./release-publish.js";
|
|
53
|
-
import { NEXT_RELEASE } from "../release-floors.js";
|
|
54
53
|
/** The first chant that publishes a `tauri-updater` target (#4676). */
|
|
55
|
-
export const PUBLISH_TAURI_UPDATER_FLOOR =
|
|
54
|
+
export const PUBLISH_TAURI_UPDATER_FLOOR = "0.124.63";
|
|
56
55
|
/** The updater manifest's bytes: 2-space JSON with a trailing newline, keys in the order Tauri's docs show them. */
|
|
57
56
|
export function tauriManifest(m) {
|
|
58
57
|
const platforms = {};
|
|
@@ -37,8 +37,8 @@ export declare const QUERY_TABLES: {
|
|
|
37
37
|
* request a pending fact asks for, as JSON.
|
|
38
38
|
*/
|
|
39
39
|
readonly gates: readonly [readonly ["member", "TEXT"], readonly ["op", "TEXT"], readonly ["gate", "TEXT"], readonly ["kind", "TEXT"], readonly ["timestamp", "TEXT"], readonly ["resolved_by", "TEXT"], readonly ["relayed_by", "TEXT"], readonly ["approver_kind", "TEXT"], readonly ["plan_digest", "TEXT"], readonly ["environment", "TEXT"], readonly ["release_digest", "TEXT"], readonly ["git_sha", "TEXT"], readonly ["run_id", "TEXT"], readonly ["url", "TEXT"], readonly ["note", "TEXT"], readonly ["expires_at", "TEXT"], readonly ["origin", "TEXT"], readonly ["empty", "INTEGER"], readonly ["signed", "INTEGER"], readonly ["change_set", "TEXT"], readonly ["request", "TEXT"]];
|
|
40
|
-
/** One row per deploy record in `<env>/releases.jsonl`. `promoted_from`, `restores` and `
|
|
41
|
-
readonly deploys: readonly [readonly ["member", "TEXT"], readonly ["env", "TEXT"], readonly ["component", "TEXT"], readonly ["digest", "TEXT"], readonly ["git_sha", "TEXT"], readonly ["run_id", "TEXT"], readonly ["forge", "TEXT"], readonly ["run_url", "TEXT"], readonly ["timestamp", "TEXT"], readonly ["actor", "TEXT"], readonly ["approver", "TEXT"], readonly ["release_digest", "TEXT"], readonly ["digest_kind", "TEXT"], readonly ["promoted_from", "TEXT"], readonly ["restores", "TEXT"], readonly ["redeploys", "TEXT"]];
|
|
40
|
+
/** One row per deploy record in `<env>/releases.jsonl`. `promoted_from`, `restores`, `redeploys` and `unchanged_since` (#4695) are JSON. */
|
|
41
|
+
readonly deploys: readonly [readonly ["member", "TEXT"], readonly ["env", "TEXT"], readonly ["component", "TEXT"], readonly ["digest", "TEXT"], readonly ["git_sha", "TEXT"], readonly ["run_id", "TEXT"], readonly ["forge", "TEXT"], readonly ["run_url", "TEXT"], readonly ["timestamp", "TEXT"], readonly ["actor", "TEXT"], readonly ["approver", "TEXT"], readonly ["release_digest", "TEXT"], readonly ["digest_kind", "TEXT"], readonly ["promoted_from", "TEXT"], readonly ["restores", "TEXT"], readonly ["redeploys", "TEXT"], readonly ["unchanged_since", "TEXT"]];
|
|
42
42
|
/** One row per release file whose content hashes to its digest. `envs` joins its targets' environments with commas; `artifacts` is JSON. */
|
|
43
43
|
readonly releases: readonly [readonly ["member", "TEXT"], readonly ["release_digest", "TEXT"], readonly ["release_member", "TEXT"], readonly ["git_sha", "TEXT"], readonly ["envs", "TEXT"], readonly ["artifacts", "TEXT"]];
|
|
44
44
|
/** One row per line of `_releases/cuts.jsonl`. `signed` is 1 for a signed cut. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/lifecycle/query.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAUpD,6CAA6C;AAC7C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAItC;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACvB;;;;;;;;OAQG;;IAEH,2FAA2F;;IAE3F;;;;;;;;OAQG;;IAEH;;;;;OAKG;;IAEH,
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../src/lifecycle/query.ts"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAUpD,6CAA6C;AAC7C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAItC;;;;;GAKG;AACH,eAAO,MAAM,YAAY;IACvB;;;;;;;;OAQG;;IAEH,2FAA2F;;IAE3F;;;;;;;;OAQG;;IAEH;;;;;OAKG;;IAEH,4IAA4I;;IAE5I,4IAA4I;;IAE5I,kFAAkF;;IAElF;;;;;OAKG;;IAEH;;;;OAIG;;IAEH;;;;;;;;OAQG;;IAEH;;;;;OAKG;;CAE4E,CAAC;AAElF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,aAAa,CAAC;AAEnD;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,aAAa,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,aAAa,CAAC;AAEpD,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB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,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,CA8HvF;AA6BD,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG7C;AAED,mDAAmD;AACnD,wBAAsB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAoCjF;AAID,0DAA0D;AAC1D,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAMxD"}
|
package/dist/lifecycle/query.js
CHANGED
|
@@ -44,8 +44,8 @@ export const QUERY_TABLES = {
|
|
|
44
44
|
* request a pending fact asks for, as JSON.
|
|
45
45
|
*/
|
|
46
46
|
gates: [["member", "TEXT"], ["op", "TEXT"], ["gate", "TEXT"], ["kind", "TEXT"], ["timestamp", "TEXT"], ["resolved_by", "TEXT"], ["relayed_by", "TEXT"], ["approver_kind", "TEXT"], ["plan_digest", "TEXT"], ["environment", "TEXT"], ["release_digest", "TEXT"], ["git_sha", "TEXT"], ["run_id", "TEXT"], ["url", "TEXT"], ["note", "TEXT"], ["expires_at", "TEXT"], ["origin", "TEXT"], ["empty", "INTEGER"], ["signed", "INTEGER"], ["change_set", "TEXT"], ["request", "TEXT"]],
|
|
47
|
-
/** One row per deploy record in `<env>/releases.jsonl`. `promoted_from`, `restores` and `
|
|
48
|
-
deploys: [["member", "TEXT"], ["env", "TEXT"], ["component", "TEXT"], ["digest", "TEXT"], ["git_sha", "TEXT"], ["run_id", "TEXT"], ["forge", "TEXT"], ["run_url", "TEXT"], ["timestamp", "TEXT"], ["actor", "TEXT"], ["approver", "TEXT"], ["release_digest", "TEXT"], ["digest_kind", "TEXT"], ["promoted_from", "TEXT"], ["restores", "TEXT"], ["redeploys", "TEXT"]],
|
|
47
|
+
/** One row per deploy record in `<env>/releases.jsonl`. `promoted_from`, `restores`, `redeploys` and `unchanged_since` (#4695) are JSON. */
|
|
48
|
+
deploys: [["member", "TEXT"], ["env", "TEXT"], ["component", "TEXT"], ["digest", "TEXT"], ["git_sha", "TEXT"], ["run_id", "TEXT"], ["forge", "TEXT"], ["run_url", "TEXT"], ["timestamp", "TEXT"], ["actor", "TEXT"], ["approver", "TEXT"], ["release_digest", "TEXT"], ["digest_kind", "TEXT"], ["promoted_from", "TEXT"], ["restores", "TEXT"], ["redeploys", "TEXT"], ["unchanged_since", "TEXT"]],
|
|
49
49
|
/** One row per release file whose content hashes to its digest. `envs` joins its targets' environments with commas; `artifacts` is JSON. */
|
|
50
50
|
releases: [["member", "TEXT"], ["release_digest", "TEXT"], ["release_member", "TEXT"], ["git_sha", "TEXT"], ["envs", "TEXT"], ["artifacts", "TEXT"]],
|
|
51
51
|
/** One row per line of `_releases/cuts.jsonl`. `signed` is 1 for a signed cut. */
|
|
@@ -245,7 +245,7 @@ export async function loadQueryData(ledgers) {
|
|
|
245
245
|
const { records, malformed: bad } = parseReleaseLedger(releaseLedgerLines(await port.read(env, file)));
|
|
246
246
|
malformed.deploys += bad;
|
|
247
247
|
for (const d of records) {
|
|
248
|
-
data.deploys.push({ member, env: d.env, component: d.component, digest: d.digest, git_sha: d.gitSha, run_id: d.runId, forge: str(d.runOrigin?.forge), run_url: str(d.runOrigin?.url), timestamp: d.timestamp, actor: d.actor, approver: str(d.approver), release_digest: str(d.releaseDigest), digest_kind: str(d.digestKind), promoted_from: json(d.promotedFrom), restores: json(d.restores), redeploys: json(d.redeploys) });
|
|
248
|
+
data.deploys.push({ member, env: d.env, component: d.component, digest: d.digest, git_sha: d.gitSha, run_id: d.runId, forge: str(d.runOrigin?.forge), run_url: str(d.runOrigin?.url), timestamp: d.timestamp, actor: d.actor, approver: str(d.approver), release_digest: str(d.releaseDigest), digest_kind: str(d.digestKind), promoted_from: json(d.promotedFrom), restores: json(d.restores), redeploys: json(d.redeploys), unchanged_since: json(d.unchangedSince) });
|
|
249
249
|
}
|
|
250
250
|
continue;
|
|
251
251
|
}
|
|
@@ -17,6 +17,14 @@
|
|
|
17
17
|
* component's own file, the member's `chant.config.ts` and the paths its
|
|
18
18
|
* build steps read.
|
|
19
19
|
*
|
|
20
|
+
* An image built elsewhere, as by a CI job that builds what the cut's machine
|
|
21
|
+
* can't, is handed to the cut by digest (#4694, `--image
|
|
22
|
+
* <component>=<repository>@sha256:<hex>`). The release records it with its
|
|
23
|
+
* reference in `ref`, and the cut builds nothing for that component: its
|
|
24
|
+
* archive steps, if it has any, don't run, and no earlier release's entry is
|
|
25
|
+
* carried. A deploy under the release runs that image
|
|
26
|
+
* (../components/release-run.ts).
|
|
27
|
+
*
|
|
20
28
|
* A project with no components (#4046) needs no special case here: its
|
|
21
29
|
* targets hold the files `chant build --env <env>` writes, each with
|
|
22
30
|
* `component: null`, and `artifactDigests` is empty.
|
|
@@ -31,15 +39,42 @@
|
|
|
31
39
|
* all the same, and readers report whether the signature verifies. With
|
|
32
40
|
* `ci.green.signedSince` declared, a green tag counts only with a valid
|
|
33
41
|
* statement (`../workspace/ci-green.ts`), so a hand-pushed tag cuts nothing.
|
|
42
|
+
*
|
|
43
|
+
* A lane (#4692): a cut given a lane `ci.green.lanes` declares checks that
|
|
44
|
+
* lane's tags, `ci/green-<lane>/<sha>` and `ci/revoked-<lane>/<sha>`, in place
|
|
45
|
+
* of `ci/green/<sha>` and `ci/revoked/<sha>`, and the cut line names the lane.
|
|
46
|
+
*
|
|
47
|
+
* An override (#4693): a commit with no green tag that counts is cut when the
|
|
48
|
+
* cut asks for it (`overrideGreen`) and a person's override of it stands on
|
|
49
|
+
* the override ledger, `_gates/policy-override.jsonl` (`../override-gate.ts`).
|
|
50
|
+
* The subject is `release-<sha12>`, the plan the commit, and the rule
|
|
51
|
+
* `ci-green` (or `ci-green-<lane>`). It counts when a person the overriders
|
|
52
|
+
* file at base lists wrote it with a reason, sealed under a `release` gate in
|
|
53
|
+
* `identity.gates`. The cut spends it and records it on the cut line. With no
|
|
54
|
+
* override that counts, a cut (not a dry run) records the request for one,
|
|
55
|
+
* which `chant approve policy-override` answers. A revoked commit is never
|
|
56
|
+
* cut, override or not.
|
|
34
57
|
*/
|
|
35
|
-
import { type Release, type ReleaseCut, type ReleaseTarget } from "./release-store.js";
|
|
58
|
+
import { type Release, type ReleaseArtifact, type ReleaseCut, type ReleaseCutOverride, type ReleaseTarget } from "./release-store.js";
|
|
36
59
|
import type { CompiledTarget, TargetCompiler } from "../components/release-compile.js";
|
|
60
|
+
/** The first chant that cuts from a lane's green tag and writes `lane` on the cut line (#4692). */
|
|
61
|
+
export declare const RELEASE_CUT_LANE_FLOOR = "0.124.64";
|
|
62
|
+
/** The first chant that cuts a commit that is not green under an override and writes `override` on the cut line (#4693). */
|
|
63
|
+
export declare const RELEASE_CUT_OVERRIDE_FLOOR = "0.124.64";
|
|
64
|
+
/** The override gate's subject for a cut of `commit` (#4693): `release-<sha12>`. */
|
|
65
|
+
export declare function greenOverrideSubject(commit: string): string;
|
|
66
|
+
/** The rule an override of a cut names (#4693): `ci-green`, or `ci-green-<lane>` for a lane's tag. */
|
|
67
|
+
export declare function greenOverrideRule(lane: string | null): string;
|
|
37
68
|
/** The stable codes a cut refuses with. */
|
|
38
|
-
export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green" | "release-commit-revoked" | "release-worktree-dirty" | "release-no-environments" | "release-no-components" | "release-build-inputs-differ" | "release-unsigned" | "release-signer-refused" | "declaration-invalid";
|
|
69
|
+
export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green" | "release-commit-revoked" | "release-worktree-dirty" | "release-no-environments" | "release-no-components" | "release-build-inputs-differ" | "release-image-invalid" | "release-image-unknown-component" | "release-unsigned" | "release-signer-refused" | "declaration-invalid";
|
|
39
70
|
export declare class ReleaseCutError extends Error {
|
|
40
71
|
readonly code: ReleaseCutCode;
|
|
41
72
|
readonly fix?: string | undefined;
|
|
42
|
-
|
|
73
|
+
/** The cut recorded a request for an override on `chant/lifecycle` (#4693), which the caller pushes. */
|
|
74
|
+
readonly recorded: boolean;
|
|
75
|
+
constructor(code: ReleaseCutCode, message: string, fix?: string | undefined,
|
|
76
|
+
/** The cut recorded a request for an override on `chant/lifecycle` (#4693), which the caller pushes. */
|
|
77
|
+
recorded?: boolean);
|
|
43
78
|
}
|
|
44
79
|
export interface CutRequest {
|
|
45
80
|
/** The member's directory. */
|
|
@@ -68,6 +103,25 @@ export interface CutRequest {
|
|
|
68
103
|
};
|
|
69
104
|
/** The publish channel recorded on the cut (#4168 4.3), in place of `latest`. */
|
|
70
105
|
channel?: string;
|
|
106
|
+
/**
|
|
107
|
+
* The green lane to check (#4692), one `ci.green.lanes` declares at base:
|
|
108
|
+
* the commit must carry `ci/green-<lane>/<sha>` and no
|
|
109
|
+
* `ci/revoked-<lane>/<sha>`. Recorded on the cut. Absent, the full
|
|
110
|
+
* `ci/green/<sha>` tag is checked.
|
|
111
|
+
*/
|
|
112
|
+
lane?: string;
|
|
113
|
+
/**
|
|
114
|
+
* Cut the commit when it has no green tag that counts, under a person's
|
|
115
|
+
* override of it (#4693). Without an override that counts the cut is
|
|
116
|
+
* refused, and a cut that is not a dry run records the request for one.
|
|
117
|
+
*/
|
|
118
|
+
overrideGreen?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Images built elsewhere and handed to the cut (#4694), by component: each
|
|
121
|
+
* `<repository>@sha256:<hex>`. The release records each as the component's
|
|
122
|
+
* image, and the cut builds nothing for it.
|
|
123
|
+
*/
|
|
124
|
+
images?: Readonly<Record<string, string>>;
|
|
71
125
|
}
|
|
72
126
|
export interface CutResult {
|
|
73
127
|
release: Release;
|
|
@@ -82,15 +136,29 @@ export interface CutResult {
|
|
|
82
136
|
component: string;
|
|
83
137
|
from: string;
|
|
84
138
|
}>;
|
|
139
|
+
/** The images handed to the cut (#4694), by component, as recorded. */
|
|
140
|
+
handed: Array<{
|
|
141
|
+
component: string;
|
|
142
|
+
ref: string;
|
|
143
|
+
digest: string;
|
|
144
|
+
}>;
|
|
85
145
|
}
|
|
146
|
+
/**
|
|
147
|
+
* The release artifact for an image handed to the cut (#4694), or why the
|
|
148
|
+
* reference can't be one: it must name its repository and its digest, and no
|
|
149
|
+
* tag, since a tag can move after the cut.
|
|
150
|
+
*/
|
|
151
|
+
export declare function handedImage(component: string, ref: string): ReleaseArtifact | {
|
|
152
|
+
error: string;
|
|
153
|
+
};
|
|
86
154
|
/**
|
|
87
155
|
* Whether `sha` has a green tag and no revoked tag, read from local tags,
|
|
88
156
|
* and the tags on it that were ignored for want of a valid statement
|
|
89
157
|
* (#4031). The tags are judged by `green`, the declaration's `ci.green` at
|
|
90
158
|
* base, with the runner keys read at its branch's tip; with no `ci.green`,
|
|
91
|
-
* every tag counts.
|
|
159
|
+
* every tag counts. With `lane` (#4692), that lane's tags are read.
|
|
92
160
|
*/
|
|
93
|
-
export declare function greenState(top: string, sha: string, green?: import("../workspace/declaration.js").CiGreen | null): Promise<{
|
|
161
|
+
export declare function greenState(top: string, sha: string, green?: import("../workspace/declaration.js").CiGreen | null, lane?: string): Promise<{
|
|
94
162
|
state: "green" | "revoked" | "none";
|
|
95
163
|
ignored: Array<{
|
|
96
164
|
tag: string;
|
|
@@ -129,6 +197,8 @@ export interface CutPlan {
|
|
|
129
197
|
}>;
|
|
130
198
|
/** The components whose artifacts would be carried from an earlier release. */
|
|
131
199
|
reused: CutResult["reused"];
|
|
200
|
+
/** The images handed to the cut (#4694), by component. */
|
|
201
|
+
handed: CutResult["handed"];
|
|
132
202
|
/** Each component's publish steps, with the environments whose deploy runs them. */
|
|
133
203
|
publishSteps: Array<{
|
|
134
204
|
component: string;
|
|
@@ -138,6 +208,10 @@ export interface CutPlan {
|
|
|
138
208
|
}>;
|
|
139
209
|
/** Whether the release gate in identity.gates requires a signed cut. */
|
|
140
210
|
signatureRequired: boolean;
|
|
211
|
+
/** The green lane the commit was checked in (#4692), or null for the full green tag. */
|
|
212
|
+
lane: string | null;
|
|
213
|
+
/** The override the cut would run under and spend (#4693), when the commit is not green; null when it is. */
|
|
214
|
+
override: ReleaseCutOverride | null;
|
|
141
215
|
}
|
|
142
216
|
/**
|
|
143
217
|
* The dry run of {@link cutRelease} (#4027): the same checks and compile,
|
|
@@ -153,7 +227,9 @@ export declare function planRelease(req: CutRequest): Promise<CutPlan>;
|
|
|
153
227
|
* push. Throws {@link ReleaseCutError} before anything is written when the
|
|
154
228
|
* commit isn't green, the tree is dirty, or an environment can't be compiled
|
|
155
229
|
* to the same artifacts, and `ReleaseLabelError` (./release-store.ts) when the
|
|
156
|
-
* label is taken or the release already carries another one.
|
|
230
|
+
* label is taken or the release already carries another one. The one write
|
|
231
|
+
* before a refusal is the request for an override (#4693), when the cut asks
|
|
232
|
+
* for one and none stands; the error's `recorded` says so.
|
|
157
233
|
*
|
|
158
234
|
* The cut line names its run (#4027): the CI run's id and origin in CI, and
|
|
159
235
|
* outside CI an id minted from the cut's time, `local-<epoch ms>`, with the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-cut.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-cut.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"release-cut.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-cut.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AASH,OAAO,EAUL,KAAK,OAAO,EACZ,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAGnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpF,mGAAmG;AACnG,eAAO,MAAM,sBAAsB,aAAa,CAAC;AACjD,4HAA4H;AAC5H,eAAO,MAAM,0BAA0B,aAAa,CAAC;AAErD,oFAAoF;AACpF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED,sGAAsG;AACtG,wBA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