@caelo-cms/provisioning 0.10.71 → 0.10.72
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/adc-check.d.ts +36 -0
- package/dist/adc-check.d.ts.map +1 -0
- package/dist/adc-check.js +52 -0
- package/dist/adc-check.js.map +1 -0
- package/dist/adc-impersonation.d.ts +6 -2
- package/dist/adc-impersonation.d.ts.map +1 -1
- package/dist/adc-impersonation.js +8 -9
- package/dist/adc-impersonation.js.map +1 -1
- package/dist/agent-db.js +3 -3
- package/dist/state-command.d.ts.map +1 -1
- package/dist/state-command.js +9 -3
- package/dist/state-command.js.map +1 -1
- package/dist/state-migrate.d.ts +12 -0
- package/dist/state-migrate.d.ts.map +1 -1
- package/dist/state-migrate.js +4 -0
- package/dist/state-migrate.js.map +1 -1
- package/dist/wizards/gcp.d.ts.map +1 -1
- package/dist/wizards/gcp.js +19 -12
- package/dist/wizards/gcp.js.map +1 -1
- package/package.json +2 -2
- package/src/adc-check.test.ts +54 -0
- package/src/adc-check.ts +70 -0
- package/src/adc-impersonation.ts +14 -11
- package/src/provisioner-identity.test.ts +25 -0
- package/src/state-command.test.ts +12 -0
- package/src/state-command.ts +11 -3
- package/src/state-migrate.test.ts +53 -0
- package/src/state-migrate.ts +11 -0
- package/src/wizards/gcp.ts +25 -13
package/src/state-migrate.ts
CHANGED
|
@@ -82,6 +82,13 @@ export interface StatePulumiOps {
|
|
|
82
82
|
export interface MigrateDeps {
|
|
83
83
|
readonly pulumi: StatePulumiOps;
|
|
84
84
|
readonly report: UpgradeReporter;
|
|
85
|
+
/**
|
|
86
|
+
* #1078 — whether this machine's Application Default Credentials (which
|
|
87
|
+
* every Pulumi call here uses) work now. Checked before the first Pulumi
|
|
88
|
+
* call, so missing or expired ones stop the run with the login command
|
|
89
|
+
* instead of a page of per-resource provider errors.
|
|
90
|
+
*/
|
|
91
|
+
checkAdc(): Promise<{ readonly ok: true } | { readonly ok: false; readonly error: string }>;
|
|
85
92
|
/** The install's backend resolved for Pulumi. */
|
|
86
93
|
resolve(record: StateBackendRecord): ResolvedBackend;
|
|
87
94
|
/** Ask the operator to accept the ops backend's cost; false = cancel. */
|
|
@@ -241,6 +248,10 @@ export async function migrateState(
|
|
|
241
248
|
};
|
|
242
249
|
}
|
|
243
250
|
}
|
|
251
|
+
const adc = await deps.checkAdc();
|
|
252
|
+
if (!adc.ok) {
|
|
253
|
+
return { ok: false, error: `${adc.error} Nothing was changed.` };
|
|
254
|
+
}
|
|
244
255
|
const pre = report.step("Preflight: Pulumi CLI, source stack, pending operations, drift");
|
|
245
256
|
let from: ResolvedBackend;
|
|
246
257
|
let mode: "stack-migrate" | "export-import";
|
package/src/wizards/gcp.ts
CHANGED
|
@@ -51,6 +51,7 @@ import type { DnsRecord } from "../dns/types.js";
|
|
|
51
51
|
import {
|
|
52
52
|
activeAccount,
|
|
53
53
|
type BillingAccount,
|
|
54
|
+
checkGcloudAuth,
|
|
54
55
|
createProject,
|
|
55
56
|
createServiceAccount,
|
|
56
57
|
enableApis,
|
|
@@ -639,19 +640,20 @@ async function resolveImageDigests(): Promise<ImageDigests> {
|
|
|
639
640
|
// Per-step helpers
|
|
640
641
|
// =========================================================================
|
|
641
642
|
|
|
643
|
+
/**
|
|
644
|
+
* An active gcloud account that can mint a token now. `activeAccount` alone
|
|
645
|
+
* passes with an expired login (`auth list` reads local config), and the
|
|
646
|
+
* first real gcloud call of the run then failed with a reauth error deep in
|
|
647
|
+
* a later step (#630, #1078).
|
|
648
|
+
*/
|
|
642
649
|
async function stepActiveGcloud(): Promise<void> {
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
log.warn(
|
|
648
|
-
`Run ${bold("gcloud auth login")} in another terminal, then re-run ${bold(selfCommand())}.`,
|
|
649
|
-
);
|
|
650
|
-
cancel("Aborted — no gcloud auth.");
|
|
650
|
+
const auth = await checkGcloudAuth();
|
|
651
|
+
if (!auth.ok) {
|
|
652
|
+
log.error(red(auth.error));
|
|
653
|
+
cancel("Aborted — nothing was changed.");
|
|
651
654
|
process.exit(2);
|
|
652
655
|
}
|
|
653
|
-
log.success(`gcloud auth: ${bold(account)}`);
|
|
654
|
-
void stepName;
|
|
656
|
+
log.success(`gcloud auth: ${bold(auth.account)}`);
|
|
655
657
|
}
|
|
656
658
|
|
|
657
659
|
async function stepProjectId(opts: GcpWizardOpts): Promise<string> {
|
|
@@ -1385,8 +1387,18 @@ async function stepKeylessProvisioner(
|
|
|
1385
1387
|
const sAdc = spinner();
|
|
1386
1388
|
sAdc.start("Checking that your Application Default Credentials can impersonate it...");
|
|
1387
1389
|
let adc = await check();
|
|
1388
|
-
if (
|
|
1389
|
-
|
|
1390
|
+
if (
|
|
1391
|
+
!adc.ok &&
|
|
1392
|
+
(adc.reason === "no-adc" || adc.reason === "expired-adc") &&
|
|
1393
|
+
!opts.nonInteractive
|
|
1394
|
+
) {
|
|
1395
|
+
sAdc.stop(
|
|
1396
|
+
yellow(
|
|
1397
|
+
adc.reason === "expired-adc"
|
|
1398
|
+
? "Your Application Default Credentials have expired"
|
|
1399
|
+
: "No Application Default Credentials yet",
|
|
1400
|
+
),
|
|
1401
|
+
);
|
|
1390
1402
|
const login = await confirm({
|
|
1391
1403
|
message: `Run ${bold("gcloud auth application-default login")} now (opens your browser; sign in as ${account})?`,
|
|
1392
1404
|
initialValue: true,
|
|
@@ -1403,7 +1415,7 @@ async function stepKeylessProvisioner(
|
|
|
1403
1415
|
}
|
|
1404
1416
|
if (!adc.ok) {
|
|
1405
1417
|
sAdc.stop(red("Infrastructure credentials not ready"));
|
|
1406
|
-
log.error(adc.error);
|
|
1418
|
+
log.error(`${adc.error}\nPulumi was not started.`);
|
|
1407
1419
|
cancel("Aborted.");
|
|
1408
1420
|
process.exit(1);
|
|
1409
1421
|
}
|