(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) export GEMINI_SANDBOX_IMAGE_TAG=$$(cat /workspace/image_tag.txt)
echo "Using Docker image tag for build: $$GEMINI_SANDBOX_IMAGE_TAG" 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: env:
- 'GEMINI_SANDBOX=$_CONTAINER_TOOL' - 'GEMINI_SANDBOX=$_CONTAINER_TOOL'

View File

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