fix: do not try to pull development sandbox image from the internet (#725)
This commit is contained in:
parent
546e033081
commit
e96fd677ee
|
@ -16,6 +16,8 @@ import {
|
||||||
SETTINGS_DIRECTORY_NAME,
|
SETTINGS_DIRECTORY_NAME,
|
||||||
} from '../config/settings.js';
|
} from '../config/settings.js';
|
||||||
|
|
||||||
|
const LOCAL_DEV_SANDBOX_IMAGE_NAME = 'gemini-cli-sandbox';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines whether the sandbox container should be run with the current user's UID and GID.
|
* Determines whether the sandbox container should be run with the current user's UID and GID.
|
||||||
* This is often necessary on Linux systems (especially Debian/Ubuntu based) when using
|
* This is often necessary on Linux systems (especially Debian/Ubuntu based) when using
|
||||||
|
@ -79,7 +81,7 @@ async function getSandboxImageName(): Promise<string> {
|
||||||
return (
|
return (
|
||||||
process.env.GEMINI_SANDBOX_IMAGE ??
|
process.env.GEMINI_SANDBOX_IMAGE ??
|
||||||
packageJsonConfig?.sandboxImageUri ??
|
packageJsonConfig?.sandboxImageUri ??
|
||||||
'gemini-cli-sandbox'
|
LOCAL_DEV_SANDBOX_IMAGE_NAME
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,9 +306,10 @@ export async function start_sandbox(sandbox: string) {
|
||||||
|
|
||||||
// stop if image is missing
|
// stop if image is missing
|
||||||
if (!(await ensureSandboxImageIsPresent(sandbox, image))) {
|
if (!(await ensureSandboxImageIsPresent(sandbox, image))) {
|
||||||
const remedy = gcPath.includes('gemini-code/packages/')
|
const remedy =
|
||||||
? 'Try running `BUILD_SANDBOX=1 gemini` or `scripts/build_sandbox.sh` under the gemini-code repo to build it locally, or check the image name and your network connection.'
|
image === LOCAL_DEV_SANDBOX_IMAGE_NAME
|
||||||
: 'Please check the image name, your network connection, or notify gemini-cli-dev@google.com if the issue persists.';
|
? 'Try running `npm run build:all` or `npm run build:sandbox` under the gemini-cli repo to build it locally, or check the image name and your network connection.'
|
||||||
|
: 'Please check the image name, your network connection, or notify gemini-cli-dev@google.com if the issue persists.';
|
||||||
console.error(
|
console.error(
|
||||||
`ERROR: Sandbox image '${image}' is missing or could not be pulled. ${remedy}`,
|
`ERROR: Sandbox image '${image}' is missing or could not be pulled. ${remedy}`,
|
||||||
);
|
);
|
||||||
|
@ -571,6 +574,11 @@ async function ensureSandboxImageIsPresent(
|
||||||
}
|
}
|
||||||
|
|
||||||
console.info(`Sandbox image ${image} not found locally.`);
|
console.info(`Sandbox image ${image} not found locally.`);
|
||||||
|
if (image === LOCAL_DEV_SANDBOX_IMAGE_NAME) {
|
||||||
|
// user needs to build the image themself
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (await pullImage(sandbox, image)) {
|
if (await pullImage(sandbox, image)) {
|
||||||
// After attempting to pull, check again to be certain
|
// After attempting to pull, check again to be certain
|
||||||
if (await imageExists(sandbox, image)) {
|
if (await imageExists(sandbox, image)) {
|
||||||
|
|
Loading…
Reference in New Issue