@caelo-cms/provisioning 0.12.4 → 0.12.5-rc.1
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/agent-db.js +8 -3
- package/dist/cli-routing.d.ts.map +1 -1
- package/dist/cli-routing.js +6 -5
- package/dist/cli-routing.js.map +1 -1
- package/dist/cli.js +18 -1
- package/dist/cli.js.map +1 -1
- package/dist/gcp-names.d.ts +51 -0
- package/dist/gcp-names.d.ts.map +1 -1
- package/dist/gcp-names.js +75 -0
- package/dist/gcp-names.js.map +1 -1
- package/dist/infra-contract.d.ts +1 -1
- package/dist/infra-contract.d.ts.map +1 -1
- package/dist/infra-contract.js +42 -1
- package/dist/infra-contract.js.map +1 -1
- package/dist/install-state.d.ts +8 -0
- package/dist/install-state.d.ts.map +1 -1
- package/dist/install-state.js +12 -0
- package/dist/install-state.js.map +1 -1
- package/dist/install-version.d.ts +110 -0
- package/dist/install-version.d.ts.map +1 -0
- package/dist/install-version.js +162 -0
- package/dist/install-version.js.map +1 -0
- package/dist/lifecycle.d.ts +6 -1
- package/dist/lifecycle.d.ts.map +1 -1
- package/dist/lifecycle.js +46 -1
- package/dist/lifecycle.js.map +1 -1
- package/dist/release-candidate.d.ts +67 -0
- package/dist/release-candidate.d.ts.map +1 -0
- package/dist/release-candidate.js +138 -0
- package/dist/release-candidate.js.map +1 -0
- package/dist/reporting-job-setup.d.ts +102 -0
- package/dist/reporting-job-setup.d.ts.map +1 -0
- package/dist/reporting-job-setup.js +347 -0
- package/dist/reporting-job-setup.js.map +1 -0
- package/dist/self-hosted-upgrade.d.ts.map +1 -1
- package/dist/self-hosted-upgrade.js +18 -3
- package/dist/self-hosted-upgrade.js.map +1 -1
- package/dist/stack-contract.d.ts +30 -5
- package/dist/stack-contract.d.ts.map +1 -1
- package/dist/stack-contract.js +74 -10
- package/dist/stack-contract.js.map +1 -1
- package/dist/upgrade/admin-image-jobs.d.ts +13 -5
- package/dist/upgrade/admin-image-jobs.d.ts.map +1 -1
- package/dist/upgrade/admin-image-jobs.js +22 -2
- package/dist/upgrade/admin-image-jobs.js.map +1 -1
- package/dist/upgrade/converge.d.ts.map +1 -1
- package/dist/upgrade/converge.js +99 -9
- package/dist/upgrade/converge.js.map +1 -1
- package/dist/upgrade/release-images.d.ts +6 -2
- package/dist/upgrade/release-images.d.ts.map +1 -1
- package/dist/upgrade/release-images.js +5 -5
- package/dist/upgrade/release-images.js.map +1 -1
- package/dist/upgrader-iam-preflight.d.ts.map +1 -1
- package/dist/upgrader-iam-preflight.js +19 -1
- package/dist/upgrader-iam-preflight.js.map +1 -1
- package/dist/upgrader-setup.d.ts.map +1 -1
- package/dist/upgrader-setup.js +16 -1
- package/dist/upgrader-setup.js.map +1 -1
- package/dist/wizard.d.ts +7 -0
- package/dist/wizard.d.ts.map +1 -1
- package/dist/wizard.js +20 -5
- package/dist/wizard.js.map +1 -1
- package/dist/wizards/gcp-cost.d.ts +7 -11
- package/dist/wizards/gcp-cost.d.ts.map +1 -1
- package/dist/wizards/gcp-cost.js +47 -36
- package/dist/wizards/gcp-cost.js.map +1 -1
- package/dist/wizards/gcp-firebase.d.ts +4 -0
- package/dist/wizards/gcp-firebase.d.ts.map +1 -1
- package/dist/wizards/gcp-firebase.js +2 -0
- package/dist/wizards/gcp-firebase.js.map +1 -1
- package/dist/wizards/gcp-install-job.d.ts +10 -0
- package/dist/wizards/gcp-install-job.d.ts.map +1 -1
- package/dist/wizards/gcp-install-job.js +41 -10
- package/dist/wizards/gcp-install-job.js.map +1 -1
- package/dist/wizards/gcp.d.ts +7 -0
- package/dist/wizards/gcp.d.ts.map +1 -1
- package/dist/wizards/gcp.js +191 -9
- package/dist/wizards/gcp.js.map +1 -1
- package/package.json +2 -2
- package/src/cli-routing.test.ts +1 -1
- package/src/cli-routing.ts +6 -5
- package/src/cli.ts +18 -1
- package/src/cpu-idle.test.ts +7 -2
- package/src/gcp-names.ts +87 -0
- package/src/infra-contract.test.ts +6 -3
- package/src/infra-contract.ts +42 -1
- package/src/install-state.ts +12 -0
- package/src/install-version.test.ts +366 -0
- package/src/install-version.ts +205 -0
- package/src/lifecycle.ts +65 -3
- package/src/release-candidate.test.ts +191 -0
- package/src/release-candidate.ts +172 -0
- package/src/reporting-job-setup.test.ts +392 -0
- package/src/reporting-job-setup.ts +431 -0
- package/src/self-hosted-upgrade.ts +18 -3
- package/src/stack-contract.test.ts +24 -0
- package/src/stack-contract.ts +87 -9
- package/src/stack-converge-secrets.test.ts +2 -0
- package/src/stack-converge.test.ts +3 -3
- package/src/upgrade/admin-image-jobs.ts +35 -6
- package/src/upgrade/converge.ts +137 -8
- package/src/upgrade/release-images.test.ts +2 -2
- package/src/upgrade/release-images.ts +6 -4
- package/src/upgrade/upgrade.test.ts +165 -4
- package/src/upgrader-iam-preflight.test.ts +58 -0
- package/src/upgrader-iam-preflight.ts +21 -0
- package/src/upgrader-job.test.ts +3 -0
- package/src/upgrader-setup.test.ts +6 -0
- package/src/upgrader-setup.ts +18 -0
- package/src/wizard.ts +30 -5
- package/src/wizards/gcp-cost.test.ts +11 -13
- package/src/wizards/gcp-cost.ts +49 -36
- package/src/wizards/gcp-firebase.ts +6 -0
- package/src/wizards/gcp-install-job.ts +46 -12
- package/src/wizards/gcp.ts +250 -7
- package/stacks/aws/index.ts +10 -0
- package/stacks/azure/index.ts +10 -0
package/src/upgrader-setup.ts
CHANGED
|
@@ -79,9 +79,12 @@ import { ensureCloudSqlIamUser } from "./cloudsql-iam-user.js";
|
|
|
79
79
|
import { gcloud as defaultGcloud, type GcloudResult } from "./gcloud.js";
|
|
80
80
|
import { type GcloudRunner, realSleep, runWithRetry, type Sleep } from "./gcloud-retry.js";
|
|
81
81
|
import {
|
|
82
|
+
auditRunnerServiceAccountEmail,
|
|
82
83
|
auditServiceAccountEmail,
|
|
84
|
+
buildCarrierServiceAccountEmail,
|
|
83
85
|
captureServiceAccountEmail,
|
|
84
86
|
gatewayServiceAccountEmail,
|
|
87
|
+
importCrawlServiceAccountEmail,
|
|
85
88
|
mcpAuthProxyServiceAccountEmail,
|
|
86
89
|
mcpIapServiceAccountEmail,
|
|
87
90
|
runServiceAccountEmail,
|
|
@@ -387,6 +390,21 @@ export async function ensureUpgraderJob(
|
|
|
387
390
|
role: "roles/iam.serviceAccountUser",
|
|
388
391
|
why: "the app-roll moves the capture job, which runs as it, onto the new image",
|
|
389
392
|
},
|
|
393
|
+
{
|
|
394
|
+
account: auditRunnerServiceAccountEmail(projectId, env),
|
|
395
|
+
role: "roles/iam.serviceAccountUser",
|
|
396
|
+
why: "the app-roll moves the quality-audit runner, which runs as it, onto the new image",
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
account: importCrawlServiceAccountEmail(projectId, env),
|
|
400
|
+
role: "roles/iam.serviceAccountUser",
|
|
401
|
+
why: "the app-roll moves the site-import crawler, which runs as it, onto the new image",
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
account: buildCarrierServiceAccountEmail(projectId, env),
|
|
405
|
+
role: "roles/iam.serviceAccountUser",
|
|
406
|
+
why: "the app-roll moves the build carrier, which runs as it, onto the new image",
|
|
407
|
+
},
|
|
390
408
|
{
|
|
391
409
|
account: mcpIapServiceAccountEmail(projectId),
|
|
392
410
|
role: "roles/iam.serviceAccountTokenCreator",
|
package/src/wizard.ts
CHANGED
|
@@ -84,6 +84,13 @@ export interface WizardOptions {
|
|
|
84
84
|
* (run-mode.ts): `job` (default in Cloud Shell) or `local`.
|
|
85
85
|
*/
|
|
86
86
|
runMode?: RunMode;
|
|
87
|
+
/**
|
|
88
|
+
* #1558 — `--version`: the release a new GCP install runs instead of the
|
|
89
|
+
* newest stable one (a release candidate needs a confirmation).
|
|
90
|
+
*/
|
|
91
|
+
version?: string;
|
|
92
|
+
/** #1558 — `--accept-release-candidate`: confirms a release candidate without a prompt. */
|
|
93
|
+
acceptReleaseCandidate?: boolean;
|
|
87
94
|
}
|
|
88
95
|
|
|
89
96
|
export async function runWizard(opts: WizardOptions = {}): Promise<void> {
|
|
@@ -119,7 +126,10 @@ export async function runWizard(opts: WizardOptions = {}): Promise<void> {
|
|
|
119
126
|
process.exit(1);
|
|
120
127
|
}
|
|
121
128
|
const { prepareJobModeInstall } = await import("./wizards/gcp-install-job.js");
|
|
122
|
-
const prep = await prepareJobModeInstall(
|
|
129
|
+
const prep = await prepareJobModeInstall({
|
|
130
|
+
...(opts.projectId ? { projectId: opts.projectId } : {}),
|
|
131
|
+
...(opts.version ? { version: opts.version } : {}),
|
|
132
|
+
});
|
|
123
133
|
if (prep.kind === "handled") {
|
|
124
134
|
outro(bold("Done."));
|
|
125
135
|
return;
|
|
@@ -131,7 +141,7 @@ export async function runWizard(opts: WizardOptions = {}): Promise<void> {
|
|
|
131
141
|
const existing = opts.nonInteractive || runMode === "job" ? [] : listInstalls();
|
|
132
142
|
const picked =
|
|
133
143
|
existing.length > 0 && !opts.provider && !opts.domain && !opts.ownerEmail
|
|
134
|
-
? await pickInstallToResume(existing)
|
|
144
|
+
? await pickInstallToResume(existing, opts)
|
|
135
145
|
: null;
|
|
136
146
|
// #696 — the bucket's copy for an install whose state lives there: another
|
|
137
147
|
// machine may have changed its domain or owner since this mirror was written.
|
|
@@ -217,6 +227,11 @@ export async function runWizard(opts: WizardOptions = {}): Promise<void> {
|
|
|
217
227
|
for (const line of scrubInstallProgress(installId)) log.warn(yellow(line));
|
|
218
228
|
|
|
219
229
|
// 4. Delegate to the provider-specific wizard.
|
|
230
|
+
// #1558 — the release to install, settled by the GCP wizard.
|
|
231
|
+
const release = {
|
|
232
|
+
...(opts.version ? { version: opts.version } : {}),
|
|
233
|
+
...(opts.acceptReleaseCandidate ? { acceptReleaseCandidate: true } : {}),
|
|
234
|
+
};
|
|
220
235
|
switch (provider) {
|
|
221
236
|
case "gcp":
|
|
222
237
|
await runGcpWizard({
|
|
@@ -227,6 +242,7 @@ export async function runWizard(opts: WizardOptions = {}): Promise<void> {
|
|
|
227
242
|
nonInteractive: opts.nonInteractive ?? false,
|
|
228
243
|
...(opts.region ? { region: opts.region } : {}),
|
|
229
244
|
runMode,
|
|
245
|
+
...release,
|
|
230
246
|
});
|
|
231
247
|
break;
|
|
232
248
|
case "gcp-firebase":
|
|
@@ -238,13 +254,14 @@ export async function runWizard(opts: WizardOptions = {}): Promise<void> {
|
|
|
238
254
|
nonInteractive: opts.nonInteractive ?? false,
|
|
239
255
|
...(opts.region ? { region: opts.region } : {}),
|
|
240
256
|
runMode,
|
|
257
|
+
...release,
|
|
241
258
|
});
|
|
242
259
|
break;
|
|
243
260
|
case "self-hosted":
|
|
244
261
|
// The self-hosted install runs on the Docker host itself, from the
|
|
245
262
|
// directory that should hold `.caelo/` — not from this wizard.
|
|
246
263
|
cancel(
|
|
247
|
-
`Run this on the Docker host, in the directory that should hold the install:\n ${selfCommand("--provider", "self-hosted", "--domain", domain, "--owner-email", ownerEmail)}`,
|
|
264
|
+
`Run this on the Docker host, in the directory that should hold the install:\n ${selfCommand("--provider", "self-hosted", "--domain", domain, "--owner-email", ownerEmail, ...(opts.version ? ["--version", opts.version] : []))}`,
|
|
248
265
|
);
|
|
249
266
|
process.exit(0);
|
|
250
267
|
break;
|
|
@@ -267,7 +284,10 @@ export async function runWizard(opts: WizardOptions = {}): Promise<void> {
|
|
|
267
284
|
* inputs prompts. Returning an install means resume — every input
|
|
268
285
|
* (provider, domain, owner, project) carries over from metadata.
|
|
269
286
|
*/
|
|
270
|
-
async function pickInstallToResume(
|
|
287
|
+
async function pickInstallToResume(
|
|
288
|
+
installs: InstallMetadata[],
|
|
289
|
+
release: Pick<WizardOptions, "version" | "acceptReleaseCandidate">,
|
|
290
|
+
): Promise<InstallMetadata | null> {
|
|
271
291
|
const first = installs[0];
|
|
272
292
|
// v0.5.14 — added per-install "Upgrade" entries that route to
|
|
273
293
|
// upgradeCommand (Cloud Run image roll) without re-running the
|
|
@@ -316,7 +336,12 @@ async function pickInstallToResume(installs: InstallMetadata[]): Promise<Install
|
|
|
316
336
|
// available via `cms-provision upgrade --version vX.Y.Z`. The picked
|
|
317
337
|
// install is passed on: without it upgrade would choose again (and,
|
|
318
338
|
// before that was fixed, took the first ~/.caelo-* it found).
|
|
319
|
-
|
|
339
|
+
// #1558 — a `--version` given to the wizard is the upgrade's target.
|
|
340
|
+
await upgradeCommand({
|
|
341
|
+
installId: target.installId,
|
|
342
|
+
...(release.version ? { version: release.version } : {}),
|
|
343
|
+
...(release.acceptReleaseCandidate ? { acceptReleaseCandidate: true } : {}),
|
|
344
|
+
});
|
|
320
345
|
process.exit(0);
|
|
321
346
|
}
|
|
322
347
|
const installId = choice.startsWith("resume:") ? choice.slice("resume:".length) : choice;
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
import { describe, expect, it } from "bun:test";
|
|
10
10
|
import { SERVICE_CPU_IDLE } from "../stack-contract.js";
|
|
11
11
|
import {
|
|
12
|
-
|
|
13
|
-
alwaysOnAdminInstanceUsd,
|
|
12
|
+
adminRequestHourUsd,
|
|
14
13
|
type CostEstimateInputs,
|
|
15
14
|
estimateGcpCost,
|
|
16
15
|
schedulerTickMonthlyUsd,
|
|
@@ -74,21 +73,20 @@ describe("cost table: scheduler tick (#1140)", () => {
|
|
|
74
73
|
expect(fast?.name).toContain("every 1 min");
|
|
75
74
|
});
|
|
76
75
|
|
|
77
|
-
it("prices
|
|
78
|
-
//
|
|
79
|
-
//
|
|
80
|
-
|
|
81
|
-
expect(
|
|
82
|
-
// 2,592,000 s x (1 vCPU x $0.000018 + 2 GiB x $0.000002).
|
|
83
|
-
expect(alwaysOnAdminInstanceUsd(2)).toBe(57);
|
|
76
|
+
it("prices an idle scale-to-zero admin at about nothing: CPU only during requests (#1361)", () => {
|
|
77
|
+
// Before #1361 the admin had always-on CPU, and the tick (at most every
|
|
78
|
+
// 15 minutes) beat Cloud Run's 15-minute idle shutdown: one instance was
|
|
79
|
+
// billed around the clock (~$57 a month at 2 GiB).
|
|
80
|
+
expect(SERVICE_CPU_IDLE.admin).toBe(true);
|
|
84
81
|
const admin = estimateGcpCost(inputs).lines.find((l) => l.name.startsWith("Cloud Run admin"));
|
|
85
|
-
expect(admin?.monthlyUsd).toBe(
|
|
86
|
-
expect(admin?.notes).toContain("
|
|
87
|
-
|
|
82
|
+
expect(admin?.monthlyUsd).toBe(0);
|
|
83
|
+
expect(admin?.notes).toContain("~$0 idle");
|
|
84
|
+
// 3,600 s x (1 vCPU x $0.000024 + 2 GiB x $0.0000025).
|
|
85
|
+
expect(adminRequestHourUsd(2)).toBe(0.1);
|
|
86
|
+
expect(admin?.notes).toContain("~$0.10 per hour of open requests");
|
|
88
87
|
});
|
|
89
88
|
|
|
90
89
|
it("adds nothing on the admin with a min instance, which is up anyway", () => {
|
|
91
|
-
expect(adminKeptWarmByTicks(1)).toBe(false);
|
|
92
90
|
const admin = estimateGcpCost({ ...inputs, adminMinInstances: 1 }).lines.find((l) =>
|
|
93
91
|
l.name.startsWith("Cloud Run admin"),
|
|
94
92
|
);
|
package/src/wizards/gcp-cost.ts
CHANGED
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
memoryQuantityMiB,
|
|
18
18
|
parseSchedulerIntervalMinutes,
|
|
19
19
|
RUNTIME_SECRETS,
|
|
20
|
-
SERVICE_CPU_IDLE,
|
|
21
20
|
} from "../stack-contract.js";
|
|
22
21
|
|
|
23
22
|
export interface CostLine {
|
|
@@ -78,8 +77,8 @@ const SCHEDULER_JOB_USD = 0.1;
|
|
|
78
77
|
* #1140 — what the scheduler tick costs a month at `minutes` between ticks:
|
|
79
78
|
* the Cloud Scheduler job (priced as paid — the 3 free jobs are shared
|
|
80
79
|
* with every other project on the billing account) plus the Workflows
|
|
81
|
-
* steps past the free tier.
|
|
82
|
-
*
|
|
80
|
+
* steps past the free tier. On the admin's side a tick is a request of
|
|
81
|
+
* about a second, inside Cloud Run's free tier (the admin's own line).
|
|
83
82
|
*/
|
|
84
83
|
export function schedulerTickMonthlyUsd(minutes: number): number {
|
|
85
84
|
const ticks = Math.ceil((30 * 24 * 60) / parseSchedulerIntervalMinutes(minutes));
|
|
@@ -99,31 +98,21 @@ export function schedulerTickMonthlyUsd(minutes: number): number {
|
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
/**
|
|
102
|
-
* Cloud Run
|
|
103
|
-
* tier-1 region, cloud.google.com/run/pricing as of 2026-11. The free
|
|
104
|
-
* is left out: it is shared by every service on the billing account.
|
|
101
|
+
* Cloud Run request-based billing (CPU only during requests) list rates,
|
|
102
|
+
* USD, tier-1 region, cloud.google.com/run/pricing as of 2026-11. The free
|
|
103
|
+
* tier is left out: it is shared by every service on the billing account.
|
|
105
104
|
*/
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
/** Seconds in the 30-day month the table prices. */
|
|
109
|
-
const MONTH_SECONDS = 30 * 24 * 60 * 60;
|
|
105
|
+
const CLOUD_RUN_REQUEST_PRICE = { vcpuSecond: 0.000024, gibSecond: 0.0000025 } as const;
|
|
110
106
|
|
|
111
107
|
/**
|
|
112
|
-
* #
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
* until #1361) the instance never stops and is billed every second. With
|
|
117
|
-
* request-billed CPU an idle instance costs nothing between ticks.
|
|
108
|
+
* #1361 — what one hour of open admin requests (1 vCPU, `gib` memory) costs
|
|
109
|
+
* at request-based list rates: editing time, the only time a scale-to-zero
|
|
110
|
+
* admin is billed. The scheduler's ticks (about a second each) and the
|
|
111
|
+
* idle instance between requests cost nothing (`SERVICE_CPU_IDLE.admin`).
|
|
118
112
|
*/
|
|
119
|
-
export function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
/** One always-on admin instance (1 vCPU, `gib` memory) a month at instance-based list rates. */
|
|
124
|
-
export function alwaysOnAdminInstanceUsd(gib: number): number {
|
|
125
|
-
const perSecond = CLOUD_RUN_INSTANCE_PRICE.vcpuSecond + gib * CLOUD_RUN_INSTANCE_PRICE.gibSecond;
|
|
126
|
-
return Math.round(perSecond * MONTH_SECONDS);
|
|
113
|
+
export function adminRequestHourUsd(gib: number): number {
|
|
114
|
+
const perSecond = CLOUD_RUN_REQUEST_PRICE.vcpuSecond + gib * CLOUD_RUN_REQUEST_PRICE.gibSecond;
|
|
115
|
+
return Math.round(perSecond * 3600 * 100) / 100;
|
|
127
116
|
}
|
|
128
117
|
|
|
129
118
|
/**
|
|
@@ -196,19 +185,16 @@ export function estimateGcpCost(inputs: CostEstimateInputs): {
|
|
|
196
185
|
},
|
|
197
186
|
{
|
|
198
187
|
name: `Cloud Run admin (${adminMemory})`,
|
|
199
|
-
//
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
: inputs.adminMinInstances === 0
|
|
206
|
-
? 7
|
|
188
|
+
// #1361 — request-billed CPU (SERVICE_CPU_IDLE.admin): the admin is
|
|
189
|
+
// billed only while a request is open. Idle, and the scheduler's
|
|
190
|
+
// ticks of about a second, it costs about nothing.
|
|
191
|
+
monthlyUsd:
|
|
192
|
+
inputs.adminMinInstances === 0
|
|
193
|
+
? 0
|
|
207
194
|
: Math.round(1 + inputs.adminMinInstances * perMinInstanceUsd),
|
|
208
|
-
notes:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
? "scale-to-zero, request-billed CPU; ~$7/mo light editorial use, ticks inside the free tier"
|
|
195
|
+
notes:
|
|
196
|
+
inputs.adminMinInstances === 0
|
|
197
|
+
? `scale-to-zero, CPU only during requests: ~$0 idle (the scheduler tick every ${schedulerMinutes} min stays in the free tier); editing adds ~$${adminRequestHourUsd(adminGiB).toFixed(2)} per hour of open requests, much of it in the free tier`
|
|
212
198
|
: `${inputs.adminMinInstances} min-instance${inputs.adminMinInstances > 1 ? "s" : ""} (no cold start); the scheduler tick adds nothing, the instance is up anyway`,
|
|
213
199
|
},
|
|
214
200
|
{
|
|
@@ -217,6 +203,33 @@ export function estimateGcpCost(inputs: CostEstimateInputs): {
|
|
|
217
203
|
notes:
|
|
218
204
|
"one container per Lighthouse run, all in parallel (up to 5 pages x 3 runs, ~90 s at 2 vCPU each; a page whose runs disagree gets 2 more): ~$0.05 per audited Stage, at most ~$0.08, partly in the free tier; results bucket ~$0",
|
|
219
205
|
},
|
|
206
|
+
{
|
|
207
|
+
// #1359 — the whole audit of a Stage runs in its own job, not on the
|
|
208
|
+
// admin's CPU: the page checks, the wait for the Lighthouse runs, the
|
|
209
|
+
// report back. It holds 1 vCPU / 2 GiB for the audit's length.
|
|
210
|
+
name: "Quality checks (Cloud Run audit runner job)",
|
|
211
|
+
monthlyUsd: 1,
|
|
212
|
+
notes:
|
|
213
|
+
"one container per Stage for the audit's length (~2-10 min at 1 vCPU / 2 GiB, longer on large sites): ~$0.002-0.01 per Stage, mostly in the free tier",
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
// #1360 — a site import's crawl runs in its own job, not on the
|
|
217
|
+
// admin's CPU: the crawl loop, robots.txt, sitemaps, extraction. Each
|
|
218
|
+
// page's render is the capture job's, priced below.
|
|
219
|
+
name: "Site imports (Cloud Run crawl job)",
|
|
220
|
+
monthlyUsd: 0,
|
|
221
|
+
notes:
|
|
222
|
+
"one container per site import for the crawl's length (~1-2 min per 10 pages at 1 vCPU / 2 GiB, mostly waiting for renders): ~$0.01 for a 50-page import; nothing without imports",
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
// #1574 — a Stage, Publish live or production build nobody else waits
|
|
226
|
+
// for (an agent's Stage, a button whose tab closed) runs inside the
|
|
227
|
+
// request this job holds open; the build itself stays the admin's.
|
|
228
|
+
name: "Builds nobody waits for (Cloud Run build carrier job)",
|
|
229
|
+
monthlyUsd: 0,
|
|
230
|
+
notes:
|
|
231
|
+
"one small container per such build for the build's length (1 vCPU / 512 MiB, waiting for the admin's answer): ~$0.001 per build minute, a 2-minute Stage ~$0.002; mostly in the free tier",
|
|
232
|
+
},
|
|
220
233
|
{
|
|
221
234
|
name: "Screenshots (Cloud Run capture job)",
|
|
222
235
|
monthlyUsd: 1,
|
|
@@ -36,6 +36,10 @@ export interface GcpFirebaseWizardOpts {
|
|
|
36
36
|
region?: string;
|
|
37
37
|
/** #696 — see {@link GcpWizardOpts.runMode}. */
|
|
38
38
|
runMode?: RunMode;
|
|
39
|
+
/** #1558 — see {@link GcpWizardOpts.version}. */
|
|
40
|
+
version?: string;
|
|
41
|
+
/** #1558 — see {@link GcpWizardOpts.acceptReleaseCandidate}. */
|
|
42
|
+
acceptReleaseCandidate?: boolean;
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
export async function runGcpFirebaseWizard(opts: GcpFirebaseWizardOpts): Promise<void> {
|
|
@@ -67,6 +71,8 @@ export async function runGcpFirebaseWizard(opts: GcpFirebaseWizardOpts): Promise
|
|
|
67
71
|
nonInteractive: opts.nonInteractive,
|
|
68
72
|
...(opts.region ? { region: opts.region } : {}),
|
|
69
73
|
...(opts.runMode ? { runMode: opts.runMode } : {}),
|
|
74
|
+
...(opts.version ? { version: opts.version } : {}),
|
|
75
|
+
...(opts.acceptReleaseCandidate ? { acceptReleaseCandidate: true } : {}),
|
|
70
76
|
provider: "gcp-firebase",
|
|
71
77
|
});
|
|
72
78
|
}
|
|
@@ -40,12 +40,14 @@ import {
|
|
|
40
40
|
currentMetadata,
|
|
41
41
|
type InstallMetadata,
|
|
42
42
|
installRoot,
|
|
43
|
-
isStepDone,
|
|
44
43
|
readLocalMetadata,
|
|
45
44
|
readMetadata,
|
|
46
|
-
recordedImageDigests,
|
|
47
|
-
recordImageDigests,
|
|
48
45
|
} from "../install-state.js";
|
|
46
|
+
import {
|
|
47
|
+
attachedInstallVersionProblem,
|
|
48
|
+
installRecordFromManifest,
|
|
49
|
+
recordLaunchRelease,
|
|
50
|
+
} from "../install-version.js";
|
|
49
51
|
import { issueOwnerSetup } from "../owner-setup-token.js";
|
|
50
52
|
import { fetchVerifiedReleaseManifest } from "../release-manifest.js";
|
|
51
53
|
import { selfCommand } from "../self-command.js";
|
|
@@ -294,6 +296,10 @@ async function showResult(meta: InstallMetadata): Promise<void> {
|
|
|
294
296
|
/**
|
|
295
297
|
* After the bootstrap (gcp.ts, job mode): pin the release, start the job —
|
|
296
298
|
* or attach to / show the one already there — and follow it.
|
|
299
|
+
*
|
|
300
|
+
* @param opts.version - `--version` (#1558), already settled by the wizard:
|
|
301
|
+
* the release the job runs and, on a new install, deploys. Default: the
|
|
302
|
+
* release this CLI belongs to.
|
|
297
303
|
*/
|
|
298
304
|
export async function launchInstallJob(opts: {
|
|
299
305
|
installId: string;
|
|
@@ -301,6 +307,7 @@ export async function launchInstallJob(opts: {
|
|
|
301
307
|
region: string;
|
|
302
308
|
provisionerEmail: string;
|
|
303
309
|
nonInteractive: boolean;
|
|
310
|
+
version?: string;
|
|
304
311
|
}): Promise<void> {
|
|
305
312
|
const { installId, projectId, region } = opts;
|
|
306
313
|
const meta = readMetadata(installId);
|
|
@@ -329,22 +336,27 @@ export async function launchInstallJob(opts: {
|
|
|
329
336
|
}
|
|
330
337
|
}
|
|
331
338
|
|
|
332
|
-
// The release this CLI belongs to,
|
|
333
|
-
// workflow identity: its manifest pins
|
|
334
|
-
// for a new install, the admin
|
|
335
|
-
|
|
339
|
+
// The release to install (`--version`, else the one this CLI belongs to),
|
|
340
|
+
// verified against Caelo's release workflow identity: its manifest pins
|
|
341
|
+
// the ops image the job runs and, for a new install, the admin, gateway
|
|
342
|
+
// and MCP-Auth-Proxy images it deploys.
|
|
343
|
+
const version = opts.version ?? CAELO_VERSION;
|
|
344
|
+
const verified = await fetchVerifiedReleaseManifest(version);
|
|
336
345
|
if (!verified.ok) {
|
|
337
|
-
cancel(`Could not verify release v${
|
|
346
|
+
cancel(`Could not verify release v${version}: ${verified.error.message}`);
|
|
338
347
|
process.exit(1);
|
|
339
348
|
}
|
|
340
349
|
const { digests } = verified.manifest;
|
|
341
|
-
|
|
342
|
-
|
|
350
|
+
const record = installRecordFromManifest(verified.manifest);
|
|
351
|
+
if (!record.ok) {
|
|
352
|
+
cancel(record.error);
|
|
353
|
+
process.exit(1);
|
|
343
354
|
}
|
|
344
355
|
|
|
345
356
|
// One launcher at a time decides and starts: two terminals resuming the
|
|
346
357
|
// same install would otherwise both start an execution before either
|
|
347
|
-
// recorded it. Under the lock the decision is taken again
|
|
358
|
+
// recorded it. Under the lock the decision is taken again, and only the
|
|
359
|
+
// launcher that starts the job records its release.
|
|
348
360
|
const bucket = opsBucketName(projectId);
|
|
349
361
|
let release: () => void;
|
|
350
362
|
try {
|
|
@@ -364,6 +376,15 @@ export async function launchInstallJob(opts: {
|
|
|
364
376
|
} else await showResult(meta);
|
|
365
377
|
return;
|
|
366
378
|
}
|
|
379
|
+
// #1558 — the release the job deploys, recorded from the bucket as it is
|
|
380
|
+
// now: another launcher may have recorded one, or an earlier job taken
|
|
381
|
+
// the install past its first `pulumi up`, since this process read it.
|
|
382
|
+
const recorded = recordLaunchRelease(installId, projectId, opts.version, record);
|
|
383
|
+
if (!recorded.ok) {
|
|
384
|
+
release();
|
|
385
|
+
cancel(recorded.error);
|
|
386
|
+
process.exit(1);
|
|
387
|
+
}
|
|
367
388
|
// Automatic DNS in the job (dns/cloudflare.ts) when this shell has a
|
|
368
389
|
// Cloudflare token: it goes to Secret Manager and is mounted into the
|
|
369
390
|
// job as CLOUDFLARE_API_TOKEN — never into the job definition or args.
|
|
@@ -409,7 +430,8 @@ export async function launchInstallJob(opts: {
|
|
|
409
430
|
execution,
|
|
410
431
|
state: "running",
|
|
411
432
|
phase: "Starting the install job",
|
|
412
|
-
|
|
433
|
+
// The release the job runs (its own record says the same).
|
|
434
|
+
caeloVersion: version,
|
|
413
435
|
startedAt: at,
|
|
414
436
|
updatedAt: at,
|
|
415
437
|
},
|
|
@@ -437,9 +459,14 @@ export type JobModePreparation =
|
|
|
437
459
|
* followed and one whose job finished is shown, without re-running the
|
|
438
460
|
* bootstrap. Otherwise the wizard continues (new install, or a re-run of an
|
|
439
461
|
* unfinished bootstrap).
|
|
462
|
+
*
|
|
463
|
+
* @param opts.version - `--version` (#1558): refused before following or
|
|
464
|
+
* showing a job that installs another release, since neither path reaches
|
|
465
|
+
* the wizard's own check.
|
|
440
466
|
*/
|
|
441
467
|
export async function prepareJobModeInstall(opts: {
|
|
442
468
|
projectId?: string;
|
|
469
|
+
version?: string;
|
|
443
470
|
}): Promise<JobModePreparation> {
|
|
444
471
|
const account = await activeAccount();
|
|
445
472
|
if (!account) {
|
|
@@ -475,6 +502,13 @@ export async function prepareJobModeInstall(opts: {
|
|
|
475
502
|
log.success(`Found install ${bold(meta.installId)} (${meta.domain}) in ${projectId}.`);
|
|
476
503
|
if (!meta.region) return { kind: "existing", meta };
|
|
477
504
|
const decision = await decide(gcloud, realSyncGcloud, { projectId, region: meta.region });
|
|
505
|
+
if (decision.kind === "attach" || decision.kind === "done") {
|
|
506
|
+
const problem = attachedInstallVersionProblem(opts.version, meta.releaseVersion);
|
|
507
|
+
if (problem) {
|
|
508
|
+
cancel(problem);
|
|
509
|
+
process.exit(1);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
478
512
|
if (decision.kind === "attach") {
|
|
479
513
|
announceHandoff(projectId);
|
|
480
514
|
await followToTheEnd(meta, decision.status.execution);
|