diff options
| author | Abhi <[email protected]> | 2025-07-18 00:10:58 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-18 04:10:58 +0000 |
| commit | 8497176168dded563d4cb98ecc988ea79251758a (patch) | |
| tree | 736a613fc03de603bd7ffda68685d9ca8d7f432d /scripts/build_sandbox.js | |
| parent | 91c69731c7be59adbea017d3c8f30281989b6f0a (diff) | |
(fix): broken releases and e2e workflows (#4428)
Diffstat (limited to 'scripts/build_sandbox.js')
| -rw-r--r-- | scripts/build_sandbox.js | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/scripts/build_sandbox.js b/scripts/build_sandbox.js index 51d0556e..7eece434 100644 --- a/scripts/build_sandbox.js +++ b/scripts/build_sandbox.js @@ -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')) { - // 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. - throw new Error( - 'CI artifact file /workspace/final_image_uri.txt already exists. Refusing to overwrite.', + + // 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 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) { |
