Skip to content

fix: reject --startup-script for container and compose modes - #530

Open
pcbeingused333 wants to merge 1 commit into
brevdev:mainfrom
pcbeingused333:fix/create-startup-script-container-mode
Open

pcbeingused333 wants to merge 1 commit into
brevdev:mainfrom
pcbeingused333:fix/create-startup-script-container-mode

Conversation

@pcbeingused333

Copy link
Copy Markdown

There is no issue for this path. This does not fix #383: that report is about vm instances, where the CLI already sends the script and the instance still does not run it.

Cause

brev create -m container and -m compose accept --startup-script / -s. applyBuildMode copies the script into VMBuild.LifeCycleScriptAttr only for vm and k8s. Container and compose builds have no lifecycle-script field, so the flag was dropped and the command succeeded as if it had not been passed. An @file path was still opened, then ignored when the file existed.

Fix

validateBuildMode now returns a validation error when a startup script is set for container or compose, using the same error type as the other mode checks. The check runs before the script file is read. vm and k8s are unchanged. The flag help text says the script applies only to those modes.

Test

go test -count=1 -timeout 180s -run 'TestCreateRejectsStartupScriptForContainerAndCompose|TestValidateBuildModeStartupScript' ./pkg/cmd/gpucreate/

Without the new check, both tests fail: container and compose with an inline script return success, and @setup.sh fails with "open setup.sh" instead of the mode error. With the check, those tests and the rest of ./pkg/cmd/gpucreate pass.

This change was prepared with the help of an AI assistant and reviewed before submission.

applyBuildMode only attaches the script for vm and k8s, so -m container
and -m compose dropped -s/--startup-script with no error. validateBuildMode
now rejects that combination the same way it rejects a missing image or
compose file.
@pcbeingused333
pcbeingused333 requested a review from a team as a code owner November 7, 2026 20:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

brev create -s @file silently drops the startup script (no error, no log) on m8i-flex.2xlarge AND n2d-standard-8

1 participant