Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/lib/onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3539,7 +3539,7 @@ async function ensureNamedCredential(
return replaceNamedCredential(envName, label, helpUrl);
}

function waitForSandboxReady(sandboxName: string, attempts = 10, delaySeconds = 2): boolean {
async function waitForSandboxReady(sandboxName: string, attempts = 10, delaySeconds = 2): Promise<boolean> {
for (let i = 0; i < attempts; i += 1) {
const podPhase = runCaptureOpenshell(
[
Expand All @@ -3558,7 +3558,7 @@ function waitForSandboxReady(sandboxName: string, attempts = 10, delaySeconds =
{ ignoreError: true },
);
if (podPhase === "Running") return true;
sleep(delaySeconds);
await new Promise((r) => setTimeout(r, delaySeconds * 1000));
}
return false;
}
Expand Down Expand Up @@ -7984,7 +7984,7 @@ async function _setupPolicies(
process.exit(1);
}

if (!waitForSandboxReady(sandboxName)) {
if (!(await waitForSandboxReady(sandboxName))) {
console.error(` Sandbox '${sandboxName}' was not ready for policy application.`);
process.exit(1);
}
Expand Down Expand Up @@ -8022,7 +8022,7 @@ async function _setupPolicies(
return;
}

if (!waitForSandboxReady(sandboxName)) {
if (!(await waitForSandboxReady(sandboxName))) {
console.error(` Sandbox '${sandboxName}' was not ready for policy application.`);
process.exit(1);
}
Expand Down Expand Up @@ -8617,7 +8617,7 @@ async function setupPoliciesWithSelection(
if (selectedPresets && selectedPresets.length > 0) {
const resumeSelection = chosen || [];
if (onSelection) onSelection(resumeSelection);
if (!waitForSandboxReady(sandboxName)) {
if (!(await waitForSandboxReady(sandboxName))) {
console.error(` Sandbox '${sandboxName}' was not ready for policy application.`);
process.exit(1);
}
Expand Down Expand Up @@ -8702,7 +8702,7 @@ async function setupPoliciesWithSelection(
}

if (onSelection) onSelection(chosen);
if (!waitForSandboxReady(sandboxName)) {
if (!(await waitForSandboxReady(sandboxName))) {
console.error(` Sandbox '${sandboxName}' was not ready for policy application.`);
process.exit(1);
}
Expand All @@ -8724,7 +8724,7 @@ async function setupPoliciesWithSelection(
const interactiveChoice = resolvedPresets.map((p) => p.name);

if (onSelection) onSelection(interactiveChoice);
if (!waitForSandboxReady(sandboxName)) {
if (!(await waitForSandboxReady(sandboxName))) {
console.error(` Sandbox '${sandboxName}' was not ready for policy application.`);
process.exit(1);
}
Expand Down
Loading