feat(agent): let promote target a deployment other than production - #1001
Open
JackNDwyer wants to merge 1 commit into
Open
JackNDwyer wants to merge 1 commit into
JackNDwyer wants to merge 1 commit into
Conversation
`lk agent promote` always passed an empty destination, so the image could
only ever land on production. Everything below the CLI already supports
an arbitrary destination:
- PromoteAgentRequest has src_deployment and dst_deployment
(livekit_cloud_agent.proto)
- the SDK passes both through (server-sdk-go pkg/cloudagents/client.go)
- cloud-agents PromoteAgent validates both names, rejects production as a
source, rejects src == dst, requires the destination to already exist,
and calls SetActiveVersion with the destination, reusing the existing
immutable version with no rebuild
So this is a CLI-only change:
lk agent promote --from dev --to qa
`--to` defaults to empty, which the API reads as production, so existing
invocations behave exactly as before. `--from` is the documented spelling
and `--deployment` stays as an alias, erroring only if both are given
with different values.
The destination must already exist. The server returns "destination
deployment not found" otherwise, which is deliberate: creating one needs
the deploy path for namespace and quota.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Production stays the default, so
lk agent promote --deployment stagingbehaves exactly as before.Why this is CLI-only
The destination was never hardcoded in the backend.
cmd/lk/agent.gojust always passed"":Everything underneath already supports an arbitrary destination:
PromoteAgentRequesthas bothsrc_deploymentanddst_deployment(protocol/protobufs/livekit_cloud_agent.proto:84-88)server-sdk-go/pkg/cloudagents/client.go:176-186)cloud-agents pkg/server/agent_server_v2.go:21-164validates both names, rejects production as source, canonicalizes the deprecated"production"literal to"", rejects src equal to dst, requires both region agents to exist and be non-deleted, requires the source version to beAvailable, then callsSetActiveVersion(..., req.DstDeployment), reusing the existing immutable version with no rebuildFlags
--fromis the documented spelling for the source--deployment/-dstill work as an alias, so existing scripts are unaffected. Passing both with different values is an error rather than a silent precedence rule--todefaults to empty, which the API reads as productionBehavior worth knowing
destination deployment not found. Auto-creating it would need the deploy path for namespace and quota, so it is deliberately out of scope here.SetActiveVersionand surfaces asResourceExhausted.dstRegionAgent.VersionID == srcRegionAgent.VersionID.Tests
TestResolvePromoteSourcecovers--from, the--deploymentand-dfallbacks, agreeing and conflicting combinations, and neither being set.TestPromoteDestinationDefaultsToProductionpins the default. Both pass locally.🤖 Generated with Claude Code