Skip to content

fix(BREV-9479): inline lifecycle script body when deploying launchable via CLI#394

Merged
patelspratik merged 2 commits into
mainfrom
fix/BREV-9479/launchable-cli-deploy
Jun 2, 2026
Merged

fix(BREV-9479): inline lifecycle script body when deploying launchable via CLI#394
patelspratik merged 2 commits into
mainfrom
fix/BREV-9479/launchable-cli-deploy

Conversation

@harshsharmanv
Copy link
Copy Markdown
Contributor

Summary

  • brev create <name> --launchable <id> failed with rpc error: code = Internal desc = lifecycle script is empty whenever the launchable had a lifecycle script attached.
  • The launchable GET endpoint returns lifeCycleScriptAttr as an {id, name} reference; the script body is stored in blobstore and is not inlined, passed on user's request but not returned on get or list. The backend's create-workspace path requires the client to supply the script content.
  • The Brev Console handles this by calling GET /api/launchable/lifecycle-script?envId=...&scriptId=... and inlining the response into attrs.script before sending create request. The CLI did not, it forwarded the reference as-is.

This PR makes the CLI mirror the Brev Console:

  1. New store method AuthHTTPStore.GetLaunchableLifeCycleScript hitting the same endpoint the Console uses.
  2. fetchAndDisplayLaunchable now calls inlineLaunchableLifeCycleScript, which fetches and inlines the body when attr.ID is set and attr.Script is empty.
  3. Brev client gate the fetch on id presence, so launchables with no lifecycle script remain unaffected — the field stays nil, omitempty drops it from the POST, and the backend's hasLifecycleScript returns false (no validation).

@harshsharmanv harshsharmanv self-assigned this May 19, 2026
@harshsharmanv harshsharmanv requested a review from a team as a code owner May 19, 2026 14:13
@harshsharmanv harshsharmanv marked this pull request as draft May 19, 2026 14:16
@harshsharmanv harshsharmanv marked this pull request as ready for review May 20, 2026 13:01
Comment thread pkg/cmd/gpucreate/gpucreate.go
Comment thread pkg/cmd/gpucreate/gpucreate_test.go
@patelspratik patelspratik merged commit a62f179 into main Jun 2, 2026
9 checks passed
@patelspratik patelspratik deleted the fix/BREV-9479/launchable-cli-deploy branch June 2, 2026 16:36
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.

2 participants