(fix): broken releases and e2e workflows (#4428)

This commit is contained in:
Abhi 2025-07-18 00:10:58 -04:00 committed by GitHub
parent 91c69731c7
commit 8497176168
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 19 additions and 7 deletions

View File

@ -48,7 +48,7 @@ steps:
- |
export GEMINI_SANDBOX_IMAGE_TAG=$$(cat /workspace/image_tag.txt)
echo "Using Docker image tag for build: $$GEMINI_SANDBOX_IMAGE_TAG"
npm run build:sandbox
npm run build:sandbox -- --output-file /workspace/final_image_uri.txt
env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL'

View File

@ -40,6 +40,11 @@ const argv = yargs(hideBin(process.argv))
alias: 'image',
type: 'string',
description: 'use <image> name for custom image',
})
.option('output-file', {
type: 'string',
description:
'Path to write the final image URI. Used for CI/CD pipeline integration.',
}).argv;
let sandboxCommand;
@ -134,14 +139,21 @@ function buildImage(imageName, dockerfile) {
{ stdio: buildStdout, shell: '/bin/bash' },
);
console.log(`built ${finalImageName}`);
if (existsSync('/workspace/final_image_uri.txt')) {
// If an output file path was provided via command-line, write the final image URI to it.
if (argv.outputFile) {
console.log(
`Writing final image URI for CI artifact to: ${argv.outputFile}`,
);
// The publish step only supports one image. If we build multiple, only the last one
// will be published. Throw an error to make this failure explicit.
// will be published. Throw an error to make this failure explicit if the file already exists.
if (existsSync(argv.outputFile)) {
throw new Error(
'CI artifact file /workspace/final_image_uri.txt already exists. Refusing to overwrite.',
`CI artifact file ${argv.outputFile} already exists. Refusing to overwrite.`,
);
}
writeFileSync('/workspace/final_image_uri.txt', finalImageName);
writeFileSync(argv.outputFile, finalImageName);
}
}
if (baseImage && baseDockerfile) {