mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-23 10:05:08 +02:00
fix(cli): point a managed build at --push-to in a listener workspace
This commit is contained in:
@@ -1430,18 +1430,31 @@ def _resolve_or_create(
|
||||
)
|
||||
if found is not None:
|
||||
return found.id, step
|
||||
created, step = _create_deployment(
|
||||
ctx.client,
|
||||
step,
|
||||
name=ctx.selector.name,
|
||||
source=source,
|
||||
source_config={"deployment_type": ctx.deployment_type},
|
||||
source_revision_config={},
|
||||
secrets=ctx.secrets,
|
||||
)
|
||||
try:
|
||||
created, step = _create_deployment(
|
||||
ctx.client,
|
||||
step,
|
||||
name=ctx.selector.name,
|
||||
source=source,
|
||||
source_config={"deployment_type": ctx.deployment_type},
|
||||
source_revision_config={},
|
||||
secrets=ctx.secrets,
|
||||
)
|
||||
except HostBackendError as err:
|
||||
if _needs_a_listener(err):
|
||||
raise click.UsageError(
|
||||
"This workspace deploys through a listener in your own cluster, so "
|
||||
"the image has to come from a registry you manage. Re-run with "
|
||||
"--push-to <registry>/<repository>."
|
||||
) from None
|
||||
raise
|
||||
return created.id, step
|
||||
|
||||
|
||||
def _needs_a_listener(err: HostBackendError) -> bool:
|
||||
return err.status_code == 400 and _LISTENER_REQUIRED_MARKER in err.message
|
||||
|
||||
|
||||
def _available_listeners(client: HostBackendClient) -> tuple[Listener, ...]:
|
||||
resources = _call_host_backend_with_optional_tenant(
|
||||
client, lambda c: c.list_listeners()
|
||||
@@ -1573,7 +1586,7 @@ class CustomerRegistrySource:
|
||||
secrets=ctx.secrets,
|
||||
)
|
||||
except HostBackendError as err:
|
||||
if err.status_code == 400 and _LISTENER_REQUIRED_MARKER in err.message:
|
||||
if _needs_a_listener(err):
|
||||
raise click.UsageError(
|
||||
"This workspace deploys through a listener. Re-run with "
|
||||
f"--listener-id and --k8s-namespace.\n{err.message}"
|
||||
|
||||
Reference in New Issue
Block a user